Skip to content

Commit d1e93f8

Browse files
committed
Add configuration to get some tests/testing suites to succeed
1 parent f3fed13 commit d1e93f8

9 files changed

+36738
-26912
lines changed

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ if (fs.existsSync('./.babelrc')) {
1313
}
1414

1515
module.exports = {
16-
presets: ['@quasar/babel-preset-app'],
16+
presets: ['@quasar/babel-preset-app', '@babel/preset-typescript', '@vue/cli-plugin-babel/preset', '@babel/preset-env'],
1717
extends: extend,
1818
};

jest.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ module.exports = {
1111
pug: { doctype: 'html' },
1212
}
1313
},
14+
modulePaths: [ "<rootDir>", "/home/some/other/path" ],
15+
moduleDirectories: [ "node_modules" ],
16+
testEnvironmentOptions: {
17+
customExportConditions: ["node", "node-addons"],
18+
},
1419
// noStackTrace: true,
1520
// bail: true,
1621
// cache: false,
@@ -37,7 +42,7 @@ module.exports = {
3742
'<rootDir>/test/jest/__tests__/**/*.(spec|test).js',
3843
'<rootDir>/src/**/*.jest.(spec|test).js',
3944
],
40-
moduleFileExtensions: ['vue', 'js', 'jsx', 'json'],
45+
moduleFileExtensions: ['vue', 'js', 'jsx', 'json', 'ts'],
4146
moduleNameMapper: {
4247
'^quasar$': 'quasar/dist/quasar.esm.prod.js',
4348
'^~/(.*)$': '<rootDir>/$1',
@@ -50,7 +55,10 @@ module.exports = {
5055
'^boot/(.*)$': '<rootDir>/src/boot/$1',
5156
'.*css$': '@quasar/quasar-app-extension-testing-unit-jest/stub.css',
5257
},
58+
preset: 'ts-jest',
5359
transform: {
60+
'^.+\\.(ts|tsx)?$': 'ts-jest',
61+
// '^.+\\.(js|jsx)$": "babel-jest',
5462
// '.*\\.vue$': 'vue-jest',
5563
'.*\\.vue$': '@vue/vue3-jest',
5664
'.*\\.js$': 'babel-jest',

package-lock.json

Lines changed: 36708 additions & 26903 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"concurrently:dev:jest": "concurrently \"quasar dev\" \"jest --watch\""
2626
},
2727
"dependencies": {
28+
"@babel/preset-env": "^7.22.14",
2829
"@he-tree/vue": "^2.4.2",
2930
"@overvue/vue3-tree-chart": "^0.7.6",
3031
"@quasar/cli": "^1.3.2",
@@ -33,6 +34,7 @@
3334
"@types/node": "^18.8.0",
3435
"@typescript-eslint/eslint-plugin": "^5.36.2",
3536
"@typescript-eslint/parser": "^5.36.2",
37+
"babel-jest": "^29.6.4",
3638
"bootstrap": "^5.2.0",
3739
"bootstrap-vue": "^2.22.0",
3840
"core-js": "^3.21.1",
@@ -41,7 +43,9 @@
4143
"fs-extra": "^10.0.0",
4244
"http": "^0.0.1-security",
4345
"https": "^1.0.0",
44-
"jest-cli": "^27.5.1",
46+
"jest": "^29.6.4",
47+
"jest-cli": "^29.6.4",
48+
"jest-environment-jsdom": "^29.6.4",
4549
"localforage": "^1.10.0",
4650
"lodash.clonedeep": "^4.5.0",
4751
"lodash.isequal": "^4.5.0",
@@ -53,6 +57,7 @@
5357
"prismjs": "^1.27.0",
5458
"quasar": "^2.5.5",
5559
"quasar-dotenv": "^1.0.5",
60+
"ts-jest": "^29.1.1",
5661
"typescript": "^4.8.3",
5762
"vue": "^3.2.31",
5863
"vue-accessible-color-picker": "^4.0.3",
@@ -71,13 +76,15 @@
7176
},
7277
"devDependencies": {
7378
"@babel/eslint-parser": "^7.17.0",
79+
"@babel/preset-typescript": "^7.22.11",
7480
"@pinia/testing": "^0.0.14",
7581
"@quasar/app": "^3.3.3",
7682
"@quasar/quasar-app-extension-testing-unit-jest": "^3.0.0-alpha.7",
83+
"@vue/cli-plugin-babel": "^5.0.8",
7784
"@vue/devtools": "^6.0.12",
7885
"@vue/test-utils": "^2.0.0-rc.18",
7986
"@vue/tsconfig": "^0.1.3",
80-
"@vue/vue3-jest": "^27.0.0-alpha.4",
87+
"@vue/vue3-jest": "^29.2.5",
8188
"electron": "^17.4.10",
8289
"electron-builder": "^23.0.2",
8390
"electron-is-dev": "^2.0.0",
@@ -86,7 +93,9 @@
8693
"eslint-config-prettier": "^8.3.0",
8794
"eslint-plugin-jest": "^26.1.1",
8895
"eslint-plugin-vue": "^8.4.1",
89-
"eslint-webpack-plugin": "^3.1.1"
96+
"eslint-webpack-plugin": "^3.1.1",
97+
"install": "^0.13.0",
98+
"npm": "^9.8.1"
9099
},
91100
"browserslist": [
92101
"last 10 Chrome versions",

src/shims-vue.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.vue' {
2+
import vue from 'vue';
3+
export default vue;
4+
}

test/jest/__tests__/App.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
// import mutations from "../../../src/store/options/mutations";
66
import { setActivePinia, createPinia } from 'pinia'
7-
import { useStore } from "src/store/main.js";
7+
import { useStore } from "../../../src/store/main.js";
88

99

1010
/**

test/jest/__tests__/booleanToggles.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createApp } from "vue";
33
import { createTestingPinia } from "@pinia/testing";
44
import * as All from "quasar";
55
const { Quasar, date } = All;
6-
import { useStore } from "../../../store/main.js";
6+
import { useStore } from "../../../src/store/main.js";
77

88
const store = useStore();
99
//testing that export as typescript on/off, showTutorial, all update properly

test/jest/__tests__/dragAndDropTest.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { mount, createLocalVue, shallowMount } from "@vue/test-utils";
66
import * as All from "quasar";
77
import { iterate } from "localforage";
8-
import { useStore } from "../../../store/main.js";
8+
import { useStore } from "../../../src/store/main.js";
99
import { createTestingPinia } from "@pinia/testing";
1010
const { Quasar, date } = All;
1111

test/jest/__tests__/openProject.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as All from "quasar";
55
const { Quasar, date } = All;
66

77
import { createTestingPinia } from "@pinia/testing"; // *
8-
import { useStore } from "../../src/store/main"; // *
8+
import { useStore } from "../../../src/store/main"; // *
99
const piniaStore = useStore(); // *
1010

1111
const components = Object.keys(All).reduce((object, key) => {

0 commit comments

Comments
 (0)