Skip to content

Commit

Permalink
CLI: Include .mjs and .js in default test file extensions
Browse files Browse the repository at this point in the history
This re-enables the `.mjs` test file that was converted
in commit 8808b04, which moved it to `main` but we test that
in package.json as `qunit test/main test/cli/` which means it wasn't
getting run anymore.
  • Loading branch information
Krinkle committed Jul 8, 2024
1 parent 8808b04 commit 6f72eeb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const pkg = require('../package.json');
const description = `Runs tests using the QUnit framework.
Files should be a space-separated list of files, directories, or glob expressions.
Defaults to 'test/**/*.js'.
Defaults to 'test/**/*.{js,mjs,cjs}'.
For more info on working with QUnit, check out https://qunitjs.com.`;

Expand Down
6 changes: 2 additions & 4 deletions src/cli/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ function getFilesFromArgs (args) {

// Default to files in the test directory
if (!patterns.length) {
// TODO: In QUnit 3.0, change the default to {js,mjs}
patterns.push('test/**/*.js');
patterns.push('test/**/*.{js,mjs,cjs}');
}

const files = new Set();
Expand All @@ -47,8 +46,7 @@ function getFilesFromArgs (args) {
files.add(pattern);
} else {
if (stat && stat.isDirectory()) {
// TODO: In QUnit 3.0, change the default to {js,mjs}
pattern = `${pattern}/**/*.js`;
pattern = `${pattern}/**/*.{js,mjs,cjs}`;
}
const results = glob(pattern, {
cwd: process.cwd(),
Expand Down

0 comments on commit 6f72eeb

Please sign in to comment.