-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
jasmine 2 #6769
jasmine 2 #6769
Conversation
woah, this is awesome. I'll let the React folks merge this one, though :) |
@DmitriiAbramov updated the pull request. |
@zpao @sebmarkbage can you think of a way to reduce the amount of permutation in |
@DmitriiAbramov updated the pull request. |
It is supposed to take less time. I posted a PR earlier today that fixes a severe perf issue. Still slow after the change but not that slow. |
@spicyj where can I see your change? I can't find it. |
@DmitriiAbramov updated the pull request. |
0294471
to
bf01b1c
Compare
@DmitriiAbramov updated the pull request. |
@DmitriiAbramov Would you mind rebasing please? |
@gaearon sure |
@DmitriiAbramov updated the pull request. |
var aSpecs = (a.match(/it\s.*$/gm) || []).sort().join('\n'); | ||
var bSpecs = (b.match(/it\s.*$/gm) || []).sort().join('\n'); | ||
expect(aSpecs).toEqual(bSpecs); | ||
} |
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 think this is probably fine. Hacky but fine :). Should we make this fail if both specs are empty?
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.
Note that this only checks the list of tests
✓ it preserves the name of the class for use in error messages
✓ it throws if no render function is defined
✓ it renders a simple stateless component with prop
✓ it renders based on state using initial values in this.props
✓ it renders based on state using props in the constructor
✓ it renders based on context in the constructor
✓ it renders only once when setting state in componentWillMount
✓ it should throw with non-object in the initial state property
✓ it should render with null in the initial state property
✓ it setState through an event handler
✓ it should not implicitly bind event handlers
✓ it renders using forceUpdate even when there is no state
✓ it will call all the normal life cycle methods
✓ it warns when classic properties are defined on the instance, but does not invoke them.
✓ it should warn when misspelling shouldComponentUpdate
✓ it should warn when misspelling componentWillReceiveProps
✓ it should throw AND warn when trying to access classic APIs
✓ it supports this.context passed via getChildContext
✓ it supports classic refs
✓ it supports drilling through to the DOM using findDOMNode
whereas the old one made sure the number of assertions matched. So this is significantly less strict than before.
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.
@spicyj that is true.
Maybe what we can do is add an afterEach
hook that will console.log
the number of expects in the test and make output look something like:
✓ it supports classic refs [# of expects: 4]
and compare that.
hacky.. but maybe that'll do :)
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.
That sounds good to me, can you do that?
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 think we can merge after that's fixed.
@DmitriiAbramov updated the pull request. |
@spicyj i added a custom setup file that monkeypatches jasmine here https://github.com/facebook/react/pull/6769/files#diff-d14cc01bd4a76abb678ced92d16a0e9cR1 it depends on jestjs/jest#1027 and jestjs/jest#1028 This is how failure looks like it will also fail if any of the outputs are empty. let me know if it makes sense and i'll rebase it again as soon as we ship the new version of jest |
@DmitriiAbramov updated the pull request. |
I think that seems reasonable. Is there a way we can make the output show a more readable diff? Even if not, this seems good – thanks for doing the work! |
@spicyj i'll work on the diff next, but that'll be a part of jest :) |
@DmitriiAbramov updated the pull request. |
|
@@ -51,7 +51,7 @@ | |||
"gulp-babel": "^6.0.0", | |||
"gulp-flatten": "^0.2.0", | |||
"gzip-js": "~0.3.2", | |||
"jest-cli": "^12.0.2", | |||
"jest-cli": "^12.1.0", |
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 you make it jest
?
@DmitriiAbramov updated the pull request. |
Thanks a ton @DmitriiAbramov! I rebased this in #6872 and merged. |
hell yeah! I think no one is using jasmine1 any more now, we'll make it optional in Jest and not download it by default any more :) |
Also the tests should be 20 % faster or so :) |
Yes, it certainly seemed so to me. Great job! |
i took #5646 as a base
I removed
MetaMatchers
and instead ranjest
on a specific file in a child process and compared the raw string output. It's not ideal, but much simpler than hacking into jasmine internals to compare the suites :)cc: @zpao @cpojer