meteor-mocha icon indicating copy to clipboard operation
meteor-mocha copied to clipboard

How can I run a specific test from the Meteor shell?

Open graemian opened this issue 5 years ago • 5 comments

During debugging, I find I often have to restart Meteor just to run a specific test again in order to follow along with it in the debugger.

I tried

var testDriverPackage = Package["meteortesting:mocha"] testDriverPackage.start()

which is what Meteor itself appears to do in

https://github.com/meteor/meteor/blob/24865b28a0689de8b4949fb69ea1f95da647cd7a/packages/meteor/test_environment.js

But I get this error on every test:

TypeError: Cannot read property 'call' of undefined

graemian avatar Jul 07 '19 16:07 graemian

I can't quite follow you ... what exactly are you trying to do? Is it about client-side or server-side tests - or maybe both? Where did you try the code you posted?

Do you e.g. have a repo which shows and let me reproduce what you're doing?

SimonSimCity avatar Jul 08 '19 08:07 SimonSimCity

I'm specifically interested in server-side tests. I ran that code in the Meteor shell, the error appears in the Meteor console (where test results are normally reported).

In order to figure out why a test is failing, I often connect with a debugger. I step through the code, but if want to restart the debugging from the beginning, I'm forced to make a code change or restart Meteor in order to get the test to run again.

graemian avatar Jul 08 '19 09:07 graemian

I just discovered the ".reload" command from the Meteor shell. This effectively reruns all the tests. It would be nice to be able to rerun just a specific test, but this is still very useful.

graemian avatar Jul 13 '19 12:07 graemian

Would be nice to hear if you get the opportunity and time to work on it. #76 might be very much related to this ...

SimonSimCity avatar Jul 22 '19 08:07 SimonSimCity

@graemian you can use it.only(etc) to run a single test

hexsprite avatar Dec 03 '19 06:12 hexsprite