Initial testing with jest (#133)
* 🎉 initial testing with jest * 👌 update test script names & remove package-lock.json * 👌 add 'yarn test' step to circle-ci build workflow
This commit is contained in:
parent
cdada37e3a
commit
01b72ca051
10 changed files with 1051 additions and 46 deletions
31
jest.config.js
Normal file
31
jest.config.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
process.env.VUE_CLI_BABEL_TARGET_NODE = true;
|
||||
process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = true;
|
||||
|
||||
module.exports = {
|
||||
moduleDirectories: ['node_modules', 'app/javascript/src'],
|
||||
moduleFileExtensions: ['js', 'jsx', 'json', 'vue', 'ts', 'tsx', 'vue'],
|
||||
automock: false,
|
||||
resetMocks: true,
|
||||
transform: {
|
||||
'^.+\\.vue$': 'vue-jest',
|
||||
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2|svg)$':
|
||||
'jest-transform-stub',
|
||||
'^.+\\.jsx?$': 'babel-jest',
|
||||
},
|
||||
cacheDirectory: '<rootDir>/.jest-cache',
|
||||
collectCoverage: false,
|
||||
coverageDirectory: 'buildreports',
|
||||
collectCoverageFrom: ['**/app/javascript/**/*.js'],
|
||||
reporters: ['default'],
|
||||
// setupTestFrameworkScriptFile: './tests/setup.ts',
|
||||
transformIgnorePatterns: ['node_modules/*'],
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/app/javascript/$1',
|
||||
},
|
||||
roots: ['<rootDir>/app/javascript'],
|
||||
snapshotSerializers: ['jest-serializer-vue'],
|
||||
testMatch: [
|
||||
'**/app/javascript/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
|
||||
],
|
||||
testURL: 'http://localhost/',
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue