Hey
I’m trying to run some mocha tests on the command line with the dispatch:mocha-phantomjs
package. It’s not working however with the following errors:
- When I run
meteor test --once --driver-package dispatch:mocha-phantomjs
no tests are run and meteor exits after starting:
PS E:\meteor-projects\simple-todos-react> meteor test --once --driver-package dispatch:mocha-phantomjs
[[[[[ Tests ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/
Type Control-C twice to stop.
PS E:\meteor-projects\simple-todos-react>
- If I try to keep it running without the
--once
flag I get the following error:
W20160509-11:05:19.577(1)? (STDERR) TypeError: Cannot call method 'push' of undefined
W20160509-11:05:19.577(1)? (STDERR) at meteorInstall.node_modules.meteor.dispatch:mocha-core.node_modules.mocha.lib.mocha.js (node_modules/meteor/dispatch:mocha-core/node_modules/mocha/lib/mocha.js:28:1)
W20160509-11:05:19.577(1)? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:141:1)
W20160509-11:05:19.577(1)? (STDERR) at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:75:1)
W20160509-11:05:19.577(1)? (STDERR) at meteorInstall.node_modules.meteor.dispatch:mocha-core.node_modules.mocha.index.js (node_modules/meteor/dispatch:mocha-core/node_modules/mocha/index.js:3:1)
W20160509-11:05:19.577(1)? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:141:1)
W20160509-11:05:19.577(1)? (STDERR) at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:75:1)
W20160509-11:05:19.577(1)? (STDERR) at meteorInstall.node_modules.meteor.dispatch:mocha-core.server.js (packages/dispatch:mocha-core/server.js:1:1)
W20160509-11:05:19.577(1)? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:141:1)
W20160509-11:05:19.577(1)? (STDERR) at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:75:1)
W20160509-11:05:19.577(1)? (STDERR) at node_modules/meteor/dispatch:mocha-core/node_modules/mocha/node_modules/growl/lib/growl.js:234:1
Not sure why it’s failing. I’m just following the Meteor guide on testing. I did find out that the other driver practicalmeteor:mocha
has conflicts with dispatch:mocha-phantomjs
when they are both installed so I removed the former but no luck it seems . BTW I’m on windows if that makes a difference.
Any ideas? Cheers in advance.
I’ve just tried this on a linux box and it actually worked. My main machine is windows so I imagine this is the problem sadly. Is there a way to perhaps get more detailed logging?
In the meantime I have raised a bug against the package. Will update it with this info.
I have it working on my boilerplate you want to see if it occurs there? Use the angular
branch since it has more elaborate tests. Part of my build is to remove the practicalmeteor:mocha
package and add dispatch:mocha-phantomjs
until their integration issues get resolved (or when @Sanjo fixes https://github.com/xolvio/meteor-jasmine/issues/335 meteor-jasmine to work in CI environments)
Thanks @trajano. So there is where we get to have fun
It does indeed work (mostly) when practicalmeteor:mocha
is installed suggesting there’s a further dependency. However when this package is present there’s a conflict issue causing an error during runtime:
PS E:\meteor-projects\meteor-boilerplate> meteor test --once --driver-package dispatch:mocha-phantomjs
[[[[[ Tests ]]]]]
=> Started proxy.
=> Started MongoDB.
I20160509-14:38:52.531(1)? ** You've set up some data subscriptions with Meteor.publish(), but
I20160509-14:38:52.531(1)? ** you still have autopublish turned on. Because autopublish is still
I20160509-14:38:52.532(1)? ** on, your Meteor.publish() calls won't have much effect. All data
I20160509-14:38:52.532(1)? ** will still be sent to all clients.
I20160509-14:38:52.532(1)? **
I20160509-14:38:52.532(1)? ** Turn off autopublish by removing the autopublish package:
I20160509-14:38:52.532(1)? **
I20160509-14:38:52.532(1)? ** $ meteor remove autopublish
I20160509-14:38:52.533(1)? **
I20160509-14:38:52.533(1)? ** .. and make sure you have Meteor.publish() and Meteor.subscribe() calls
I20160509-14:38:52.533(1)? ** for each collection that you want clients to see.
I20160509-14:38:52.533(1)?
I20160509-14:38:53.529(1)?
I20160509-14:38:53.530(1)? --------------------------------
I20160509-14:38:53.536(1)? ----- RUNNING SERVER TESTS -----
I20160509-14:38:53.536(1)? --------------------------------
I20160509-14:38:53.536(1)?
I20160509-14:38:53.538(1)?
I20160509-14:38:53.538(1)?
I20160509-14:38:53.538(1)?
I20160509-14:38:53.538(1)? 1) Uncaught error outside test suite
I20160509-14:38:53.539(1)? sanity test on both
I20160509-14:38:53.540(1)?
I20160509-14:38:53.540(1)? √ can test something
I20160509-14:38:53.541(1)?
I20160509-14:38:53.541(1)? sanity test only on server
I20160509-14:38:53.541(1)?
I20160509-14:38:53.541(1)? √ can test something
I20160509-14:38:53.541(1)?
I20160509-14:38:53.541(1)?
I20160509-14:38:53.541(1)? 2 passing (40ms)
I20160509-14:38:53.541(1)? 1 failing
I20160509-14:38:53.542(1)?
I20160509-14:38:53.542(1)? 1) Uncaught error outside test suite:
I20160509-14:38:53.542(1)? Uncaught TypeError: Object [object Object] has no method 'execFile'
I20160509-14:38:53.542(1)? at startPhantom (packages/dispatch:phantomjs-tests/server.js:20:37)
I20160509-14:38:53.542(1)? at Object.start (packages/dispatch:mocha-phantomjs/server.js:81:3)
I20160509-14:38:53.542(1)? at nextSlot (packages/meteor/test_environment.js:34:1)
I20160509-14:38:53.543(1)? at C:\Users\user\AppData\Local\Temp\meteor-test-runsnmufg\.meteor\local\build\programs\server\boot.js:290:5
I20160509-14:38:53.543(1)?
I20160509-14:38:53.543(1)?
I20160509-14:38:53.543(1)?
I20160509-14:38:53.543(1)?
I20160509-14:38:53.543(1)? --------------------------------
I20160509-14:38:53.544(1)? ----- RUNNING CLIENT TESTS -----
I20160509-14:38:53.544(1)? --------------------------------
I20160509-14:38:53.544(1)?
This issue was raised here - https://github.com/DispatchMe/meteor-mocha-phantomjs/issues/7
When I removed the practicalmeteor:mocha
from your boilerplate the same original issue occurs on my windows machine where nothing is posted and nothing is run.
Fun one!
Oh ya I remember that issue. Don’t run dispatch:phantomjs
on Windows I I openned https://github.com/DispatchMe/meteor-phantomjs-tests/issues/1 regarding that myself. I did put a PR https://github.com/DispatchMe/meteor-phantomjs-tests/pull/2 regarding the issue and waiting on @aldeed to review If you want to do it manually go to your AppData\local\.meteor\...
and change the file specified by the issue. I don’t have it at the moment since I cleared off my meteor installation and I don’t use CI locally at the moment.
Ahh nice one. So it’s an issue with the phantomjs package! Obvious now I look at it again.
Just to confirm is it this file? AppData\Local\.meteor\packages\dispatch_phantomjs-tests\0.0.4\os.windows.x86_32\server.js
?
I guess there are two issues here. The one above due to Windows and the other that the test doesn’t even run without the practicalmeteor:mocha
package installed (again on Windows)
However on linux it runs fine without the practicalmeteor:mocha
package… So confusing
Practical meteor mocha will have issues with phantom js dispatch regardless whether it is windows or Linux. So make sure only one is installed.
Also there is a PR regarding not using practical meteor for the chai and sinon for the guide I have created but I have not committed any time to fix the todo sample app. Though my boilerplate already does not use any practical meteor specific
Has been merged woo hoo, eliminates the platform problem, unfortunately when I did my test I got another error that is resolved by the following PR
Haha. Yeah I saw the merge today. Will now wait on the other PR
With the new version though I still don’t seem to be having much luck. It still doesn’t run any tests with only dispatch driver installed:
PS E:\app> meteor add dispatch:mocha-phantomjs
Changes to your project package version selections:
dispatch:mocha-core added, version 0.0.1
dispatch:mocha-phantomjs added, version 0.1.1
dispatch:phantomjs-tests added, version 0.0.5
practicalmeteor:mocha-core added, version 0.1.4
dispatch:mocha-phantomjs: Run package or app tests with Mocha+PhantomJS and report all results in the server console
PS E:\app> meteor test --once --driver-package dispatch:mocha-phantomjs
[[[[[ Tests ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/
Type Control-C twice to stop.
PS E:\app>
Actually I just got it working by uninstalling both drivers and specifically installing practicalmeteor:mocha
and then dispatch:mocha-phantomjs
in that specific order.
Currently dispatch tests will run but practical tests won’t. The page is just empty and the tests get ignored. I think this is already known though.
Odd I am using practicalmeteor:mocha
on Windows with no issues (though the dispatch:mocha-phantomjs
must not be installed) You can try it it from https://github.com/trajano/meteor-boilerplate just run meteor npm test
and access http://localhost:3100/ for a more elaborate test use the angular branch