Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Mocha overrides #1033

Open
adelespinasse opened this issue Feb 14, 2017 · 4 comments
Open

Mocha overrides #1033

adelespinasse opened this issue Feb 14, 2017 · 4 comments

Comments

@adelespinasse
Copy link

The overrides file for Mocha includes

    "diff": "@empty",

which I think is probably why it behaves strangely when a test fails:

err  TypeError: diff.createPatch is not a function
    at unifiedDiff (file:///C:/Users/aldel/agora/playdoh/public/jspm_packages/npm/[email protected]/lib/reporters/base.js:417:18)
    at file:///C:/Users/aldel/agora/playdoh/public/jspm_packages/npm/[email protected]/lib/reporters/base.js:218:16
...

Mocha is trying to use diff to format its output for the failure (I assume), but diff is empty because of the override. Is this override needed for something?

@adelespinasse
Copy link
Author

I got it to behave correctly by removing the override (directly editing the override in my package.json) and installing diff with jspm install --dev npm:diff. No idea why that override exists.

I don't have enough confidence about jspm configuration to submit a pull request.

@aluanhaddad
Copy link
Collaborator

aluanhaddad commented Feb 14, 2017

See also #1022.

@adelespinasse
Copy link
Author

Oh, I later noticed that this is a problem with the exceptions thrown by Chai, but not by Unexpected, and not if the test simply does something like throw new Error('error'). Possibly this is why @guybedford didn't notice the issue when writing the Mocha overrides and/or this article. I guess Mocha has special handling for Chai's exceptions.

@aluanhaddad
Copy link
Collaborator

Honestly I know little about test frameworks such as mocha, chai, and sinon. Instead I use tape + jspm run test/index whenever I can because I like for to test frameworks to be simple and I dislike when they encourage mutating steps.

Thanks for linking that article here, it is indeed a great read and was a pleasure to read again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants