Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade some deps #8692

Merged
merged 8 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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",
Copy link
Member Author

@SimenB SimenB Jul 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newer versions of p-each-series has types, but they are node 8 only. for some reason the types published as 1.0.1 makes type check fail for us...

"@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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't hurt to always try to replace

return message + stack.replace(ERROR_REGEX, '\n');
}
return stack;
Expand Down
24 changes: 18 additions & 6 deletions packages/jest-message-util/src/index.ts
Original file line number Diff line number Diff line change
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]*)$/,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intellij told me I didn't need to escape the :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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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