Skip to content
Myr

Fix deno node:process execPath compatibility (#1160)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by CJ · committed by GitHub · parent d3a146e · Browse files · 5 files+49 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: ehmicky <ehmicky@users.noreply.github.com>

Diff stats

5 files+49 added−2 removed

  • tests:+36 added−0 removed
  • other:+13 added−2 removed

5 files+49 added−2 removed

modified:lib/arguments/file-url.js+11 added-1 removed
modified:lib/pipe/pipe-arguments.js+2 added-1 removed
modified:test/helpers/file-path.js+11 added
modified:test/methods/node.js+14 added
5 unmodified lines
6import {execa, execaSync, execaNode} from '../../index.js';7import {FIXTURES_DIRECTORY} from '../helpers/fixtures-directory.js';8import {identity, fullStdio} from '../helpers/stdio.js';9import {foobarString} from '../helpers/input.js';10import {getDenoNodePath} from '../helpers/file-path.js';1112process.chdir(FIXTURES_DIRECTORY);1314const runWithNodeOption = (file, commandArguments, options) => Array.isArray(commandArguments)
58 unmodified lines
73test('Cannot use "node" as binary - "node" option sync', testDoubleNode, 'node', runWithNodeOptionSync);74test('Cannot use path to "node" as binary - execaNode()', testDoubleNode, process.execPath, execaNode);75test('Cannot use path to "node" as binary - "node" option', testDoubleNode, process.execPath, runWithNodeOption);76test('Cannot use path to "node" as binary - "node" option sync', testDoubleNode, process.execPath, runWithNodeOptionSync);77test('Cannot use deno style nodePath as binary - execaNode()', testDoubleNode, getDenoNodePath(), execaNode);78test('Cannot use deno style nodePath as binary - "node" option', testDoubleNode, getDenoNodePath(), runWithNodeOption);79test('Cannot use deno style nodePath as binary - "node" option sync', testDoubleNode, getDenoNodePath(), runWithNodeOptionSync);8081const getNodePath = async () => {82 const {path} = await getNode(TEST_NODE_VERSION);83 return path;
93 unmodified lines
177test.serial('The "nodePath" option is relative to "cwd" - execaNode()', testCwdNodePath, execaNode);178test.serial('The "nodePath" option is relative to "cwd" - "node" option', testCwdNodePath, runWithNodeOption);179test.serial('The "nodePath" option is relative to "cwd" - "node" option sync', testCwdNodePath, runWithNodeOptionSync);180181const testDenoExecPath = async (t, execaMethod) => {182 const {exitCode, stdout} = await execaMethod('noop.js', [], {nodePath: getDenoNodePath()});183 t.is(exitCode, 0);184 t.is(stdout, foobarString);185};186187test('The deno style "nodePath" option can be used - execaNode()', testDenoExecPath, execaNode);188test('The deno style "nodePath" option can be used - "node" option', testDenoExecPath, runWithNodeOption);189test('The deno style "nodePath" option can be used - "node" option sync', testDenoExecPath, runWithNodeOptionSync);190191const testNodeOptions = async (t, execaMethod) => {192 const {stdout} = await execaMethod('empty.js', [], {nodeOptions: ['--version']});193 t.is(stdout, process.version);194};
108 unmodified lines
modified:test/pipe/pipe-arguments.js+11 added
2 unmodified lines
3import test from 'ava';4import {$, execa} from '../../index.js';5import {setFixtureDirectory, FIXTURES_DIRECTORY} from '../helpers/fixtures-directory.js';6import {foobarString} from '../helpers/input.js';7import {getDenoNodePath} from '../helpers/file-path.js';89setFixtureDirectory();1011test('$.pipe(subprocess)', async t => {
61 unmodified lines
73 const {stdout} = await execa('noop.js', [foobarString]).pipe('node', ['stdin.js'], {cwd: FIXTURES_DIRECTORY});74 t.is(stdout, foobarString);75});7677test('execa.$.pipe("file", commandArguments, options with denoNodePath)`', async t => {78 const {stdout} = await execa('noop.js', [foobarString]).pipe('node', ['stdin.js'], {cwd: FIXTURES_DIRECTORY, nodePath: getDenoNodePath()});79 t.is(stdout, foobarString);80});8182test('execa.$.pipe("file", commandArguments, denoNodePath)`', async t => {83 const {stdout} = await execa('noop.js', [foobarString]).pipe(getDenoNodePath(), ['stdin.js'], {cwd: FIXTURES_DIRECTORY});84 t.is(stdout, foobarString);85});8687test('$.pipe.pipe("file", commandArguments, options)', async t => {88 const {stdout} = await $`noop.js ${foobarString}`89 .pipe`stdin.js`90 .pipe('node', ['stdin.js'], {cwd: FIXTURES_DIRECTORY});
193 unmodified lines