debian-mirror-gitlab/jest_resolver.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
621 B
JavaScript
Raw Permalink Normal View History

2021-11-18 22:05:49 +05:30
const fs = require('fs');
// Wrap jest default resolver to detect missing frontend fixtures.
module.exports = (request, options) => {
try {
return options.defaultResolver(request, options);
} catch (e) {
if (request.match(/tmp\/tests\/frontend\/fixtures/) && !fs.existsSync(request)) {
console.error(
'\x1b[1m\x1b[41m\x1b[30m %s \x1b[0m %s',
'!',
2023-07-09 08:55:56 +05:30
`Fixture file ${request} does not exist. Did you run bin/rake frontend:fixtures? You can also download fixtures from the gitlab-org/gitlab package registry. See the Fixtures docs for more info.`,
2021-11-18 22:05:49 +05:30
);
}
throw e;
}
};