Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -3,12 +3,13 @@
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = enhanceUnexpectedTokenMessage;
exports.default = handlePotentialSyntaxError;
exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
@@ -27,6 +28,24 @@ function _interopRequireDefault(obj) {
*/
const DOT = ' \u2022 ';
function handlePotentialSyntaxError(e) {
if (e.codeFrame) {
e.stack = e.message + '\n' + e.codeFrame;
}
if (
// `instanceof` might come from the wrong context
e.name === 'SyntaxError' &&
(e.message.includes('Unexpected token') ||
e.message.includes('Cannot use import')) &&
!e.message.includes(' expected')
) {
throw enhanceUnexpectedTokenMessage(e);
}
return e;
}
function enhanceUnexpectedTokenMessage(e) {
e.stack =
`${_chalk().default.bold.red('Jest encountered an unexpected token')}
@@ -36,6 +55,9 @@ This usually means that you are trying to import a file which Jest cannot parse,
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
${DOT}If you are trying to use ECMAScript Modules, see ${_chalk().default.underline(
'https://jestjs.io/docs/en/ecmascript-modules'
)} for how to enable it.
${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold(
'"transformIgnorePatterns"'
)} in your config.