diff --git a/src/fs/SnapshotZipFS.ts b/src/fs/SnapshotZipFS.ts index 6f0d621..186024c 100644 --- a/src/fs/SnapshotZipFS.ts +++ b/src/fs/SnapshotZipFS.ts @@ -130,6 +130,21 @@ export class SnapshotZipFS extends BasePortableFakeFS { ) ) ), + ppath.resolve( + snapshotPP, + npath.toPortablePath( + npath.relative(npath.fromPortablePath(process.cwd()), npath.fromPortablePath(p)) + ) + ), + ppath.resolve( + snapshotPP, + npath.toPortablePath( + npath.relative( + toNamespacedPath(npath.fromPortablePath(process.cwd())), + toNamespacedPath(npath.fromPortablePath(p)) + ) + ) + ), ]) ) for (const path of pathsToTry) { diff --git a/test/integration/index.js b/test/integration/index.js index b14268f..d7fbc65 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -6,18 +6,32 @@ const cp = require('child_process') async function runTests() { const tempdir = await mkdtemp(path.join(os.tmpdir(), 'nexe-integration-tests-')) + const secondTempdir = await mkdtemp(path.join(os.tmpdir(), 'nexe-integration-tests-without-executable-')) const executable = path.join(tempdir, path.basename(process.argv[0])) await copyFile(process.argv[0], executable) - process.on('beforeExit', () => rimraf.sync(tempdir)) - cp.spawn(executable, - [ - path.join(tempdir, 'node_modules/mocha/bin/mocha.js'), - path.join(tempdir, 'test/integration/tests.integration-spec.js') - ], - { stdio: ['inherit', 'inherit', 'inherit', 'ipc'], cwd: tempdir } - ).on('exit', (code) => { - process.exitCode = code + process.on('beforeExit', () => { + rimraf.sync(tempdir) + rimraf.sync(secondTempdir) }) + console.error('Running integration tests with the binary in the current working directory.') + spawnExecutable(tempdir, () => { + console.error('Running integration tests with the binary in another directory.') + spawnExecutable(secondTempdir) + }) + + function spawnExecutable(cwd, cb) { + cp.spawn(executable, + [ + path.join(tempdir, 'node_modules/mocha/bin/mocha.js'), + path.join(tempdir, 'test/integration/tests.integration-spec.js') + ], + { stdio: ['inherit', 'inherit', 'inherit', 'ipc'], cwd } + ).on('exit', (code) => { + process.exitCode = process.exitCode || code + + if(cb) cb() + }) + } } runTests()