quasar-testing
quasar-testing copied to clipboard
fix(jest): fix path to stub.css
What kind of change does this PR introduce? (check at least one)
- [x] Bugfix
- [ ] New test runner
- [ ] Documentation
- [ ] Feature
- [ ] Code style update
- [ ] Refactor
- [ ] Build-related changes
- [ ] Other, please describe:
If you are adding a new test runner, have you...? (check all)
- [ ] Created an issue first?
- [ ] Registered it in
/packages/base/runners.json
? - [ ] Added it to
/README.md
? - [ ] Included one test that runs
baseline.spec.vue
? - [ ] Added and updated documentation?
- [ ] Included a recipe folder with properly building quasar project?
Does this PR introduce a breaking change? (check one)
- [ ] Yes
- [x] No
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
- [x] It's submitted to the
dev
branch and not themaster
branch - [ ] When resolving a specific issue, it's referenced in the PR's title (e.g.
fix: #xxx[,#xxx]
, where "xxx" is the issue number) - [ ] It's been tested on Windows
- [x] It's been tested on Linux
- [ ] It's been tested on MacOS
- [ ] Any necessary documentation has been added or updated in the docs (for faster update click on "Suggest an edit on GitHub" at bottom of page) or explained in the PR's description.
If adding a new feature, the PR's description includes:
- [ ] A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)
Other information: I encountered an error
Configuration error:
Could not locate module src/css/table_styles.css mapped as:
@quasar/quasar-app-extension-testing-unit-jest/stub.css.
Please check your configuration for these entries:
{
"moduleNameMapper": {
"/.*css$/": "@quasar/quasar-app-extension-testing-unit-jest/stub.css"
},
"resolver": undefined
}
1 | import { ColDef } from 'ag-grid-enterprise';
> 2 | import 'src/css/table_styles.css';
| ^
which is fixed on my site with the change of path to the stub.css.
Not sure what's happening in your case, but stub.css
is copied over to the dist
folder when running build
script, so the current mapping is already correct and AFAIK it works on a newly generated project
Have you tried reinstalling your dependencies?
Could you check node_modules/@quasar/quasar-app-extensions-testing-unit-jest/dist
and let me know if you see stub.css
inside it?
I see stub.css
in the dist folder. No idea why I get this error.
Can you reproduce this into a clean project?
I created a new project, added a css file and import it in the MyButton.vue demo file
FAIL test/jest/__tests__/MyButton.spec.js
● Test suite failed to run
Configuration error:
Could not locate module ./css/table_styles.css mapped as:
@quasar/quasar-app-extension-testing-unit-jest/stub.css.
Please check your configuration for these entries:
{
"moduleNameMapper": {
"/.*css$/": "@quasar/quasar-app-extension-testing-unit-jest/stub.css"
},
"resolver": undefined
}
1 | <script>
2 | import { defineComponent, ref } from 'vue';
> 3 | import './css/table_styles.css'
| ^
4 |
5 | export default defineComponent({
6 | name: 'MyButton',
at createNoMappedModuleFoundError (node_modules/jest-resolve/build/resolver.js:752:17)
at Object.<anonymous> (test/jest/__tests__/demo/MyButton.vue:3:1)
at Object.<anonymous> (test/jest/__tests__/MyButton.spec.js:5:1)