Skip to content
Myr

Add cjs to list of expected node script extensions (#1449)

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

* Add cjs to list of expected node script extensions * Extend file extension tests * Lint, and simplify code

authored by John Gee · committed by GitHub · parent f6190b0 · Browse files · 8 files+29 added−16 removed
This commit

State

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

Diff stats

8 files+29 added−16 removed

  • tests:+28 added−15 removed
  • other:+1 added−1 removed

8 files+29 added−16 removed

added:tests/fixtures-extensions/pm-try-cjs.cjs+1 added
added:tests/fixtures-extensions/pm-try-mjs.mjs+1 added
added:tests/fixtures-extensions/pm-try-ts.ts+1 added
added:tests/fixtures-extensions/pm.js+9 added
deleted:tests/fixtures-ts/pm-install.ts-3 removed
deleted:tests/fixtures-ts/pm.ts-8 removed
modified:tests/command.executableSubcommand.lookup.test.js+16 added-4 removed
modified:index.js+1 added-1 removed
1315 unmodified lines
13161317 _executeSubCommand(subcommand, args) {1318 args = args.slice();1319 let launchWithNode = false; // Use node for source targets so do not need to get permissions correct, and on Windows.1320 const sourceExt = ['.js', '.ts', '.tsx', '.mjs'];1320 const sourceExt = ['.js', '.ts', '.tsx', '.mjs', '.cjs'];13211322 // Not checking for help first. Unlikely to have mandatory and executable, and can't robustly test for help flags in external command.1323 this._checkForMissingMandatoryOptions();1324
872 unmodified lines