Skip to content

Commit ff330ec

Browse files
authored
Merge pull request #11 from oslabs-beta/shanon
Shanon
2 parents 7b3ef60 + dad938c commit ff330ec

28 files changed

+36501
-5892
lines changed

.babelrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"plugins": ["@babel/plugin-syntax-dynamic-import"],
3+
"env": {
4+
"test": {
5+
"plugins": ["dynamic-import-node"],
6+
"presets": [
7+
[
8+
"@babel/preset-env",
9+
{
10+
"modules": "commonjs",
11+
"targets": {
12+
"node": "current"
13+
}
14+
}
15+
]
16+
]
17+
}
18+
}
19+
}

babel.config.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
/* eslint-env node */
2+
// eslint-disable-next-line @typescript-eslint/no-var-requires
3+
const fs = require('fs-extra');
4+
let extend = undefined;
15

2-
module.exports = api => {
3-
return {
4-
presets: [
5-
[
6-
'@quasar/babel-preset-app',
7-
api.caller(caller => caller && caller.target === 'node')
8-
? { targets: { node: 'current' } }
9-
: {}
10-
]
11-
]
12-
}
6+
/**
7+
* The .babelrc file has been created to assist Jest for transpiling.
8+
* You should keep your application's babel rules in this file.
9+
*/
10+
11+
if (fs.existsSync('./.babelrc')) {
12+
extend = './.babelrc';
1313
}
1414

15+
module.exports = {
16+
presets: ['@quasar/babel-preset-app'],
17+
extends: extend,
18+
};

jest.config.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
const esModules = ['quasar', 'quasar/lang', 'lodash-es'].join('|');
2+
3+
module.exports = {
4+
testEnvironment: "jsdom",
5+
verbose: true,
6+
globals: {
7+
__DEV__: true,
8+
// TODO: Remove if resolved natively
9+
// See https://github.com/vuejs/vue-jest/issues/175
10+
'vue-jest': {
11+
pug: { doctype: 'html' },
12+
}
13+
},
14+
// noStackTrace: true,
15+
// bail: true,
16+
// cache: false,
17+
// verbose: true,
18+
// watch: true,
19+
collectCoverage: false,
20+
coverageDirectory: '<rootDir>/test/jest/coverage',
21+
collectCoverageFrom: [
22+
'<rootDir>/src/**/*.vue',
23+
'<rootDir>/src/**/*.js',
24+
'<rootDir>/src/**/*.jsx',
25+
],
26+
// Needed in JS codebases too because of feature flags
27+
coveragePathIgnorePatterns: ['/node_modules/', '.d.ts$'],
28+
coverageThreshold: {
29+
global: {
30+
// branches: 50,
31+
// functions: 50,
32+
// lines: 50,
33+
// statements: 50
34+
},
35+
},
36+
testMatch: [
37+
'<rootDir>/test/jest/__tests__/**/*.(spec|test).js',
38+
'<rootDir>/src/**/*.jest.(spec|test).js',
39+
],
40+
moduleFileExtensions: ['vue', 'js', 'jsx', 'json'],
41+
moduleNameMapper: {
42+
'^quasar$': 'quasar/dist/quasar.esm.prod.js',
43+
'^~/(.*)$': '<rootDir>/$1',
44+
'^src/(.*)$': '<rootDir>/src/$1',
45+
'^app/(.*)$': '<rootDir>/$1',
46+
'^components/(.*)$': '<rootDir>/src/components/$1',
47+
'^layouts/(.*)$': '<rootDir>/src/layouts/$1',
48+
'^pages/(.*)$': '<rootDir>/src/pages/$1',
49+
'^assets/(.*)$': '<rootDir>/src/assets/$1',
50+
'^boot/(.*)$': '<rootDir>/src/boot/$1',
51+
'.*css$': '@quasar/quasar-app-extension-testing-unit-jest/stub.css',
52+
},
53+
transform: {
54+
// '.*\\.vue$': 'vue-jest',
55+
'.*\\.vue$': '@vue/vue3-jest',
56+
'.*\\.js$': 'babel-jest',
57+
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
58+
'jest-transform-stub',
59+
// use these if NPM is being flaky, care as hosting could interfere with these
60+
// '.*\\.vue$': '@quasar/quasar-app-extension-testing-unit-jest/node_modules/vue-jest',
61+
// '.*\\.js$': '@quasar/quasar-app-extension-testing-unit-jest/node_modules/babel-jest'
62+
},
63+
transformIgnorePatterns: [`node_modules/(?!(${esModules}))`],
64+
snapshotSerializers: ['jest-serializer-vue'],
65+
};

0 commit comments

Comments
 (0)