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

[Bug]: Snapshots fail with null values using 11.0.0-rc.2 #1148

Closed
brandonroberts opened this issue Nov 8, 2021 · 2 comments · Fixed by #1150
Closed

[Bug]: Snapshots fail with null values using 11.0.0-rc.2 #1148

brandonroberts opened this issue Nov 8, 2021 · 2 comments · Fixed by #1150
Labels
🐛 Bug Confirmed Bug is confirmed

Comments

@brandonroberts
Copy link

brandonroberts commented Nov 8, 2021

Version

11.0.0-rc.2

Steps to reproduce

Clone repo:

git clone [email protected]:brandonroberts/jest-preset-angular.git jest-preset-angular-snapshots-v13
cd jest-preset-angular-snapshots-v13

Checkout repro branch

git checkout snapshot-null-values

Go to v13 example

cd examples/example-app-v13

Install deps

yarn

Run tests

npm run test

Note failing test. If the value with the null property is removed, the test passes successfully

Expected behavior

The snapshot accounts for properties with null values

Actual behavior

The test fails

    TypeError: Cannot convert undefined or null to object
        at hasOwnProperty (<anonymous>)

Additional context

Reverting this change causes the test to pass successfully

https://github.com/thymikee/jest-preset-angular/pull/1113/files#diff-7c8b690a46bc43d11b61313c0ec840cdfd8871231374a18047389991a2a8ec19L116

Environment

System:
    OS: macOS 11.5.2
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    Yarn: 1.22.0 - ~/.yarn/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v14.16.0/bin/npm
  npmPackages:
    jest: ^27.3.1 => 27.3.1
@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 9, 2021

should be fixed in 11.0.0-rc.3, please check:)

@brandonroberts
Copy link
Author

Thanks @ahnpnl! Works correctly now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Confirmed Bug is confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants