I'm trying to use this to run mocha unit tests in one of our packages. Instead of adding the dispatch:mocha-phantomjs package to the application, I've added an api.use(''dispatch:mocha-phantomjs') call in the package.js onTest() method of the package we're testing.
Then I invoke the tests like this:
meteor test-packages --once --driver-package=dispatch:mocha-phantomjs my:packagename
Should this work?
I am finding that some of my later tests work but the early ones fail as shown below.
I also noticed that if I have an api.use('practicalmeteor:mocha') in the same package.js onTest method then all the tests pass and I don't see these errors. So I am puzzled about whats going on here.
Here's the failing output (the project is at Meteor 1.4.1.2)
`[[[[[ Tests ]]]]]
=> Started proxy.
=> Started MongoDB.
=> A patch (Meteor 1.4.1.3) for your current release is available!
Update this project now with 'meteor update --patch'.
WARNING: The $display argument will be deprecated in future versions in favor of the display(){...} mixin.
Backtrace:
neat/settings/disable-warnings:11, in mixin -neat-warn
neat/grid/row:39, in mixin row
system/styles/_files.scss:30
WARNING: Resetting $display will be deprecated in future versions in favor of the display(){...} mixin.
Backtrace:
neat/settings/disable-warnings:11, in mixin -neat-warn
neat/grid/to-deprecate:64, in mixin reset-display
system/styles/_files.scss:33
W20161116-00:11:59.860(-6)? (STDERR) Debugger listening on port 47977
I20161116-00:12:01.664(-6)?
I20161116-00:12:01.664(-6)? --------------------------------
I20161116-00:12:01.665(-6)? ----- RUNNING SERVER TESTS -----
I20161116-00:12:01.665(-6)? --------------------------------
I20161116-00:12:01.665(-6)?
I20161116-00:12:01.666(-6)?
I20161116-00:12:01.666(-6)?
I20161116-00:12:01.666(-6)? 0 passing (1ms)
I20161116-00:12:01.666(-6)?
I20161116-00:12:01.666(-6)?
I20161116-00:12:01.666(-6)? --------------------------------
I20161116-00:12:01.667(-6)? ----- RUNNING CLIENT TESTS -----
I20161116-00:12:01.667(-6)? --------------------------------
I20161116-00:12:01.667(-6)?
=> Started your app.
=> App running at: http://localhost:3000/
I20161116-00:12:03.375(-6)? TypeError: undefined is not a constructor (evaluating 'sinon.stub()')
I20161116-00:12:03.376(-6)?
I20161116-00:12:03.376(-6)? phantomjs://code/phantomjsScript.js:15 in onError
I20161116-00:12:03.377(-6)? http://localhost:3000/packages/local-test_digi_urma-tlr.js?hash=983bd10c7d3c6c9fb3a67c2dab4faeeb90d88d7d: 3007
I20161116-00:12:03.377(-6)?
I20161116-00:12:03.377(-6)? phantomjs://code/phantomjsScript.js:17
I20161116-00:12:03.377(-6)? http://localhost:3000/packages/practicalmeteor_mocha-core.js?hash=7a234b5be14498eda862b0dcfc7a4702d75e1280: 599
I20161116-00:12:03.377(-6)?
I20161116-00:12:03.377(-6)? phantomjs://code/phantomjsScript.js:17
I20161116-00:12:03.378(-6)? http://localhost:3000/packages/local-test_digi_urma-tlr.js?hash=983bd10c7d3c6c9fb3a67c2dab4faeeb90d88d7d: 3006
I20161116-00:12:03.378(-6)?
I20161116-00:12:03.378(-6)? phantomjs://code/phantomjsScript.js:17
I20161116-00:12:03.378(-6)? http://localhost:3000/packages/modules-runtime.js?hash=ab7e8d32b6c7b5a5fa7ae1b65e8225c4f9e30223: 191
I20161116-00:12:03.378(-6)?
...
I20161116-00:12:03.383(-6)? phantomjs://code/phantomjsScript.js:17
I20161116-00:12:03.399(-6)? 1..12
I20161116-00:12:03.478(-6)? ok 1 Cellular Config (Wizard) tests should render cellular config fields
I20161116-00:12:03.530(-6)? ok 2 Cellular Config (Wizard) tests should change provider,APN values based on country and provider
I20161116-00:12:03.588(-6)? ok 3 Cellular Config (Wizard) tests show custom APN when country or provider is other and also when apn value is custom else hide it
I20161116-00:12:03.621(-6)? ok 4 Cellular Config (Wizard) tests when provider is verizon, apn should have value null and custom and also no advanced options available
I20161116-00:12:03.669(-6)? ok 5 Cellular Config (Wizard) tests show/hide username, password when advanced is clicked
I20161116-00:12:03.686(-6)? ok 6 Cellular Connection Polling(Wizard) tests should render cellular results components
I20161116-00:12:03.687(-6)? ok 7 Cellular Connection Polling(Wizard) tests when cellular state has some values missing should display empty for those
I20161116-00:12:03.691(-6)? ok 8 Cellular Retry Dialog (Wizard) tests should render cellular retry dialog components
I20161116-00:12:03.695(-6)? ok 9 Cellular Retry Dialog (Wizard) tests should render timeout message/Retry when timed out
I20161116-00:12:03.701(-6)? ok 10 Cellular Retry Dialog (Wizard) tests should call onClose function when cancel button is clicked
I20161116-00:12:03.712(-6)? ok 11 Cellular Retry Dialog (Wizard) tests should reset timers when retry button is clicked
I20161116-00:12:03.714(-6)? ok 12 Cellular Retry Dialog (Wizard) tests if cellular connection is made/ if there is a ip_address onsucess func should be called
I20161116-00:12:03.714(-6)? # tests 12
I20161116-00:12:03.714(-6)? # pass 12
I20161116-00:12:03.715(-6)? # fail 0
I20161116-00:12:06.072(-6)? All client and server tests finished!
I20161116-00:12:06.072(-6)?
I20161116-00:12:06.073(-6)? --------------------------------
I20161116-00:12:06.073(-6)? SERVER FAILURES: 0
I20161116-00:12:06.073(-6)? CLIENT FAILURES: 0
I20161116-00:12:06.074(-6)? --------------------------------
`