Commit b9d5c280 authored by Albert Salim's avatar Albert Salim

Print error when fixture is not generated

parent 2352c42b
......@@ -112,6 +112,7 @@ module.exports = (path, options = {}) => {
cacheDirectory: '<rootDir>/tmp/cache/jest',
modulePathIgnorePatterns: ['<rootDir>/.yarn-cache/'],
reporters,
resolver: './jest_resolver.js',
setupFilesAfterEnv: [`<rootDir>/${path}/test_setup.js`, 'jest-canvas-mock'],
restoreMocks: true,
transform: {
......
const Resolver = require('jest-resolve');
// Wrap jest default resolver to detect missing frontend fixtures.
module.exports = (request, options) => {
try {
return options.defaultResolver(request, options)
} catch (e) {
if (Resolver.tryCastModuleNotFoundError(e) && request.match(/tmp\/tests\/frontend\/fixtures/)) {
console.error('\x1b[1m\x1b[41m\x1b[30m %s \x1b[0m %s', '!', `Fixture file ${request} does not exist. Did you run bin/rake frontend:fixtures?`)
}
throw e;
}
};
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