Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests (Node.js v18.17.0) #1950

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tests/command.default.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ const commander = require('../');
const path = require('path');
const util = require('util');

const execFileAsync = util.promisify(childProcess.execFile);
const execFileAsync = function(...args) {
if (args.length < 3) args.push({});
args[2].env ??= { ...process.env };
delete args[2].env.FORCE_COLOR;
return util.promisify(childProcess.execFile).apply(this, args);
};

describe('default executable command', () => {
// Calling node explicitly so pm works without file suffix cross-platform.
Expand Down
7 changes: 6 additions & 1 deletion tests/command.executableSubcommand.inspect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ const childProcess = require('child_process');
const path = require('path');
const util = require('util');

const execFileAsync = util.promisify(childProcess.execFile);
const execFileAsync = function(...args) {
if (args.length < 3) args.push({});
args[2].env ??= { ...process.env };
delete args[2].env.FORCE_COLOR;
return util.promisify(childProcess.execFile).apply(this, args);
};

// Test the special handling for --inspect to increment fixed debug port numbers.
// If we reuse port we can get conflicts because port not released fast enough.
Expand Down
7 changes: 6 additions & 1 deletion tests/command.executableSubcommand.lookup.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const childProcess = require('child_process');
const path = require('path');
const util = require('util');
const execFileAsync = util.promisify(childProcess.execFile);
const execFileAsync = function(...args) {
if (args.length < 3) args.push({});
args[2].env ??= { ...process.env };
delete args[2].env.FORCE_COLOR;
return util.promisify(childProcess.execFile).apply(this, args);
};

// Calling node explicitly so pm works without file suffix cross-platform.
// This file does end-to-end tests actually spawning program.
Expand Down
7 changes: 6 additions & 1 deletion tests/command.parseOptions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ const commander = require('../');
const path = require('path');
const util = require('util');

const execFileAsync = util.promisify(childProcess.execFile);
const execFileAsync = function(...args) {
if (args.length < 3) args.push({});
args[2].env ??= { ...process.env };
delete args[2].env.FORCE_COLOR;
return util.promisify(childProcess.execFile).apply(this, args);
};

// Combination of parse and parseOptions tests which are are more about details
// than high level behaviours which are tested elsewhere.
Expand Down