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

JSON file in __mocks__ folder cannot be imported #6488

Closed
freesteph opened this issue Jun 18, 2018 · 2 comments · Fixed by #8159
Closed

JSON file in __mocks__ folder cannot be imported #6488

freesteph opened this issue Jun 18, 2018 · 2 comments · Fixed by #8159

Comments

@freesteph
Copy link

🐛 Bug Report

I would like to manual mock a JSON file I'm using:

$ ls src/
  __mocks__/
    data.json
  data.json
  index.js

When I try to run my testsuite, I get the SyntaxError: Unexpected token : on the first key-pair value when the JSON is imported.

To Reproduce

Manual-mock a JSON file.

Expected behavior

Manual mocks should allow JSON files.

Link to repl or repo (highly encouraged)

https://repl.it/@freesteph/JSON-manual-mock-failure

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS Sierra 10.12.3
    CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  Binaries:
    Node: 8.9.0 - ~/.nvm/versions/node/v8.9.0/bin/node
    Yarn: 1.5.1 - ~/.yarn/bin/yarn
    npm: 3.10.10 - ~/build/asos-web-product-listing-page/node_modules/.bin/npm
  npmPackages:
    jest: ^22.1.4 => 22.1.4
@milafrerichs
Copy link

any news on this? ran into the same thing.

@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

Successfully merging a pull request may close this issue.

2 participants