question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to run Jest tests with custom reporter

See original GitHub issue

Describe the bug Unable to run Jest tests with a custom reporter (https://jestjs.io/docs/en/cli#reporters).

To Reproduce

  1. Run ng test. OK
  2. Run ng test --reporters=default. Failure:
ng test --reporters=default
Schema validation failed with the following errors:
  Data path ".reporters" should be array.
  1. Run ng test --reporters=default --reporters=default. OK

Expected behavior Jest builder should be able to pass single --reporters option to Jest.

Builder:

  • @angular-builders/jest@7.0.0

Libraries

  • @angular-devkit/build-angular@0.10.6

Additional context

Looks like the issue is relevant for some other array options, e.g. --testPathPattern. But the issue is not reproduced for --runTestsByPath, though it doesn’t work with --runTestsByPath either.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
segreycommented, Jan 18, 2019

@meltedspark Thanks a lot for the fix!

The fix is on its way, but that won’t be enough for fixing the IDE issue. They are passing the --reporters in a wrong way. The right way to do that is --reporters=default --reporters=jest-junit etc. They don’t use = sign therefore it won’t work even after the issue is fixed here.

Looks like, now tests can be run without = sign too: both ng test --reporters default and ng test --reporters=default work for me with @angular-builders/jest@7.2.1. BTW, I’m a maintainer of Jest test runner in JetBrains IDEs, feel free to ping me regarding IDE-related issues.

1reaction
segreycommented, Jan 16, 2019

@meltedspark JetBrains IDE integration (for Angular projects using Jest runner) passes --reporter. This issue is required for it to be working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The 4 stages of flakiness (part 2/3): log failed tests with a Jest ...
Creating a custom reporter would allow to both control the output of the test run and build the report file. We settled for...
Read more >
Troubleshooting - Jest
Troubleshooting. Uh oh, something went wrong? Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why​.
Read more >
Cannot find module @jest/reporters when running 'detox test'
If this is due to peer dependency, you can try npm install @jest/reporters manually since peer dependencies are not auto installed in npm...
Read more >
Writing a Jest Test Reporter - JavaScript in Plain English
Jest is an amazing test framework but its custom test reporter ... in time such as total number of tests run so far,...
Read more >
Configuring Jest
By default, Jest runs all tests and produces all errors into the console upon completion. ... Use this configuration option to add custom...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found