Upgrade dependencies (#1138)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by GitHub · parent f9f7140 · Browse files · 16 files·+48 added−45 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
16 files+48 added−45 removed
- tests:+37 added−34 removed
- other:+11 added−11 removed
Provenance
- Commit
abd9fd0- Tree
eee42a8- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
f9f7140
16 files changed+48 added−45 removed
modified:lib/arguments/cwd.js+2 added-2 removed
122345678991011121326 unmodified linesimport {statSync} from 'node:fs';import {resolve} from 'node:path';import path from 'node:path';import process from 'node:process';import {safeNormalizeFileUrl} from './file-url.js';
// Normalize `cwd` optionexport const normalizeCwd = (cwd = getDefaultCwd()) => { const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option'); return resolve(cwdString); return path.resolve(cwdString);};
const getDefaultCwd = () => { try {26 unmodified linesmodified:lib/arguments/options.js+2 added-2 removed
11234528 unmodified lines3435363738383940414254 unmodified linesimport {basename} from 'node:path';import path from 'node:path';import process from 'node:process';import crossSpawn from 'cross-spawn';import {npmRunPathEnv} from 'npm-run-path';import {normalizeForceKillAfterDelay} from '../terminate/kill.js';28 unmodified lines options.killSignal = normalizeKillSignal(options.killSignal); options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay); options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
if (process.platform === 'win32' && basename(file, '.exe') === 'cmd') { if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') { // #116 commandArguments.unshift('/q'); }
54 unmodified linesmodified:lib/methods/node.js+3 added-3 removed
122345619 unmodified lines262728293030313233343 unmodified lines383940414242434445465 unmodified linesimport {execPath, execArgv} from 'node:process';import {basename, resolve} from 'node:path';import path from 'node:path';import {safeNormalizeFileUrl} from '../arguments/file-url.js';
// `execaNode()` is a shortcut for `execa(..., {node: true})`export const mapNode = ({options}) => {19 unmodified lines throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.'); }
const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option'); const resolvedNodePath = resolve(cwd, normalizedNodePath); const resolvedNodePath = path.resolve(cwd, normalizedNodePath); const newOptions = { ...options, nodePath: resolvedNodePath, node: shouldHandleNode,3 unmodified lines if (!shouldHandleNode) { return [file, commandArguments, newOptions]; }
if (basename(file, '.exe') === 'node') { if (path.basename(file, '.exe') === 'node') { throw new TypeError('When the "node" option is true, the first argument does not need to be "node".'); }
return [5 unmodified linesmodified:test/arguments/cwd.js+4 added-4 removed
1 import {mkdir, rmdir} from 'node:fs/promises';2-import {relative, toNamespacedPath} from 'node:path';2+import path from 'node:path';3 import process from 'node:process';4 import {pathToFileURL, fileURLToPath} from 'node:url';5 import tempfile from 'tempfile';6 import test from 'ava';6 unmodified lines13 14 const testOptionCwdString = async (t, execaMethod) => {15 const cwd = '/';16 const {stdout} = await execaMethod('node', ['-p', 'process.cwd()'], {cwd});17- t.is(toNamespacedPath(stdout), toNamespacedPath(cwd));17+ t.is(path.toNamespacedPath(stdout), path.toNamespacedPath(cwd));18 };19 20 test('The "cwd" option can be a string', testOptionCwdString, execa);21 test('The "cwd" option can be a string - sync', testOptionCwdString, execaSync);1 unmodified line23 const testOptionCwdUrl = async (t, execaMethod) => {24 const cwd = '/';25 const cwdUrl = pathToFileURL(cwd);26 const {stdout} = await execaMethod('node', ['-p', 'process.cwd()'], {cwd: cwdUrl});27- t.is(toNamespacedPath(stdout), toNamespacedPath(cwd));27+ t.is(path.toNamespacedPath(stdout), path.toNamespacedPath(cwd));28 };29 30 test('The "cwd" option can be a URL', testOptionCwdUrl, execa);31 test('The "cwd" option can be a URL - sync', testOptionCwdUrl, execaSync);60 unmodified lines92 const successProperties = {fixtureName: 'empty.js', expectedFailed: false};93 const errorProperties = {fixtureName: 'fail.js', expectedFailed: true};94 95 const testErrorCwd = async (t, execaMethod, {fixtureName, expectedFailed}) => {96- const {failed, cwd} = await execaMethod(fixtureName, {cwd: relative('.', FIXTURES_DIRECTORY), reject: false});96+ const {failed, cwd} = await execaMethod(fixtureName, {cwd: path.relative('.', FIXTURES_DIRECTORY), reject: false});97 t.is(failed, expectedFailed);98 t.is(cwd, FIXTURES_DIRECTORY);99 };100 4 unmodified linesmodified:test/arguments/local.js+6 added-4 removed
1-import {delimiter} from 'node:path';1+import path from 'node:path';2 import process from 'node:process';3 import {pathToFileURL} from 'node:url';4 import test from 'ava';5 import {execa, $} from '../../index.js';5 unmodified lines11 const isWindows = process.platform === 'win32';12 const ENOENT_REGEXP = isWindows ? /failed with exit code 1/ : /spawn.* ENOENT/;13 14 const getPathWithoutLocalDirectory = () => {15- const newPath = process.env[PATH_KEY].split(delimiter).filter(pathDirectory => !BIN_DIR_REGEXP.test(pathDirectory)).join(delimiter);15+ const newPath = process.env[PATH_KEY]16+ .split(path.delimiter)17+ .filter(pathDirectory => !BIN_DIR_REGEXP.test(pathDirectory)).join(path.delimiter);18 return {[PATH_KEY]: newPath};19 };20 21 const BIN_DIR_REGEXP = /node_modules[\\/]\.bin/;38 unmodified lines60 61 test('localDir option', async t => {62 const command = isWindows ? 'echo %PATH%' : 'echo $PATH';63 const {stdout} = await execa(command, {shell: true, preferLocal: true, localDir: '/test'});62- const envPaths = stdout.split(delimiter);64+ const envPaths = stdout.split(path.delimiter);65 t.true(envPaths.some(envPath => envPath.endsWith('.bin')));66 });67 68 test('localDir option can be a URL', async t => {69 const command = isWindows ? 'echo %PATH%' : 'echo $PATH';70 const {stdout} = await execa(command, {shell: true, preferLocal: true, localDir: pathToFileURL('/test')});69- const envPaths = stdout.split(delimiter);71+ const envPaths = stdout.split(path.delimiter);72 t.true(envPaths.some(envPath => envPath.endsWith('.bin')));73 });modified:test/helpers/file-path.js+2 added-2 removed
112344import {relative} from 'node:path';import path from 'node:path';
export const getAbsolutePath = file => ({file});export const getRelativePath = filePath => ({file: relative('.', filePath)});export const getRelativePath = filePath => ({file: path.relative('.', filePath)});modified:test/helpers/fixtures-directory.js+3 added-3 removed
1-import {delimiter, resolve} from 'node:path';1+import path from 'node:path';2 import process from 'node:process';3 import {fileURLToPath} from 'node:url';4 import pathKey from 'path-key';5 6 export const PATH_KEY = pathKey();7 export const FIXTURES_DIRECTORY_URL = new URL('../fixtures/', import.meta.url);8 // @todo: use import.meta.dirname after dropping support for Node <20.11.09-export const FIXTURES_DIRECTORY = resolve(fileURLToPath(FIXTURES_DIRECTORY_URL));9+export const FIXTURES_DIRECTORY = path.resolve(fileURLToPath(FIXTURES_DIRECTORY_URL));10 11 // Add the fixtures directory to PATH so fixtures can be executed without adding12 // `node`. This is only meant to make writing tests simpler.13 export const setFixtureDirectory = () => {14- process.env[PATH_KEY] = FIXTURES_DIRECTORY + delimiter + process.env[PATH_KEY];14+ process.env[PATH_KEY] = FIXTURES_DIRECTORY + path.delimiter + process.env[PATH_KEY];15 };16 modified:test/methods/bind.js+3 added-3 removed
1-import {join} from 'node:path';1+import path from 'node:path';2 import test from 'ava';3 import {4 execa,5 execaSync,5 unmodified lines11 import {setFixtureDirectory, FIXTURES_DIRECTORY} from '../helpers/fixtures-directory.js';12 13 setFixtureDirectory();14 15-const NOOP_PATH = join(FIXTURES_DIRECTORY, 'noop.js');16-const PRINT_ENV_PATH = join(FIXTURES_DIRECTORY, 'environment.js');15+const NOOP_PATH = path.join(FIXTURES_DIRECTORY, 'noop.js');16+const PRINT_ENV_PATH = path.join(FIXTURES_DIRECTORY, 'environment.js');17 18 const testBindOptions = async (t, execaMethod) => {19 const {stdout} = await execaMethod({stripFinalNewline: false})(NOOP_PATH, [foobarString]);20 t.is(stdout, `${foobarString}\n`);89 unmodified linesmodified:test/methods/command.js+2 added-2 removed
1-import {join} from 'node:path';1+import path from 'node:path';2 import test from 'ava';3 import {4 execa,5 execaSync,10 unmodified lines16 } from '../helpers/fixtures-directory.js';17 import {QUOTE} from '../helpers/verbose.js';18 19 setFixtureDirectory();20-const STDIN_FIXTURE = join(FIXTURES_DIRECTORY, 'stdin.js');20+const STDIN_FIXTURE = path.join(FIXTURES_DIRECTORY, 'stdin.js');21 const ECHO_FIXTURE_URL = new URL('echo.js', FIXTURES_DIRECTORY_URL);22 23 const parseAndRunCommand = command => execa`${parseCommandString(command)}`;24 175 unmodified linesmodified:test/methods/create.js+2 added-2 removed
1-import {join} from 'node:path';1+import path from 'node:path';2 import test from 'ava';3 import {4 execa,5 execaSync,4 unmodified lines10 import {setFixtureDirectory, FIXTURES_DIRECTORY} from '../helpers/fixtures-directory.js';11 12 setFixtureDirectory();13 14-const NOOP_PATH = join(FIXTURES_DIRECTORY, 'noop.js');14+const NOOP_PATH = path.join(FIXTURES_DIRECTORY, 'noop.js');15 16 const testTemplate = async (t, execaMethod) => {17 const {stdout} = await execaMethod`${NOOP_PATH} ${foobarString}`;18 t.is(stdout, foobarString);45 unmodified linesmodified:test/methods/node.js+6 added-6 removed
1-import {dirname, relative} from 'node:path';1+import path from 'node:path';2 import process, {version} from 'node:process';3 import {pathToFileURL} from 'node:url';4 import test from 'ava';5 import getNode from 'get-node';130 unmodified lines136 test.serial('The "nodePath" option impacts the subprocess - "node" option sync', testSubprocessNodePath, runWithNodeOptionSync, identity);137 138 const testSubprocessNodePathDefault = async (t, execaMethod) => {139 const {stdout} = await execaMethod(...nodePathArguments);140- t.true(stdout.includes(dirname(process.execPath)));140+ t.true(stdout.includes(path.dirname(process.execPath)));141 };142 143 test('The "nodePath" option defaults to the current Node.js binary in the subprocess - execaNode()', testSubprocessNodePathDefault, execaNode);144 test('The "nodePath" option defaults to the current Node.js binary in the subprocess - "node" option', testSubprocessNodePathDefault, runWithNodeOption);6 unmodified lines151 });152 153 const testSubprocessNodePathCwd = async (t, execaMethod) => {154 const nodePath = await getNodePath();155- const cwd = dirname(dirname(nodePath));156- const relativeExecPath = relative(cwd, nodePath);155+ const cwd = path.dirname(path.dirname(nodePath));156+ const relativeExecPath = path.relative(cwd, nodePath);157 const {stdout} = await execaMethod(...nodePathArguments, {nodePath: relativeExecPath, cwd});158 t.true(stdout.includes(TEST_NODE_VERSION));159 };160 2 unmodified lines163 test.serial('The "nodePath" option is relative to "cwd" when used in the subprocess - "node" option sync', testSubprocessNodePathCwd, runWithNodeOptionSync);164 165 const testCwdNodePath = async (t, execaMethod) => {166 const nodePath = await getNodePath();167- const cwd = dirname(dirname(nodePath));168- const relativeExecPath = relative(cwd, nodePath);167+ const cwd = path.dirname(path.dirname(nodePath));168+ const relativeExecPath = path.relative(cwd, nodePath);169 const {stdout} = await execaMethod('--version', [], {nodePath: relativeExecPath, cwd});170 t.is(stdout, `v${TEST_NODE_VERSION}`);171 };172 116 unmodified linesmodified:test/methods/parameters-command.js+3 added-3 removed
1-import {join, basename} from 'node:path';1+import path from 'node:path';2 import {fileURLToPath} from 'node:url';3 import test from 'ava';4 import {5 execa,66 unmodified lines72 test('$.sync\'s command argument must be a string or file URL', testInvalidCommand, ['command', 'arg'], $.sync);73 74 const testRelativePath = async (t, execaMethod) => {75 // @todo: use import.meta.dirname after dropping support for Node <20.11.076- const rootDirectory = basename(fileURLToPath(new URL('../..', import.meta.url)));77- const pathViaParentDirectory = join('..', rootDirectory, 'test', 'fixtures', 'noop.js');76+ const rootDirectory = path.basename(fileURLToPath(new URL('../..', import.meta.url)));77+ const pathViaParentDirectory = path.join('..', rootDirectory, 'test', 'fixtures', 'noop.js');78 const {stdout} = await execaMethod(pathViaParentDirectory);79 t.is(stdout, foobarString);80 };81 7 unmodified linesmodified:test/methods/parameters-options.js+2 added-2 removed
1-import {join} from 'node:path';1+import path from 'node:path';2 import test from 'ava';3 import {4 execa,5 execaSync,5 unmodified lines11 import {setFixtureDirectory, FIXTURES_DIRECTORY} from '../helpers/fixtures-directory.js';12 13 setFixtureDirectory();14 15-const NOOP_PATH = join(FIXTURES_DIRECTORY, 'noop.js');15+const NOOP_PATH = path.join(FIXTURES_DIRECTORY, 'noop.js');16 17 const testSerializeArgument = async (t, commandArgument, execaMethod) => {18 const {stdout} = await execaMethod(NOOP_PATH, [commandArgument]);19 t.is(stdout, String(commandArgument));56 unmodified linesmodified:test/return/early-error.js+1 added
23 unmodified lines24 25 const testEarlyErrorShape = async (t, reject) => {26 const subprocess = getEarlyErrorSubprocess({reject});27 t.notThrows(() => {28+ // eslint-disable-next-line promise/prefer-await-to-then29 subprocess.catch(() => {});30 subprocess.unref();31 subprocess.on('error', () => {});32 });83 unmodified linesmodified:test/stdio/file-path-main.js+3 added-3 removed
1 import {readFile, writeFile, rm} from 'node:fs/promises';2-import {dirname, basename} from 'node:path';2+import path from 'node:path';3 import process from 'node:process';4 import {pathToFileURL} from 'node:url';5 import test from 'ava';6 import tempfile from 'tempfile';75 unmodified lines82 const testInputFileValidUrl = async (t, fdNumber, execaMethod) => {83 const filePath = tempfile();84 await writeFile(filePath, foobarString);85 const currentCwd = process.cwd();86- process.chdir(dirname(filePath));86+ process.chdir(path.dirname(filePath));87 88 try {89- const {stdout} = await execaMethod('stdin.js', getStdioInputFile(fdNumber, basename(filePath)));89+ const {stdout} = await execaMethod('stdin.js', getStdioInputFile(fdNumber, path.basename(filePath)));90 t.is(stdout, foobarString);91 } finally {92 process.chdir(currentCwd);93 await rm(filePath);67 unmodified linesmodified:package.json+4 added-4 removed
53 unmodified lines54 "@sindresorhus/merge-streams": "^4.0.0",55 "cross-spawn": "^7.0.3",56 "figures": "^6.1.0",57 "get-stream": "^9.0.0",58- "human-signals": "^7.0.0",58+ "human-signals": "^8.0.0",59 "is-plain-obj": "^4.1.0",60 "is-stream": "^4.0.1",61 "npm-run-path": "^5.2.0",62 "pretty-ms": "^9.0.0",1 unmodified line64 "strip-final-newline": "^4.0.0",65 "yoctocolors": "^2.0.0"66 },67 "devDependencies": {68- "@types/node": "^20.8.9",68+ "@types/node": "^22.1.0",69 "ava": "^6.0.1",70 "c8": "^10.1.2",71 "get-node": "^15.0.0",72- "is-in-ci": "^0.1.0",72+ "is-in-ci": "^1.0.0",73 "is-running": "^2.1.0",74 "path-exists": "^5.0.0",75 "path-key": "^4.0.0",76 "tempfile": "^5.0.0",77 "tsd": "^0.31.0",78 "typescript": "^5.4.5",79 "which": "^4.0.0",80- "xo": "^0.58.0"80+ "xo": "^0.59.3"81 },82 "c8": {83 "reporter": [84 "text",20 unmodified lines