Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tj/commander.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.2.0
Choose a base ref
...
head repository: tj/commander.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.2.1
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 5, 2020

  1. Copy the full SHA
    6032a97 View commit details

Commits on Dec 13, 2020

  1. Release 6.2.1 (#1416)

    * Prepare for 6.2.1 release
    
    * Use current date rather than guess release date
    shadowspawn authored Dec 13, 2020
    Copy the full SHA
    e0e7238 View commit details
Showing with 27 additions and 20 deletions.
  1. +8 −1 CHANGELOG.md
  2. +1 −1 package-lock.json
  3. +1 −1 package.json
  4. +4 −4 tests/command.default.test.js
  5. +13 −13 tests/command.executableSubcommand.lookup.test.js
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
<!-- markdownlint-disable MD024 -->
<!-- markdownlint-disable MD004 -->

## [6.2.1] (2020-12-13)

### Fixed

- some tests failed if directory path included a space ([1390])

## [6.2.0] (2020-10-25)

### Added
@@ -332,9 +338,10 @@ if (program.rawArgs.length < 3) ...
[#1361]: https://github.com/tj/commander.js/pull/1361
[#1368]: https://github.com/tj/commander.js/pull/1368
[#1375]: https://github.com/tj/commander.js/pull/1375

[#1390]: https://github.com/tj/commander.js/pull/1390

[Unreleased]: https://github.com/tj/commander.js/compare/master...develop
[6.2.1]: https://github.com/tj/commander.js/compare/v6.2.0..v6.2.1
[6.2.0]: https://github.com/tj/commander.js/compare/v6.1.0..v6.2.0
[6.1.0]: https://github.com/tj/commander.js/compare/v6.0.0..v6.1.0
[6.0.0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "commander",
"version": "6.2.0",
"version": "6.2.1",
"description": "the complete solution for node.js command-line programs",
"keywords": [
"commander",
8 changes: 4 additions & 4 deletions tests/command.default.test.js
Original file line number Diff line number Diff line change
@@ -3,24 +3,24 @@ const commander = require('../');
const path = require('path');
const util = require('util');

const execAsync = util.promisify(childProcess.exec);
const execFileAsync = util.promisify(childProcess.execFile);

describe('default executable command', () => {
// Calling node explicitly so pm works without file suffix cross-platform.
const pm = path.join(__dirname, './fixtures/pm');

test('when default subcommand and no command then call default', async() => {
const { stdout } = await execAsync(`node ${pm}`);
const { stdout } = await execFileAsync('node', [pm]);
expect(stdout).toBe('default\n');
});

test('when default subcommand and unrecognised argument then call default with argument', async() => {
const { stdout } = await execAsync(`node ${pm} an-argument`);
const { stdout } = await execFileAsync('node', [pm, 'an-argument']);
expect(stdout).toBe("default\n[ 'an-argument' ]\n");
});

test('when default subcommand and unrecognised option then call default with option', async() => {
const { stdout } = await execAsync(`node ${pm} --an-option`);
const { stdout } = await execFileAsync('node', [pm, '--an-option']);
expect(stdout).toBe("default\n[ '--an-option' ]\n");
});
});
26 changes: 13 additions & 13 deletions tests/command.executableSubcommand.lookup.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const childProcess = require('child_process');
const path = require('path');
const util = require('util');
const execAsync = util.promisify(childProcess.exec);
const execFileAsync = util.promisify(childProcess.execFile);

// Calling node explicitly so pm works without file suffix cross-platform.

@@ -13,7 +13,7 @@ const pm = path.join(__dirname, './fixtures/pm');

test('when subcommand file missing then error', () => {
expect.assertions(1);
return execAsync(`node ${pm} list`).catch((err) => {
return execFileAsync('node', [pm, 'list']).catch((err) => {
if (process.platform === 'win32') {
// Get uncaught thrown error on Windows
// eslint-disable-next-line jest/no-conditional-expect
@@ -27,7 +27,7 @@ test('when subcommand file missing then error', () => {

test('when alias subcommand file missing then error', () => {
expect.assertions(1);
return execAsync(`node ${pm} lst`).catch((err) => {
return execFileAsync('node', [pm, 'lst']).catch((err) => {
if (process.platform === 'win32') {
// Get uncaught thrown error on Windows
// eslint-disable-next-line jest/no-conditional-expect
@@ -40,44 +40,44 @@ test('when alias subcommand file missing then error', () => {
});

test('when subcommand file has no suffix then lookup succeeds', async() => {
const { stdout } = await execAsync(`node ${pm} install`);
const { stdout } = await execFileAsync('node', [pm, 'install']);
expect(stdout).toBe('install\n');
});

test('when alias subcommand file has no suffix then lookup succeeds', async() => {
const { stdout } = await execAsync(`node ${pm} i`);
const { stdout } = await execFileAsync('node', [pm, 'i']);
expect(stdout).toBe('install\n');
});

test('when subcommand target executablefile has no suffix then lookup succeeds', async() => {
const { stdout } = await execAsync(`node ${pm} specifyInstall`);
const { stdout } = await execFileAsync('node', [pm, 'specifyInstall']);
expect(stdout).toBe('install\n');
});

test('when subcommand file suffix .js then lookup succeeds', async() => {
const { stdout } = await execAsync(`node ${pm} publish`);
const { stdout } = await execFileAsync('node', [pm, 'publish']);
expect(stdout).toBe('publish\n');
});

test('when alias subcommand file suffix .js then lookup succeeds', async() => {
const { stdout } = await execAsync(`node ${pm} p`);
const { stdout } = await execFileAsync('node', [pm, 'p']);
expect(stdout).toBe('publish\n');
});

test('when subcommand target executablefile has suffix .js then lookup succeeds', async() => {
const { stdout } = await execAsync(`node ${pm} specifyPublish`);
const { stdout } = await execFileAsync('node', [pm, 'specifyPublish']);
expect(stdout).toBe('publish\n');
});

testOrSkipOnWindows('when subcommand file is symlink then lookup succeeds', async() => {
const pmlink = path.join(__dirname, 'fixtures', 'pmlink');
const { stdout } = await execAsync(`node ${pmlink} install`);
const { stdout } = await execFileAsync('node', [pmlink, 'install']);
expect(stdout).toBe('install\n');
});

testOrSkipOnWindows('when subcommand file is double symlink then lookup succeeds', async() => {
const pmlink = path.join(__dirname, 'fixtures', 'another-dir', 'pm');
const { stdout } = await execAsync(`node ${pmlink} install`);
const { stdout } = await execFileAsync('node', [pmlink, 'install']);
expect(stdout).toBe('install\n');
});

@@ -86,11 +86,11 @@ test('when subcommand suffix is .ts then lookup succeeds', async() => {
// The program and the subcommand `pm-install.ts` are both plain JavaScript code.
const binLinkTs = path.join(__dirname, 'fixtures-ts', 'pm.ts');
// childProcess.execFile('node', ['-r', 'ts-node/register', binLinkTs, 'install'], function(_error, stdout, stderr) {
const { stdout } = await execAsync(`node ${binLinkTs} install`);
const { stdout } = await execFileAsync('node', [binLinkTs, 'install']);
expect(stdout).toBe('install\n');
});

test('when subsubcommand then lookup sub-sub-command', async() => {
const { stdout } = await execAsync(`node ${pm} cache clear`);
const { stdout } = await execFileAsync('node', [pm, 'cache', 'clear']);
expect(stdout).toBe('cache-clear\n');
});