-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Nuke should
#3035
#3042
Nuke should
#3035
#3042
Conversation
Changes Unknown when pulling 8fbefc0 on ngeor:nuke-should-3035 into ** on mochajs:master**. |
Changes Unknown when pulling 8fbefc0 on ngeor:nuke-should-3035 into ** on mochajs:master**. |
Changes Unknown when pulling 7d851c3 on ngeor:nuke-should-3035 into ** on mochajs:master**. |
awesome |
Haven't reviewed all the changes in depth, but want to say thank you for taking this on!! I just discovered that |
No problem at all, I was looking for something to help with and this one looked clear enough. By the way I'm more used to |
Removed should package from package.json. Removed should from mocha.opts. Fixed tests. Added myself to contributors. Fixed diff fixture to use eql so that the error message produced by expect matches the one that should used to produce.
Good morning @ScottFreeCode , you were correct, switching to I squashed my commits into one. Looking forward to your feedback :-) |
🎉
The expected vs. actual format isn't specific to If we don't already have unit tests that do so, we might be better off creating errors and assigning the expected and actual values to them ourselves and then throwing them or passing them into the
Will give it a look soon! And thanks again! |
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.
While there's a lot of code, it looks like it's almost entirely a straightforward switch!
There's a couple very minor things to follow up on, but no reason not to merge this that I can see.
test/reporters/json.spec.js
Outdated
expect(runner).to.have.property('testResults'); | ||
expect(runner.testResults).to.have.property('failures'); | ||
expect(runner.testResults.failures).to.be.an('array'); | ||
expect(runner.testResults.failures.length).to.equal(1); |
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.
Nit: whereas should
has .have.a.lengthOf
, the equivalent in expect
is .have.length
, which yields better error messages than equal
... Would merge this either way, but figure it's worth pointing out.
failure.should.have.properties('err'); | ||
expect(failure).to.have.property('title', testTitle); | ||
expect(failure.err.message).to.equal(error.message); | ||
expect(failure).to.have.property('err'); |
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.
Wow, weird that we've got this test that's asserting the existence of a property only after using said property such that it would get a null reference exception if it didn't exist.
Let's not fix it in this PR, just keep this to should->expect updates. But we may want to drop in a follow-up commit to fix it.
test/reporters/json.spec.js
Outdated
expect(runner).to.have.property('testResults'); | ||
expect(runner.testResults).to.have.property('pending'); | ||
expect(runner.testResults.pending).to.be.an('array'); | ||
expect(runner.testResults.pending.length).to.equal(1); |
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.
Another instance of the length
nit discussed above.
Removing should library and using expect instead (issue mochajs#3035). Removed should package from package.json. Removed should from mocha.opts. Fixed tests. Added myself to contributors. Fixed diff fixture to use eql so that the error message produced by expect matches the one that should used to produce.
Description of the Change
The
should
library has been removed. All tests that were using it are now using expectJS.Note that I also removed completely the diff integration test, because it was testing the output format provided by
should
.Benefits
One less package to worry about.
Applicable issues