diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-05 03:11:53 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-05 03:11:53 +0000 |
commit | b892ac7767d111a4762161fecf826f7030d30689 (patch) | |
tree | 6fcbbadc3e4af092640c171888e1d7231ca67ca7 /jest_resolver.js | |
parent | 33a1d1835f5fc146acf0cdda402b5a327ae0d52f (diff) | |
download | gitlab-ce-b892ac7767d111a4762161fecf826f7030d30689.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'jest_resolver.js')
-rw-r--r-- | jest_resolver.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/jest_resolver.js b/jest_resolver.js new file mode 100644 index 00000000000..6cbc1b9f18f --- /dev/null +++ b/jest_resolver.js @@ -0,0 +1,17 @@ +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', + '!', + `Fixture file ${request} does not exist. Did you run bin/rake frontend:fixtures?`, + ); + } + throw e; + } +}; |