-
-
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
allow skip() in async test context; closes #2334 #2335
Conversation
Also I'm not sure if my solution to this is smart, terrible, or some combination thereof. |
@mochajs/core Was hoping someone could look at this and another couple PRs I have open--would rather not merge my own code w/o having somebody look at it. |
related: #1618 Didn't think we supported it yet 😅 Edit: oops, looks like you pulled the specs from the other PR, nvm! |
@danielstjules I didn't even know there was another PR... |
Footprint is so minimal, integration tests offer pretty good coverage, LGTM :) 👍 |
code smell: #946 (comment) Lines 221 to 234 in 8a37e01
|
@dasilvacontin throwing a plain object to mark a test as pending isn't particularly aromatic, no. I didn't write it in the first place but did nothing to improve it. I'm also unsure if there's really a better way to abort a test. |
@dasilvacontin I'm not sure if you have issues w/ this PR or not. Can you confirm either way? |
@boneskull No, the PR works. It's just that maybe investigating the code smell would yield a different fix / solution. I'm okay with merging this and then iterating once someone investigates the code smell. |
Hi, I'm using the most up to date mocha version: 3.7.3 and the async skip isn't working. Can anyone else confirm this?:
|
Double-check which version of Mocha you're using; the latest is 3.1.0 and that code should work on it. (Also, a GitHub/Markdown tip: use ``` instead of ` for multi-line blocks of code.) |
Thanks! I changed my package.json value for mocha version to 3.1.0, reinstalled, but I'm still getting "3.7.3" when I do "npm -v mocha". Why would this be? Now when I try to run the above "Should skip async" test I get the following error: UPDATE: My bad. Just did "npm list mocha" and confirmed that I am on 3.1.0, but still getting below error.
|
|
I tried both (this.test and this). Both give the same error: |
(Heh, yeah, Interestingly, I tried the
|
Thank you! Yes, that was the exact problem. I thought I was on 3.1.0 but actually I was using the globally installed version which was 2.4.3. I ran the test with node_modules/.bin/mocha and it worked great. |
I can't tell if this is an actual bug fix, regression, or what (because where are the tests for async
skip()
calls?), but it allows this test:To be successfully marked as "pending".
cc @dasilvacontin @maggiesavovska