practicalmeteor / meteor-mocha

Depreciated - Write meteor package tests with mocha and run them in the browser or from the command line with spacejam.
https://atmospherejs.com/practicalmeteor/mocha
Other
41 stars 13 forks source link

Updating to Meteor 1.4 tests fail #70

Closed 0o-de-lally closed 7 years ago

0o-de-lally commented 7 years ago

My project has 50 tests in 5 different files, all running successfully in meteor 1.3.5. After I updated to meteor 1.4.1, only one test is running, and it's failing ( the alphabetical first file in the directory). I'm getting a silent error without any logging:

I20160927-19:28:35.389(-4)? MochaRunner.runServerTests: Starting server side tests with run id esHcu5ZHiFwvKsLBk
W20160927-19:28:37.415(-4)? (STDERR) MochaRunner.runServerTests: failures: 1

I don't see anything in the docs that would indicate a change. Any ideas?

0o-de-lally commented 7 years ago

@jsep , have you had any issues with upgrading to 1.4.1? Thanks in advance for your help!

jsep commented 7 years ago

Hello @keyscores I didn't have any issues with the latest version of meteor, however it seems to be a exception with on test in the server but it's really hard to tell without any code.

Can you provide a repo that duplicate this?

0o-de-lally commented 7 years ago

Thanks @jsep for looking into this. I'll try to make a reproduction that I can share in public. What is unusual is that only one test runs, and nothing else runs.

0o-de-lally commented 7 years ago

@jsep Here's a repo that isolates the issue. Previously a beforeEach() was acceptable outside of a describe() block. I may have had bad code and not realized it. Anyhow, this kind of error should be verbose IMHO.

https://github.com/keyscores/debug-meteor-mocha

jsep commented 7 years ago

Thanks @keyscores for the repo, the problem specifically with the beforeEach() was that the callback was the done argument. You have this:

beforeEach( function(done)){

})

It should be like this:

beforeEach( function()){

})

You can you use any mocha hook such as beforeEach, afterEach outside of a describe block, but take in mind that those hooks are going attach to the root suite, so they are going to run in every suite of you tests.