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

Use jest-localstorage-mock instead of mocking those objects oneself #216

Closed
jeserkin opened this issue Dec 25, 2018 · 1 comment
Closed

Comments

@jeserkin
Copy link

jeserkin commented Dec 25, 2018

yarn add -D jest-localstorage-mock

@thymikee
Copy link
Owner

I think this preset should use latest jsdom environment, like https://github.com/theneva/jest-environment-jsdom-thirteen. It already has localStorage built in, so we don't have to mock it. Plus other improvements. The drawback is that it requires Node 8, but one can always fallback to older jsdom and we can document it.
cc @ahnpnl @wtho

@wtho wtho mentioned this issue Feb 16, 2019
thymikee pushed a commit that referenced this issue Feb 16, 2019
This PR introduces jsdom v13 as default test environment for jest-preset-angular. This is achieved by
* Adding [jest-environment-jsdom-thirteen](https://github.com/theneva/jest-environment-jsdom-thirteen) as dependency
* Adding `testEnvironment: 'jest-environment-jsdom-thirteen' to `jest-preset.js`
* Removing Web Storage API mocks from `example/jestGlobalmocks.ts`
* Adding instructions in README Troubleshooting to configure usage of jsdom v11 (one line in jest configuration)

I added tests in a second commit to confirm it works, but I think they do not have to end up in the repository, as they basically test, what is already tested in jsdom itself.


Closes #216
thymikee pushed a commit that referenced this issue Feb 16, 2019
This PR introduces jsdom v13 as default test environment for jest-preset-angular. This is achieved by
* Adding [jest-environment-jsdom-thirteen](https://github.com/theneva/jest-environment-jsdom-thirteen) as dependency
* Adding `testEnvironment: 'jest-environment-jsdom-thirteen' to `jest-preset.js`
* Removing Web Storage API mocks from `example/jestGlobalmocks.ts`
* Adding instructions in README Troubleshooting to configure usage of jsdom v11 (one line in jest configuration)

I added tests in a second commit to confirm it works, but I think they do not have to end up in the repository, as they basically test, what is already tested in jsdom itself.


Closes #216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants