Comments (9)
@pierre-jochem FYI
from quasar-testing.
In our case we blocked quasar to 2.15.4 for the moment, which is suboptimal.
@IlCallo Is there any chance that quasar reintroduces the ESM module? I don't see any disadvantages in having it both compiled as Universal module (UMD) as it is now and as ESM module, especially since ESM are the de facto standard in the JS / TS Ecosystem.
Reintroducing the file, would immediately solve the issue. Otherwise, we will have to see how to instruct jest to work with UMD modules, which maybe quite difficult, if possible at all.
from quasar-testing.
We solved the issue the same way, locked quasar to 2.12.3. @IlCallo I agree it would be really helpful to reintroduce the ESM module.
from quasar-testing.
I'd say we need to update that, feel free to send a PR
from quasar-testing.
@antonio-masotti what happens if you remove the mapper altogether?
from quasar-testing.
@antonio-masotti what happens if you remove the mapper altogether?
Not sure I understand what you mean
The mapper in our own project is needed to resolve paths with alias (e.g. '^@/validators/(.*)$': '<rootDir>/src/validators/$1',
), but the problem is in the jest-preset.mjs
in the node_modules/@quasar/quasar-app-extension-testing-unit-jest
.
This is the line causing the error.
Removing our mapper would hinder the tests to resolve the imports that use aliases. Removing that line would of course break many if not all quasar-related functionalities.
from quasar-testing.
@antonio-masotti @IlCallo
I removed the reference and it now runs my Pinia tests but errors a few imports
FAIL test/jest/__tests__/App.spec.js
● Test suite failed to run
TypeError: [BABEL]: _lruCache is not a constructor (While processing: node_modules/@babel/preset-env/lib/index.js)
3 | import { createLocalVue, mount, shallowMount } from '@vue/test-utils'
4 |
> 5 | import QBUTTON from './demo/QBtn-demo.vue'
| ^
6 |
7 | const { Quasar } = All
8 |
at Object.<anonymous> (node_modules/@babel/preset-env/node_modules/@babel/helper-compilation-targets/src/index.ts:173:22)
at Object.require (node_modules/@babel/preset-env/src/debug.ts:1:1)
at Object.require (node_modules/@babel/preset-env/src/index.ts:2:1)
at transform (node_modules/@babel/core/src/transform.ts:56:56)
at processTemplate (node_modules/@vue/vue3-jest/lib/process.js:138:20)
at Object.module.exports [as process] (node_modules/@vue/vue3-jest/lib/process.js:166:26)
at Object.require (test/jest/__tests__/App.spec.js:5:1)
FAIL test/jest/__tests__/MyDialog.spec.js
● Test suite failed to run
TypeError: [BABEL]: _lruCache is not a constructor (While processing: node_modules/@babel/preset-env/lib/index.js)
2 | import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-jest';
3 | import { DOMWrapper, mount } from '@vue/test-utils';
> 4 | import MyDialog from './demo/MyDialog';
| ^
5 |
6 | installQuasarPlugin();
7 |
at Object.<anonymous> (node_modules/@babel/preset-env/node_modules/@babel/helper-compilation-targets/src/index.ts:173:22)
at Object.require (node_modules/@babel/preset-env/src/debug.ts:1:1)
at Object.require (node_modules/@babel/preset-env/src/index.ts:2:1)
at transform (node_modules/@babel/core/src/transform.ts:56:56)
at processTemplate (node_modules/@vue/vue3-jest/lib/process.js:138:20)
at Object.module.exports [as process] (node_modules/@vue/vue3-jest/lib/process.js:166:26)
at Object.require (test/jest/__tests__/MyDialog.spec.js:4:1)
Any ideas? Once I get this straightened, I'd be happy to submit a PR.
from quasar-testing.
@whoacowboy What you described in #375 is what I meant with
Removing our mapper would hinder the tests to resolve the imports that use aliases. Removing that line would of course break many if not all quasar-related functionalities.
from quasar-testing.
@antonio-masotti Indeed it did break everything. And now I am finally able to read your last sentence.
I tried linking to quasar/dist/quasar.umd.js
and that gave me the below error. Linking to quasar/dist/quasar.server.prod.js
gave me a similar error to #375.
FAIL test/jest/__tests__/MyButton.spec.js
● Test suite failed to run
TypeError: Cannot destructure property 'h' of 'window.Vue' as it is undefined.
1 | import { describe, expect, it } from '@jest/globals';
> 2 | import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-jest';
| ^
3 | import { mount, shallowMount } from '@vue/test-utils';
4 | import { QBtn } from 'quasar';
5 | import MyButton from './demo/MyButton';
at h (node_modules/quasar/dist/quasar.umd.js:15:9)
at Object.<anonymous> (node_modules/quasar/dist/quasar.umd.js:31367:2)
at Object.<anonymous> (node_modules/@quasar/quasar-app-extension-testing-unit-jest/src/helpers/install-quasar-plugin.ts:4:1)
at Object.<anonymous> (node_modules/@quasar/quasar-app-extension-testing-unit-jest/src/helpers/main.ts:1:1)
at Object.require (test/jest/__tests__/MyButton.spec.js:2:1)
I need to come up with some sort of work around for this for our current project. I'll post back what I find or which way we go.
from quasar-testing.
Related Issues (20)
- How to trigger an event in my jest test? HOT 1
- Proposal: new QDialog helper commands HOT 1
- Module vue-jest in the transform option was not found HOT 3
- error TS2339: Property 'dataCy' does not exist on type 'cy & CyEventEmitter' HOT 5
- `q-select` multiple selection behaves strangely in cypress component test HOT 7
- Update `start-server-and-test` in package `e2e-cypress` HOT 1
- `"test:e2e"` does not open up Cypress and `"test:e2e:ci"` does not complete at all. HOT 2
- `Module not found: Can't resolve imported dependency "./commands"` HOT 6
- TypeError: Cannot set property mark of #<Object> which has only a getter HOT 2
- `Do not import @jest/globals outside of the Jest test environment` HOT 1
- quasar-app-extension-testing-e2e-cypress depends on vulnerable libraries HOT 3
- Jest doesn't work. HOT 1
- Cypress doesn't work HOT 1
- Quasar 2.14.6 with app-vite fails cypress tests HOT 14
- Vitest issues with nested quasar components HOT 2
- Proposal: Improve portal dependent components (e.g. QSelect , QButtonGroup etc) testing experience
- Quasar testing adding cypress and jest w/ @quasar/app-vite doesn't allow me to run `quasar dev` HOT 1
- Unmet peer dependencies HOT 2
- jest not working on new install of quasar and @quasar/[email protected]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quasar-testing.