ember-cli-mocha
ember-cli-mocha copied to clipboard
Mocha@3: it.only does not work
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
I've never had issues with this. Out of curiosity, have you tried it without the only on your describe line?
Hey yeah I tried describe.only as well, with the same effect. For now the solution with grep is totally fine for me.
We will need a demo repo to track this down...
This has always worked for me. Here's an example
I have, however, noticed that you can't use .only along with grep= query param.
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.
@jasonmit do you have any clue why this popped up with Mocha 3?
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
Any news on this? Is this still blocking #167?
@phyrog yes, haven't found a good solution to this issue yet 😞
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?
@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 😞