MCPcopy Index your code
hub / github.com/nodejs/node / setup

Function setup

test/parallel/test-fs-glob.mjs:20–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18const absDir = tmpdir.resolve('abs');
19
20async function setup() {
21 await mkdir(fixtureDir, { recursive: true });
22 await mkdir(absDir, { recursive: true });
23 const files = [
24 'a/.abcdef/x/y/z/a',
25 'a/abcdef/g/h',
26 'a/abcfed/g/h',
27 'a/b/c/d',
28 'a/bc/e/f',
29 'a/c/d/c/b',
30 'a/cb/e/f',
31 'a/x/.y/b',
32 'a/z/.y/b',
33 'a/.b',
34 'a/b/.b',
35 ].map((f) => resolve(fixtureDir, f));
36
37 const symlinkTo = resolve(fixtureDir, 'a/symlink/a/b/c');
38 const symlinkFrom = '../..';
39 const followTarget = resolve(fixtureDir, 'follow/target');
40 const followLink = resolve(fixtureDir, 'follow/link');
41 const followCycle = resolve(fixtureDir, 'follow/cycle');
42
43 for (const file of files) {
44 const f = resolve(fixtureDir, file);
45 const d = dirname(f);
46 await mkdir(d, { recursive: true });
47 await writeFile(f, 'i like tests');
48 }
49
50 await mkdir(followTarget, { recursive: true });
51 await writeFile(resolve(followTarget, 'file.txt'), 'follow symlinks');
52
53 if (!common.isWindows) {
54 const d = dirname(symlinkTo);
55 await mkdir(d, { recursive: true });
56 await symlink(symlinkFrom, symlinkTo, 'dir');
57 }
58
59 const linkType = common.isWindows ? 'junction' : 'dir';
60 await symlink(followTarget, followLink, linkType);
61 await symlink(resolve(fixtureDir, 'follow'), followCycle, linkType);
62
63 await Promise.all(['foo', 'bar', 'baz', 'asdf', 'quux', 'qwer', 'rewq'].map(async function(w) {
64 await mkdir(resolve(absDir, w), { recursive: true });
65 }));
66}
67
68await setup();
69

Callers 4

test-fs-glob.mjsFile · 0.70

Calls 7

mkdirFunction · 0.90
writeFileFunction · 0.90
symlinkFunction · 0.90
dirnameFunction · 0.85
allMethod · 0.80
mapMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…