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

Mocha@3: it.only does not work #73

Open
webpapaya opened this issue Aug 11, 2015 · 12 comments
Open

Mocha@3: it.only does not work #73

webpapaya opened this issue Aug 11, 2015 · 12 comments
Labels

Comments

@webpapaya
Copy link

Hey I'm trying to only run a single test with it.only like it's defined in here https://mochajs.org/#exclusive-tests, but both tests are running when i open up my test suite in the browser. Am I doing something wrong or is this feature not supported by ember-cli-mocha?

My test looks like:

describe('test it.only feature', function() {
  it('should not run', function() {
    expect(true).to.equal(true);
  });

  it.only('should run', function() {
    expect(true).to.equal(true);
  });
});

Update:
A workarround to this issue is to use the grep argument and paste in the test name. Like

http://localhost:7357/7159/tests/index.html?hidepassed&grep=should%20run

Thanks,
Thomas

@clekstro
Copy link
Contributor

I've never had issues with this. Out of curiosity, have you tried it without the only on your describe line?

@webpapaya
Copy link
Author

Hey yeah I tried describe.only as well, with the same effect. For now the solution with grep is totally fine for me.

@rwjblue
Copy link
Member

rwjblue commented Aug 12, 2015 via email

@blimmer
Copy link
Contributor

blimmer commented Aug 30, 2015

This has always worked for me. Here's an example

@blimmer
Copy link
Contributor

blimmer commented Jun 13, 2016

I have, however, noticed that you can't use .only along with grep= query param.

@jasonmit
Copy link
Contributor

jasonmit commented Aug 3, 2016

I'm also seeing this now, I just don't know yet at what point it surfaced.

Update: my issue surfaced because mocha implicitly upgraded to 3.0.0. This isn't an issue with ember-cli-mocha. Backing it back down to 2.x resolved the issue.

@Turbo87
Copy link
Member

Turbo87 commented Aug 14, 2016

@jasonmit do you have any clue why this popped up with Mocha 3?

@Turbo87
Copy link
Member

Turbo87 commented Aug 14, 2016

this is most likely related to https://github.com/teddyzeenny/ember-mocha-adapter/blob/master/adapter.js#L169-L172 and Mocha 3 having done some changes in the .only() handling

@Turbo87 Turbo87 added the bug label Nov 10, 2016
@Turbo87 Turbo87 changed the title it.only does not seem to work Mocha@3: it.only does not work Nov 10, 2016
@phyrog
Copy link

phyrog commented May 19, 2017

Any news on this? Is this still blocking #167?

@Turbo87
Copy link
Member

Turbo87 commented May 19, 2017

@phyrog yes, haven't found a good solution to this issue yet 😞

@rwjblue
Copy link
Member

rwjblue commented Jul 20, 2017

IMHO, we should drop the auto-run wrapping that we do inside it and begin requiring a return wait() at the end for the tests to properly wait. I believe this should unblock the Mocha 3 work.

@Turbo87 - Is that correct?

@Turbo87
Copy link
Member

Turbo87 commented Jul 25, 2017

@rwjblue in theory yes, but it would obviously be annoying for Mocha users that don't use async/await yet. I wanted to go back and see if there is really no way to us to hook in anywhere but I haven't found the time yet 😞

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

No branches or pull requests

7 participants