Skip to content

Commit

Permalink
CLI: Change internal displayAvailableReporters to be static
Browse files Browse the repository at this point in the history
No longer dynamically enumerate reporters, which would include
the newly added invisible "perf" reporter that is currently
browser-only.
  • Loading branch information
Krinkle committed May 29, 2023
1 parent 622070a commit 0d034a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions bin/qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ program
const opts = program.opts();

if (opts.reporter === true) {
const requireQUnit = require('../src/cli/require-qunit');
displayAvailableReporters(requireQUnit().reporters);
displayAvailableReporters();
}

const options = {
Expand Down
9 changes: 6 additions & 3 deletions src/cli/find-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@ function findReporter (reporterName, builtin) {
}

// If we didn't find a reporter, display the available reporters and exit
displayAvailableReporters(builtin, reporterName);
displayAvailableReporters(reporterName);
}

function displayAvailableReporters (builtin, inputReporterName) {
function displayAvailableReporters (inputReporterName) {
const message = [];

if (inputReporterName) {
message.push(`No reporter found matching "${inputReporterName}".`);
}

const jsReporters = Object.keys(builtin).sort();
const jsReporters = [
'console',
'tap'
].sort();
message.push(`Built-in reporters: ${jsReporters.join(', ')}`);

const npmReporters = getReportersFromDependencies();
Expand Down
4 changes: 2 additions & 2 deletions test/cli/fixtures/expected/tap-outputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ ok 5 A-Test > derp
'qunit --reporter does-not-exist':
`# stderr
No reporter found matching "does-not-exist".
Built-in reporters: console, perf, tap
Built-in reporters: console, tap
Extra reporters found among package dependencies: npm-reporter
# exit code: 1`,

'qunit --reporter':
`# stderr
Built-in reporters: console, perf, tap
Built-in reporters: console, tap
Extra reporters found among package dependencies: npm-reporter
# exit code: 1`,
Expand Down

0 comments on commit 0d034a1

Please sign in to comment.