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

toMatchInlineSnapshot is not a function #6989

Closed
SpaghettiC0des opened this issue Sep 17, 2018 · 2 comments
Closed

toMatchInlineSnapshot is not a function #6989

SpaghettiC0des opened this issue Sep 17, 2018 · 2 comments

Comments

@SpaghettiC0des
Copy link

🐛 Bug Report

I'm trying to use the inline snapshot feature, and I'm also aware that it has a dependency to prettier, when I try to follow the examples it fails with error

TypeError: expect(...).toMatchInlineSnapshot is not a function

To Reproduce

Steps to reproduce the behavior:

  1. Create an from using create-react-app cli
  2. Create __tests__ dir
  3. Add a simple test inside __tests__
import renderer from "react-test-renderer";

it("should match inline snapshot", () => {
    const tree = renderer.create(<div>foobar</div>).toJSON();
    expect(tree).toMatchInlineSnapshot(); //But it throws => TypeError: expect(...).toMatchInlineSnapshot is not a function
})

Expected behavior

It should add the inline snapshot

Link to repl or repo (highly encouraged)

Run npx envinfo --preset jest

Paste the results here:

System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Binaries:
    Node: 8.11.1 - /usr/local/bin/node
    Yarn: 1.6.0 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
@SimenB
Copy link
Member

SimenB commented Sep 17, 2018

create-react-app uses Jest 20. #5401 (comment)

@SimenB SimenB closed this as completed Sep 17, 2018
@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 12, 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