diff --git a/lib/link-gently.js b/lib/link-gently.js index 89ca0f6..d1e955e 100644 --- a/lib/link-gently.js +++ b/lib/link-gently.js @@ -28,7 +28,7 @@ const CLOBBER = Symbol('clobber - ours or in forceful mode') const linkGently = async ({ path, to, from, absFrom, force }) => { if (seen.has(to)) { - return true + return false } seen.add(to) diff --git a/test/link-gently.js b/test/link-gently.js index 32dc774..1048578 100644 --- a/test/link-gently.js +++ b/test/link-gently.js @@ -109,7 +109,7 @@ t.test('racey race', async t => { existingLink: t.fixture('symlink', './pkg/hello.js'), existingFile: 'hello', }) - await Promise.all([ + const multipleLinked = await Promise.all([ mockedLinkGently({ path: `${dir}/pkg`, from: `./pkg/hello.js`, @@ -126,6 +126,8 @@ t.test('racey race', async t => { }), new Promise((res) => fs.symlink(__filename, `${dir}/racecar`, 'file', res)), ]) + t.ok(multipleLinked[0] || multipleLinked[1], 'should link one path succesfully') + t.notSame(multipleLinked[0], multipleLinked[1], 'should fail to link the other path') const target = fs.readlinkSync(`${dir}/racecar`) t.match(target, /^\.\/(other)?pkg\/hello\.js$/, 'should link to one of them') })