Commit 4b3573f2 authored by Winnie Hellmann's avatar Winnie Hellmann

Setup Jest for Vue

parent b388111f
...@@ -14,6 +14,7 @@ if (process.env.CI) { ...@@ -14,6 +14,7 @@ if (process.env.CI) {
// eslint-disable-next-line import/no-commonjs // eslint-disable-next-line import/no-commonjs
module.exports = { module.exports = {
testMatch: ['<rootDir>/spec/frontend/**/*_spec.js'], testMatch: ['<rootDir>/spec/frontend/**/*_spec.js'],
moduleFileExtensions: ['js', 'json', 'vue'],
moduleNameMapper: { moduleNameMapper: {
'^~(.*)$': '<rootDir>/app/assets/javascripts$1', '^~(.*)$': '<rootDir>/app/assets/javascripts$1',
'^helpers(.*)$': '<rootDir>/spec/frontend/helpers$1', '^helpers(.*)$': '<rootDir>/spec/frontend/helpers$1',
...@@ -26,4 +27,8 @@ module.exports = { ...@@ -26,4 +27,8 @@ module.exports = {
reporters, reporters,
setupTestFrameworkScriptFile: '<rootDir>/spec/frontend/test_setup.js', setupTestFrameworkScriptFile: '<rootDir>/spec/frontend/test_setup.js',
restoreMocks: true, restoreMocks: true,
transform: {
'^.+\\.js$': 'babel-jest',
'^.+\\.vue$': 'vue-jest',
},
}; };
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment