@@ -2,76 +2,81 @@ const esModules = ['quasar/lang', 'lodash-es'].join('|');
2
2
3
3
/* eslint-env node */
4
4
module . exports = {
5
- globals : {
6
- __DEV__ : true ,
7
- // TODO: Remove if resolved natively https://github.com/vuejs/vue-jest/issues/175
8
- 'vue-jest' : {
9
- pug : { doctype : 'html' } ,
5
+ globals : {
6
+ __DEV__ : true ,
7
+ // TODO: Remove if resolved natively https://github.com/vuejs/vue-jest/issues/175
8
+ 'vue-jest' : {
9
+ pug : { doctype : 'html' }
10
+ }
10
11
} ,
11
- } ,
12
- setupFilesAfterEnv : [ '<rootDir>/test/jest/jest.setup.ts' ] ,
13
- // noStackTrace: true,
14
- // bail: true,
15
- // cache: false,
16
- // verbose: true,
17
- // watch: true,
18
- collectCoverage : false ,
19
- coverageDirectory : '<rootDir>/test/jest/coverage' ,
20
- collectCoverageFrom : [
21
- '<rootDir>/src/**/*.vue' ,
22
- '<rootDir>/src/**/*.js' ,
23
- '<rootDir>/src/**/*.ts' ,
24
- '<rootDir>/src/**/*.jsx' ,
25
- '<rootDir>/src/**/*.tsx' ,
26
- ] ,
27
- coveragePathIgnorePatterns : [ '/node_modules/' , '.d.ts$' ] ,
28
- coverageThreshold : {
29
- global : {
30
- // branches: 50,
31
- // functions: 50,
32
- // lines: 50,
33
- // statements: 50
12
+ testEnvironmentOptions : {
13
+ url : 'http://localhost/' ,
34
14
} ,
35
- } ,
36
- testMatch : [
37
- // Matches tests in any subfolder of 'src' or into 'test/jest/__tests__'
38
- // Matches all files with extension 'js', 'jsx', 'ts' and 'tsx'
39
- '<rootDir>/test/jest/__tests__/**/*.(spec|test).+(ts|js)?(x)' ,
40
- '<rootDir>/src/**/*.jest.(spec|test).+(ts|js)?(x)' ,
41
- ] ,
42
- // Extension-less imports of components are resolved to .ts files by TS,
43
- // grating correct type-checking in test files.
44
- // Being 'vue' the first moduleFileExtension option, the very same imports
45
- // will be resolved to .vue files by Jest, if both .vue and .ts files are
46
- // in the same folder.
47
- // This guarantee a great dev experience both for testing and type-checking.
48
- // See https://github.com/vuejs/vue-jest/issues/188#issuecomment-620750728
49
- moduleFileExtensions : [ 'vue' , 'js' , 'jsx' , 'json' , 'ts' , 'tsx' ] ,
50
- moduleNameMapper : {
51
- '^quasar$' : 'quasar/dist/quasar.common.js' ,
52
- '^~/(.*)$' : '<rootDir>/$1' ,
53
- '^src/(.*)$' : '<rootDir>/src/$1' ,
54
- '^app/(.*)$' : '<rootDir>/$1' ,
55
- '^components/(.*)$' : '<rootDir>/src/components/$1' ,
56
- '^layouts/(.*)$' : '<rootDir>/src/layouts/$1' ,
57
- '^pages/(.*)$' : '<rootDir>/src/pages/$1' ,
58
- '^assets/(.*)$' : '<rootDir>/src/assets/$1' ,
59
- '^boot/(.*)$' : '<rootDir>/src/boot/$1' ,
60
- '.*css$' : '<rootDir>/test/jest/__tests__/__stub_module_files__/style.js' ,
61
- } ,
62
- transform : {
63
- // See https://jestjs.io/docs/en/configuration.html#transformignorepatterns-array-string
64
- [ `^(${ esModules } ).+\\.js$` ] : 'babel-jest' ,
65
- '^.+\\.(ts|js|html)$' : 'ts-jest' ,
66
- '^.+\\.(ts|js)$' : 'babel-jest' ,
67
- // vue-jest uses find-babel-file, which searches by this order:
68
- // (async) .babelrc, .babelrc.js, package.json, babel.config.js
69
- // (sync) .babelrc, .babelrc.js, babel.config.js, package.json
70
- // https://github.com/tleunen/find-babel-config/issues/33
71
- '.*\\.vue$' : 'vue-jest' ,
72
- '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$' :
73
- 'jest-transform-stub' ,
74
- } ,
75
- transformIgnorePatterns : [ `node_modules/(?!(${ esModules } ))` ] ,
76
- snapshotSerializers : [ '<rootDir>/node_modules/jest-serializer-vue' ] ,
15
+ testEnvironment : 'jsdom' ,
16
+ testURL : 'http://localhost/' ,
17
+ setupFilesAfterEnv : [ '<rootDir>/test/jest/jest.setup.ts' ] ,
18
+ // noStackTrace: true,
19
+ // bail: true,
20
+ // cache: false,
21
+ // verbose: true,
22
+ // watch: true,
23
+ collectCoverage : false ,
24
+ coverageDirectory : '<rootDir>/test/jest/coverage' ,
25
+ collectCoverageFrom : [
26
+ '<rootDir>/src/**/*.vue' ,
27
+ '<rootDir>/src/**/*.js' ,
28
+ '<rootDir>/src/**/*.ts' ,
29
+ '<rootDir>/src/**/*.jsx' ,
30
+ '<rootDir>/src/**/*.tsx'
31
+ ] ,
32
+ coveragePathIgnorePatterns : [ '/node_modules/' , '.d.ts$' ] ,
33
+ coverageThreshold : {
34
+ global : {
35
+ // branches: 50,
36
+ // functions: 50,
37
+ // lines: 50,
38
+ // statements: 50
39
+ }
40
+ } ,
41
+ testMatch : [
42
+ // Matches tests in any subfolder of 'src' or into 'test/jest/__tests__'
43
+ // Matches all files with extension 'js', 'jsx', 'ts' and 'tsx'
44
+ '<rootDir>/test/jest/__tests__/**/*.(spec|test).+(ts|js)?(x)' ,
45
+ '<rootDir>/src/**/*.jest.(spec|test).+(ts|js)?(x)'
46
+ ] ,
47
+ // Extension-less imports of components are resolved to .ts files by TS,
48
+ // grating correct type-checking in test files.
49
+ // Being 'vue' the first moduleFileExtension option, the very same imports
50
+ // will be resolved to .vue files by Jest, if both .vue and .ts files are
51
+ // in the same folder.
52
+ // This guarantee a great dev experience both for testing and type-checking.
53
+ // See https://github.com/vuejs/vue-jest/issues/188#issuecomment-620750728
54
+ moduleFileExtensions : [ 'vue' , 'js' , 'jsx' , 'json' , 'ts' , 'tsx' ] ,
55
+ moduleNameMapper : {
56
+ '^quasar$' : 'quasar/dist/quasar.common.js' ,
57
+ '^~/(.*)$' : '<rootDir>/$1' ,
58
+ '^src/(.*)$' : '<rootDir>/src/$1' ,
59
+ '^app/(.*)$' : '<rootDir>/$1' ,
60
+ '^components/(.*)$' : '<rootDir>/src/components/$1' ,
61
+ '^layouts/(.*)$' : '<rootDir>/src/layouts/$1' ,
62
+ '^pages/(.*)$' : '<rootDir>/src/pages/$1' ,
63
+ '^assets/(.*)$' : '<rootDir>/src/assets/$1' ,
64
+ '^boot/(.*)$' : '<rootDir>/src/boot/$1' ,
65
+ '.*css$' : '<rootDir>/test/jest/__tests__/__stub_module_files__/style.js'
66
+ } ,
67
+ transform : {
68
+ // See https://jestjs.io/docs/en/configuration.html#transformignorepatterns-array-string
69
+ [ `^(${ esModules } ).+\\.js$` ] : 'babel-jest' ,
70
+ '^.+\\.(ts|js|html)$' : 'ts-jest' ,
71
+ '^.+\\.(ts|js)$' : 'babel-jest' ,
72
+ // vue-jest uses find-babel-file, which searches by this order:
73
+ // (async) .babelrc, .babelrc.js, package.json, babel.config.js
74
+ // (sync) .babelrc, .babelrc.js, babel.config.js, package.json
75
+ // https://github.com/tleunen/find-babel-config/issues/33
76
+ '.*\\.vue$' : 'vue-jest' ,
77
+ '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$' :
78
+ 'jest-transform-stub'
79
+ } ,
80
+ transformIgnorePatterns : [ `node_modules/(?!(${ esModules } ))` ] ,
81
+ snapshotSerializers : [ '<rootDir>/node_modules/jest-serializer-vue' ]
77
82
} ;
0 commit comments