-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
jest-circus test failures #3770
Conversation
expect.getState = () => global[GLOBAL_STATE].state; | ||
expect.getState = getState; | ||
expect.setState = setState; | ||
expect.extractExpectedAssertionsErrors = extractExpectedAssertionsErrors; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i brought in here. It used to be inside jasmine package, which i think is wrong place for it to be in, since it deals with many matcher implementation details (accessing state, formatting errors, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thymikee yeah! i agree for assert
support, but expect.assertions
is another story, since it's an expect
feature and heavily coupled to matchers package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I looked at wrong code 😅
👍
@@ -0,0 +1,48 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i extracted this from jest-matchers/src/index.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can call it jestMatchersObject
? (btw would be nice to settle on naming convention for files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thymikee that's a good name! i'll use that.
and yeah, our file naming conventions are broken :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming them would be quite easy since we have Flow though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renaming is not hard. agreeing on the convention is :D
i only like undercores + everything lower case (dependency_resolver.js
) because:
- macOS is case insensitive, and case issues happen quite often ("works locally, breaks on CI", or "i renamed the file, but it's already added to git and git won't see my new name")
- no one knows when to capitalize filenames (is it when exporting classes? or objects? or functions?) and it's always a mess
using camel case tho saves 1 character everywhere you'd type an underscore, and it looks more like what you'd name a variable in JS.
it's definitely unrelated to the PR though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the comment in relevant issue ;)
* @flow | ||
*/ | ||
|
||
import type {DiffOptions} from 'jest-diff/src/diffStrings'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you run prettier on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call :)
5866a13
to
005140f
Compare
break; | ||
} | ||
} | ||
}; | ||
|
||
const _addExpectedAssertionErrors = (test: TestEntry) => { | ||
const errors = extractExpectedAssertionsErrors(); | ||
errors.length && (test.status = 'fail'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it is shorter, but I think it would be more readble like this, no?
if (errors.length) {
test.status = 'fail'
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would disagree with readability, recently i find it very hard to navigate through 100 lines functions that do just 2 things, but i agree that this line messes up semantics pretty bad by using a logical operator as an if
condition :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, as long as we don't have pattern matching :D
packages/jest-matchers/src/index.js
Outdated
getMatchers, | ||
getState, | ||
setMatchers, | ||
setState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are functions, not belonging to a class, wouldn't it be better to use this naming?
getMatchersState
setMatchersState
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's still namespaced within the matchers package though.
and with this naming the other two functions will become getMatchersMatchers
then :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Left some comments inlined.
@@ -17,6 +17,25 @@ const normalizeDots = text => text.replace(/\.{1,}$/gm, '.'); | |||
|
|||
skipOnWindows.suite(); | |||
|
|||
const cleanupStackTrace = stderr => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make sure this function verifies that there is a stack trace for both and fails if one of them or both are missing? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can't run both versions yet (jasmine and circus). And this is mostly for me. when i'm done with circus this will be removed, and the error is there only to make sure i don't forget to remove it after i'm done :)
@@ -220,7 +220,7 @@ const _formatError = (error: ?Exception): string => { | |||
} else if (error.message) { | |||
return error.message; | |||
} else { | |||
return String(error); | |||
return `${String(error)} thrown`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are turning it into a sentence, it needs to end with a .
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the way jasmine throws errors now, i just change it to this to be compatible with current snapshots
8a57c1c
to
1dbfa55
Compare
1dbfa55
to
bab4eac
Compare
Codecov Report
@@ Coverage Diff @@
## master #3770 +/- ##
==========================================
- Coverage 58.09% 57.65% -0.44%
==========================================
Files 191 194 +3
Lines 6708 6773 +65
Branches 6 6
==========================================
+ Hits 3897 3905 +8
- Misses 2808 2865 +57
Partials 3 3
Continue to review full report at Codecov.
|
* jest-cirtus failure tests * jest-circus failure messages
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
addresses all failing tests in
integration_tests/__tests__/failures-test.js
assert
module failuresexpect.assertions(555)