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.

Can't make it work with Angular CLI and custom Jest builder.

See original GitHub issue

Environment

  1. node -v: v8.12.0
  2. npm -v: 6.4.1
  3. npm ls jest or npm ls react-scripts (if you haven’t ejected): npm ls jest:
`-- jest@23.6.0
  1. your vscode-jest settings if customized:

    • jest.pathToJest: npm test --
    • anything else that you think might be relevant?
  2. Operating system: Windows 10

Prerequisite

  • are you able to run jest test from command line? Yes.
  • how do yo run your tests from command line?
    • npm run test
    • ng test

Steps to Reproduce

// TODO

Relevant Debug Info

spawning process with command=npm, args=test,--,--json,--useStderr,--outputFile,C:\Users\MICHAE~1.DEA\AppData\Local\Temp/jest_runner.json,--no-color
> ng test --watch "--json" "--useStderr" "--outputFile" "C:\Users\SuperCoolUserName\AppData\Local\Temp/jest_runner.json" "--watch" "--no-color"

Expected Behavior

I would expect this to use the configuration from the Angular builder and work.

Actual Behavior

Prints:

No tests found related to files changed since last commit.

Considerations:

I’m using Angular CLI, with Jest configured through @angular-builders/jest package. From command line works as expected using both npm run test, and ng test --watch (npm run test is an alias for the latter). From the npm script panel in VSCode it launches as expected.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:22

github_iconTop GitHub Comments

1reaction
michaeljotacommented, Jul 17, 2019

Oh! I get now what you mean with auto watch. I think you could try to get it working with a workspace. You can setup each app and lib into its own project in the workspace, and configure each. I have a repo with Lerna, but it’s private for now. I’ll try to upload a example with a clean repo.

1reaction
toddwseattlecommented, Jul 17, 2019

Yea; I can’t get your launch.json to work for me; but I created my own that works great with nx. nx is a single repo; but multiple projects; so it’s useful to scope debugging to just the tests on a single library or app rather than the whole thing; which is whay my launch.json does as documented in this gist: https://gist.github.com/toddwseattle/71f1c2b7b439c6523cc543edab030842

What I would like is a way for the auto watch to work so things like the inline red / green dots work; and that I don’t get the problems tabbed filled with un running tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@angular-builders/jest - npm
Jest runner for Angular build facade. Allows ng test run with Jest instead of Karma. Latest version: 15.0.0, last published: 6 days ago....
Read more >
Angular CLI builders
With Angular version 8, the CLI Builder API is stable and available to developers who want to customize the Angular CLI by adding...
Read more >
Angular CLI - unable to use custom environment file for testing
I try to run ng test with a specific flag configured in custom environment file. My @angular/cli version is 8.3.21. My first attempt...
Read more >
Angular CLI: “ng test” with Jest in 3 minutes - Just Jeb
The builder supports multi-projects workspaces by default, the only thing you have to do is to modify each project's tsconfig.spec.json as ...
Read more >
Supported technologies: Angular, Angular CLI - Wallaby.js
When using Automatic Configuration to run tests for the entire workspace, Wallaby creates merged virtual copies of test.ts , polyfills.ts and tsconfig.spec.json ...
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