diff --git a/test/parallel/test-permission-fs-read-entrypoint.js b/test/parallel/test-permission-fs-read-entrypoint.js index f0182dce645..ba699ebf9e2 100644 --- a/test/parallel/test-permission-fs-read-entrypoint.js +++ b/test/parallel/test-permission-fs-read-entrypoint.js @@ -21,11 +21,8 @@ const file = fixtures.path('permission', 'hello-world.js'); const simpleLoader = fixtures.path('permission', 'simple-loader.js'); const fsReadLoader = fixtures.path('permission', 'fs-read-loader.js'); -[ - '', - simpleLoader, - fsReadLoader, -].forEach((arg0) => { + +for (const arg0 of ['', simpleLoader, fsReadLoader]) { const { status, stderr } = spawnSync( process.execPath, [ @@ -36,15 +33,17 @@ const fsReadLoader = fixtures.path('permission', 'fs-read-loader.js'); ], ); assert.strictEqual(status, 0, `${arg0} Error: ${stderr.toString()}`); -}); - +} // When the code is read from stdin there is no entrypoint, so no implicit // read access should be granted (in particular, not to the cwd). +//tmpdir.refresh(); + + tmpdir.refresh(); -[ +for (const args of [ ['--permission'], ['--permission', '-'], -].forEach((args) => { +]) { const { status, stdout, stderr } = spawnSync(process.execPath, args, { cwd: tmpdir.path, input: 'console.log(process.permission.has("fs.read", ' + @@ -52,4 +51,4 @@ tmpdir.refresh(); }); assert.strictEqual(status, 0, `${args} Error: ${stderr.toString()}`); assert.strictEqual(stdout.toString().trim(), 'false'); -}); +}