Skip to content

Commit

Permalink
chore: upgrade some deps (#8692)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jul 16, 2019
1 parent ca10069 commit 4a7b28c
Show file tree
Hide file tree
Showing 10 changed files with 2,272 additions and 1,939 deletions.
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,5 +1,5 @@
{
"lerna": "3.13.1",
"lerna": "3.15.0",
"version": "24.8.0",
"npmClient": "yarn",
"packages": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -55,7 +55,7 @@
"karma-mocha": "^1.3.0",
"karma-webpack": "4.0.0-rc.5",
"left-pad": "^1.1.1",
"lerna": "3.13.1",
"lerna": "3.15.0",
"micromatch": "^3.1.10",
"mkdirp": "^0.5.1",
"mocha": "^6.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/package.json
Expand Up @@ -17,7 +17,7 @@
"jest-validate": "^24.8.0",
"prompts": "^2.0.1",
"realpath-native": "^1.1.0",
"yargs": "^13.2.4"
"yargs": "^13.3.0"
},
"devDependencies": {
"@types/exit": "^0.1.30",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/package.json
Expand Up @@ -41,7 +41,7 @@
"@types/exit": "^0.1.30",
"@types/graceful-fs": "^4.1.2",
"@types/micromatch": "^3.1.0",
"@types/p-each-series": "^1.0.0",
"@types/p-each-series": "1.0.0",
"@types/rimraf": "^2.0.2",
"@types/slash": "^2.0.0",
"@types/strip-ansi": "^3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmineAsyncInstall.ts
Expand Up @@ -58,7 +58,7 @@ function promisifyLifeCycleFunction(
// didn't return a promise.
const asyncJestLifecycle = function(done: DoneFn) {
const wrappedFn = isGeneratorFn(fn) ? co.wrap(fn) : fn;
const returnValue = wrappedFn.call({}) as Promise<any>;
const returnValue = wrappedFn.call({});

if (isPromise(returnValue)) {
returnValue.then(done.bind(null, null), (error: Error) => {
Expand Down
10 changes: 3 additions & 7 deletions packages/jest-jasmine2/src/reporter.ts
Expand Up @@ -115,13 +115,9 @@ export default class Jasmine2Reporter implements Reporter {
private _addMissingMessageToStack(stack: string, message?: string) {
// Some errors (e.g. Angular injection error) don't prepend error.message
// to stack, instead the first line of the stack is just plain 'Error'
const ERROR_REGEX = /^Error\s*\n/;
if (
stack &&
message &&
ERROR_REGEX.test(stack) &&
stack.indexOf(message) === -1
) {
const ERROR_REGEX = /^Error:?\s*\n/;

if (stack && message && !stack.includes(message)) {
return message + stack.replace(ERROR_REGEX, '\n');
}
return stack;
Expand Down
24 changes: 18 additions & 6 deletions packages/jest-message-util/src/index.ts
Expand Up @@ -90,6 +90,8 @@ const getRenderedCallsite = (
return renderedCallsite;
};

const blankStringRegexp = /^\s*$/;

// ExecError is an error thrown outside of the test suite (not inside an `it` or
// `before/after each` hooks). If it's thrown, none of the tests in the file
// are executed.
Expand Down Expand Up @@ -119,7 +121,7 @@ export const formatExecError = (
const separated = separateMessageFromStack(stack || '');
stack = separated.stack;

if (separated.message.indexOf(trim(message)) !== -1) {
if (separated.message.includes(trim(message))) {
// Often stack trace already contains the duplicate of the message
message = separated.message;
}
Expand All @@ -131,7 +133,7 @@ export const formatExecError = (
? '\n' + formatStackTrace(stack, config, options, testPath)
: '';

if (message.match(/^\s*$/) && stack.match(/^\s*$/)) {
if (blankStringRegexp.test(message) && blankStringRegexp.test(stack)) {
// this can happen if an empty object is thrown.
message = MESSAGE_INDENT + 'Error: No message was provided';
}
Expand Down Expand Up @@ -331,6 +333,16 @@ export const formatResultsErrors = (
.join('\n');
};

const errorRegexp = /^Error:?\s*$/;

const removeBlankErrorLine = (str: string) =>
str
.split('\n')
// Lines saying just `Error:` are useless
.filter(line => !errorRegexp.test(line))
.join('\n')
.trimRight();

// jasmine and worker farm sometimes don't give us access to the actual
// Error object, so we have to regexp out the message from the stack string
// to format it.
Expand All @@ -344,13 +356,13 @@ export const separateMessageFromStack = (content: string) => {
// If the error is a plain "Error:" instead of a SyntaxError or TypeError we
// remove the prefix from the message because it is generally not useful.
const messageMatch = content.match(
/^(?:Error: )?([\s\S]*?(?=\n\s*at\s.*\:\d*\:\d*)|\s*.*)([\s\S]*)$/,
/^(?:Error: )?([\s\S]*?(?=\n\s*at\s.*:\d*:\d*)|\s*.*)([\s\S]*)$/,
);
if (!messageMatch) {
// For flow
// For typescript
throw new Error('If you hit this error, the regex above is buggy.');
}
const message = messageMatch[1];
const stack = messageMatch[2];
const message = removeBlankErrorLine(messageMatch[1]);
const stack = removeBlankErrorLine(messageMatch[2]);
return {message, stack};
};
2 changes: 1 addition & 1 deletion packages/jest-repl/package.json
Expand Up @@ -16,7 +16,7 @@
"jest-runtime": "^24.8.0",
"jest-validate": "^24.8.0",
"repl": "^0.1.3",
"yargs": "^13.2.4"
"yargs": "^13.3.0"
},
"devDependencies": {
"@types/yargs": "^13.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runtime/package.json
Expand Up @@ -32,7 +32,7 @@
"realpath-native": "^1.1.0",
"slash": "^2.0.0",
"strip-bom": "^3.0.0",
"yargs": "^13.2.4"
"yargs": "^13.3.0"
},
"devDependencies": {
"@types/exit": "^0.1.30",
Expand Down

0 comments on commit 4a7b28c

Please sign in to comment.