From a8a13d3259374a1b25ca4a3e954bca563a66a532 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Wed, 29 Aug 2018 22:45:53 +0200 Subject: Setup Jest test environment --- config/jest.config.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 config/jest.config.js (limited to 'config') diff --git a/config/jest.config.js b/config/jest.config.js new file mode 100644 index 00000000000..23e62f49be1 --- /dev/null +++ b/config/jest.config.js @@ -0,0 +1,27 @@ +/* eslint-disable filenames/match-regex */ + +const reporters = ['default']; + +if (process.env.CI) { + reporters.push([ + 'jest-junit', + { + output: './junit_jest.xml', + }, + ]); +} + +// eslint-disable-next-line import/no-commonjs +module.exports = { + testMatch: ['/spec/frontend/**/*_spec.js'], + moduleNameMapper: { + '^~(.*)$': '/app/assets/javascripts$1', + }, + collectCoverageFrom: ['/app/assets/javascripts/**/*.{js,vue}'], + coverageDirectory: '/coverage-frontend/', + coverageReporters: ['json', 'lcov', 'text-summary', 'clover'], + cacheDirectory: '/tmp/cache/jest', + modulePathIgnorePatterns: ['/.yarn-cache/'], + reporters, + rootDir: '..', // necessary because this file is in the config/ subdirectory +}; -- cgit v1.2.3