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.

'Would you like to update your Snapshots?' will not be shown in case of parameterized tests (describe.each)describe.each

See original GitHub issue

Environment

  1. node -v: v8.16.0
  2. npm -v: v6.4.1
  3. npm ls jest: jest@24.8.0
  4. your vscode-jest settings if customized:
  • “jest.rootPath”: “./toolkit”,
  • “jest.restartJestOnSnapshotUpdate”: true,

** Expected Behaviour ** I use describe.each in my tests and I expect that the “Would you like to update your Snapshots?” dialog will be shown if the snapshot tests fail.

** Actual Behaviour ** The dialog will not be shown because it checks only for “snapshot failed” and “snapshot test failed”

Is the following check on purpose or can it be extended so that parameterized checks also work?

https://github.com/jest-community/vscode-jest/blob/745e6035c7138fe358a03d01be97a520869de1bf/src/JestExt.ts#L408

Jest Output in case of describe.each

    DummyTests > paramTest > Value "red"
    expect(received).toMatchSnapshot()

    New snapshot was not written. The update flag must be explicitly passed to write a new snapshot.

    This is likely because this test is run in a continuous integration (CI) environment in which snapshots are not written by default.

    Received value "green"
   ....

      at Object.toMatchSnapshot (node_modules/jest-chain/dist/chain.js:15:11)
      at Object.test (tests/effects/fillEffect.test.ts:44:66)

    › 3 snapshots failed.

    Snapshot Summary
     › 3 snapshots failed from 1 test suite. Inspect your code changes or press 'u' to update them.

    Test Suites: 1 failed, 1 total
    Tests:       3 failed, 3 total
    Snapshots:   3 failed, 3 total
    Time:        3.619s
    Ran all test suites related to changed files.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shrudacommented, Jul 4, 2019

@connectdotz , I adopted the Jest ‘Getting-Started’ example and added it to my bugreports repo: https://github.com/shruda/bugreports/tree/master/vscode-jest/474

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest: How to Update Snapshot Tests - In Plain English
Run the snapshot test, make sure it passes — if it does not pass, find the problem and fix it, don't change the...
Read more >
Snapshot Testing - Jest
Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly.
Read more >
Parameterized tests - Product Documentation | ServiceNow
Produces a separate test result for each data set. When the test runs, Automated Test Framework replaces the parameters with data set values....
Read more >
JUnit 5 User Guide
Such annotations are inherited at the class level but not at the method ... That means that you can define your own composed...
Read more >
Be Smart, Write Parameterized Tests with Jest!
Have you ever feel like that extra it or test block you've just added inside your describe test block, looks exactly like the...
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