Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestRunner._addCustomReporter "default" filter is not working #3570

Closed
jonathanglasmeyer opened this issue May 15, 2017 · 3 comments
Closed

Comments

@jonathanglasmeyer
Copy link

Do you want to request a feature or report a bug?
bug

What is the current behavior?
I specify custom reporters like so:

  "reporters": [
    "default",
    "<rootDir>/api/test/db-resetting-reporter.js"
  ],

Like the documentation explains. This fails with:

Determining test suites to run...Error: An error occured while adding the reporter at path "default".Cannot find module 'default'
    at customReporters.forEach (/Users/jwerner/mesaic/mesaic/node_modules/jest-cli/build/TestRunner.js:343:15)
    at Array.forEach (native)
    at TestRunner._addCustomReporters (/Users/jwerner/mesaic/mesaic/node_modules/jest-cli/build/TestRunner.js:336:21)
    at TestRunner._setupReporters (/Users/jwerner/mesaic/mesaic/node_modules/jest-cli/build/TestRunner.js:296:12)
    at new TestRunner (/Users/jwerner/mesaic/mesaic/node_modules/jest-cli/build/TestRunner.js:67:10)
    at /Users/jwerner/mesaic/mesaic/node_modules/jest-cli/build/runJest.js:202:27
    at Generator.next (<anonymous>)
    at step (/Users/jwerner/mesaic/mesaic/node_modules/jest-cli/build/runJest.js:10:198)
    at /Users/jwerner/mesaic/mesaic/node_modules/jest-cli/build/runJest.js:10:358
    at process._tickCallback (internal/process/next_tick.js:103:7)

What is the expected behavior?
Not to fail when i specify "default".

I think i also found the fix (start of TestRunner._addCustomReporter method)

const customReporters = reporters.filter(
-  reporter => reporter !== 'default'
+  ([reporter]) => reporter !== 'default'
);

The problem seems to be that reporters are normalized to the [moduleName, options] before, which is why the string format is not recognized correctly here.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

❯ ./node_modules/.bin/jest -v
v20.0.1
@wyze
Copy link
Contributor

wyze commented May 15, 2017

Not sure if this is a duplicate of a previous issue, but there is a PR (#3562) in to fix this.

@jonathanglasmeyer
Copy link
Author

Sweet, thanks for the pointer. Seems to be the exact issue!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants