Skip to content

Commit

Permalink
Merge branch 'fix/jest-force-color' into feature/strictOptionalOption…
Browse files Browse the repository at this point in the history
…Arguments
  • Loading branch information
aweebit committed Aug 8, 2023
2 parents 733d9cd + 9a413ff commit 93f8723
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
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

0 comments on commit 93f8723

Please sign in to comment.