Comments (6)
I took a look at your repo
It's hard even to decide where to start from, it's a total mess
- app-webpack v3 don't support TS5, you force-installed it and expected it to work without problems. One of such problems is this: TypeStrong/fork-ts-checker-webpack-plugin#797 (found as first result on Google searching the Performance error you posted in another issue). app-webpack v3 is already exposing its TS4 version and you should rely on that
- you messed up the tsconfig so hard that it's barely understandable what you were trying to do. Overriding
compilerOptions.paths
made TS blind to Quasar default aliases, then at least 3-4 other options generated problems on their own, and finally you removedcompilerOptions.baseUrl
which is the only important option you should have there - you're applying random babel presets, including
@babel/preset-env
which is already applied by Quasar own babel package - you have bunches of unused deps which are messing with peerDeps resolution mechanism
- you're using NPM, which is notoriously bad in managing deps, which is causing other problems on its own
- you're importing components without
.vue
extension, breaking imports - you removed the shim vue file which allowed to provide a type to imports ending with
.vue
- you're using
'@vue/test-utils'
directly, instead of relying onVueTestUtils
fromcypress/vue
package (breaking change from Cypress 10) - you're using TS on a codebase which is mainly JS, and without types even in TS files, causing all kind of TS errors
- you're using Jest helpers globally instead of importing them from
@jest/globals
, causing type clashes between testing frameworks - you're using JEST into CYPRESS tests
Your project is currently so messed up that it cannot be fixed
Please generate a clean new project, re-add Cypress and Jest AEs and move in your files and configuration bit by bit, fixing problems as you find them
I'd also suggest to get back and study again TS, Cypress and Jest, because it's pretty clear you have a lot of confusion about how these technologies work
I'll close all your issues, please do not open new ones unless you can provide a repro based on a CLEAN Quasar installation
Every issue without such repro will be immediately closed as wontfix
from quasar-testing.
Again and again: we can't help you without a repro, nor an error message, nor anything
AFAIK those commands work flawlessly and we use them everyday in our day job
Either pin-point a way to reproduce that issue, or we simply don't know how to help you
To reduce the scope, you could try reproducing the same problem on a machine using Node 20 and Ubuntu 22.04 (LTS) and see if that's the cause of your many problems
from quasar-testing.
I hit the SyntaxError: Cannot use import statement outside a module
using the default tsconfig.json
when running yarn test:unit
. What should I do?
$ y test:unit
yarn run v1.22.19
$ jest
FAIL test/jest/__tests__/pages/Firestore.spec.ts
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
/usr/src/quasar/src/pages/FireStore.vue:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import "core-js/modules/es.array.push.js";
^^^^^^
SyntaxError: Cannot use import statement outside a module
4 | import { mount, shallowMount } from '@vue/test-utils';
5 | import { QBtn, } from 'quasar'; // <= cherry pick only the components you actually use
> 6 | import FireStorePage from '../../../../src/pages/FireStore.vue'; // <= note the absence of `.vue` extension, here we are importing the JS/TS part of a Double File Component
| ^
7 | installQuasarPlugin();
8 | describe.skip('Firestore page tests', () => {
9 | let wrapper = null;
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
at Object.<anonymous> (test/jest/__tests__/pages/Firestore.spec.ts:6:1)
from quasar-testing.
provide a repro based on a CLEAN Quasar installation
Please read up this: https://antfu.me/posts/why-reproductions-are-required
from quasar-testing.
https://github.com/khteh/Quasar
from quasar-testing.
yarn build
hits the following error:
y build
yarn run v1.22.19
$ QENV=production quasar build
.d88888b.
d88P" "Y88b
888 888
888 888 888 888 8888b. .d8888b 8888b. 888d888
888 888 888 888 "88b 88K "88b 888P"
888 Y8b 888 888 888 .d888888 "Y8888b. .d888888 888
Y88b.Y8b88P Y88b 888 888 888 X88 888 888 888
"Y888888" "Y88888 "Y888888 88888P' "Y888888 888
Y8b
Build mode................ spa
Pkg quasar................ v2.14.3
Pkg @quasar/app-webpack... v3.12.3
Pkg webpack............... v5
Debugging................. no
Publishing................ no
Configured browser support (>= 84.04% of global marketshare):
· Chrome for Android >= 121
· Firefox for Android >= 122
· Android >= 121
· Chrome >= 112
· Edge >= 118
· Firefox >= 113
· iOS >= 16.1
· Opera >= 102
· Safari >= 16.4
App • Running "@quasar/testing-unit-jest" Quasar App Extension...
App • Running "@quasar/testing-e2e-cypress" Quasar App Extension...
App • Running "@quasar/qenv" Quasar App Extension...
App • Extension(@quasar/qenv): Extending quasar.config.js...
App • Cleaned build artifact: "/usr/src/quasar/dist/spa"
App • WAIT • Compiling of "UI" in progress...
App • DONE • "UI" compiled with errors • 6719ms
App • ERROR • UI in test/jest/__tests__/pages/AutoGenerate.spec.ts:17:22
TS2339: Property 'vm' does not exist on type 'WrapperLike'.
15 | const btnToggle = autoGenerate.findComponent('[data-test="toggle-setting-0"]');
16 | expect(btnToggle.exists()).toBeTruthy();
> 17 | expect(btnToggle.vm.btnToggleModel).toEqual(false);
| ^^
18 | await btnToggle.trigger('click');
19 | expect(btnToggle.vm.btnToggleModel).toEqual(true);
20 | const popUpEdit = autoGenerate.findComponent('[data-test="popup-edit-setting-1"]');
<snip>
from quasar-testing.
Related Issues (20)
- test:e2e command of Quasar-Cypress test harness stalls on Windows 11 HOT 2
- Type error in configuration after installation quasar ext add @quasar/testing-unit-vitest HOT 8
- Options param is not forwarded to click method (quasar-app-extension-testing-e2e-cypress) HOT 2
- 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
- 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
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.