Continue Discussion 44 replies
Mar '16

serutan

When running meteor test --full-app --driver=practicalmeteor:mocha, your client side DOM is inside a frame with 0px height.

That means that the jquery selector :visible is not usable anymore.

So this is not working anymore:

    chai.expect($('#foo:visible')[0]).to.not.be.undefined; // always undefined
1 reply
Mar '16 ▶ serutan

tmeasday

Yes, this is one downside of the approach of running the reporter in the same app as the “full application”. It was a tradeoff between doing this and the complexity of running multiple Meteor apps in test mode (as velocity did).

I’m hopeful that just doing existence (rather than visibility) based checks on the DOM will be enough—if you want to check visibility etc, perhaps an acceptance test using a external driver makes more sense?

Mar '16

awatson1978

Since Gagarin is a superset of Mocha and supports external drivers like chromedriver and phantoms, we should be able to get chai.expect($('#foo:visible')[0]).to.not.be.undefined; style syntax working by combining practicalmeteor:mocha and Gagarin.

We should log tickets with both projects about incorporating the other one.

Apr '16

thebarty

Has anyone else experienced that tests simply don’t show up in the testrunner, when hidden erros occur.

I am running my tests from within imports/modules/* and right now a lot of tests do not show up.
I am sure that I have an error somewhere in my code BUT I would still expect the testrunner to run all tests.

Anyone else having that issue?

I seperated my question into a seperate topic ``meteor test`` NOT running some tests and NOT throwing errors

Apr '16

thebarty

When in need to conditionally import via a require, p.e. in a test-file for a collection, you can do something like:

if (Meteor.isServer) {
  // deconstruct
  const { ObjectName1, functionName  } = require('/imports/usecase/server/...')
Apr '16

dnszero

When running Acceptance Tests using Chimp and Mocha (as described in the guide), how do you load a supporting js file?

For example, I have a user and login function defined in /tests/setup.js that I’d like to use in many of my Chimp test files.

The Chimp docs seem to support doing this with Jasmine, but not Mocha from what I can see.

Any tips on how to make it work?

Apr '16

rlivingston

While happily using the mocha / chai guidance above, I was using the official chai documentation for guidance on supported asserts. So, I wrote some code using isAtLeast. I was very surprised to eventually figure out that the version of chai in practicalmeteor:mocha hasn’t been updated since the middle of last year and doesn’t support isAtLeast.

So, in keeping with new meteor 1.3 guidance, I’m happy to report that simply running meteor npm install chai, adding import { assert } from 'chai'; in the test file and removing the import for practicalmeteor:chai solved my problem!

Hopefully, we’ll see many of these modules that are simple wrappers around well-maintained npm modules rapidly disappearing over the next few weeks!

1 reply
Apr '16

rlivingston

As testing and debug go hand-in-hand, perhaps the debug-port option to the meteor test command should be mentioned in this guide. Could be sleep deprivation, but it took me way too long to figure out that the server-side debugging I normally do using ‘meteor debug’ is available via the debug-port option when testing.

meteor test --debug-port 5858 --driver-package practicalmeteor:mocha

Apr '16

brucejo

Hello,

I attempted to install chimp per instructions: meteor npm install --global chimp. This install appears to fail for me because chimp has dependencies that require updated versions of node. Am I correct in assuming that chimp is not usable until this is resolved?

I have a 5.11 version of node on my machine and chimp can install in there. I have never used chimp before and I am not really clear on how it works. But I assume that it needs to be installed in the meteor version of node and I cannot use chimp installed in my version of node?

Related issues:

Environment:
Windows 10
Meteor v1.3.2.4


Error output:

npm WARN engine deep-extend@0.4.1: wanted: {"node":">=0.12.0","iojs":">=1.0.0"} (current: {"node":"0.10.43","npm":"2.14.22"})
npm WARN engine webdriverio@4.0.5: wanted: {"node":">= 0.12.0"} (current: {"node":"0.10.43","npm":"2.14.22"})
npm WARN optional dep failed, continuing fsevents@0.3.8
npm WARN engine is-buffer@1.1.3: wanted: {"node":">=0.12"} (current: {"node":"0.10.43","npm":"2.14.22"})
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs@2.0.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
\
\> fibers@1.0.10 install C:\Users\admin\AppData\Local\.meteor\packages\meteor-tool\1.3.2_4\mt-os.windows.x86_32\dev_bundle\bin\node_modules\chimp\node_modules\fibers
\> node build.js || nodejs build.js


C:\Users\admin\AppData\Local\.meteor\packages\meteor-tool\1.3.2_4\mt-os.windows.x86_32\dev_bundle\bin\node_modules\chimp\node_modules\fibers>if not defined npm_config_node_gyp (node "C:\Users\admin\AppData\Local\.meteor\packages\meteor-tool\1.3.2_4\mt-os.windows.x86_32\dev_bundle\lib\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )  else (node "" rebuild --release )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: ImportError: No module named site
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:658:15)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at maybeClose (child_process.js:766:16)
gyp ERR! stack     at Socket.<anonymous> (child_process.js:979:11)
gyp ERR! stack     at Socket.emit (events.js:95:17)
gyp ERR! stack     at Pipe.close (net.js:466:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "node" "C:\\Users\\admin\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.3.2_4\\mt-os.windows.x86_32\\dev_bundle\\lib\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\admin\AppData\Local\.meteor\packages\meteor-tool\1.3.2_4\mt-os.windows.x86_32\dev_bundle\bin\node_modules\chimp\node_modules\fibers
gyp ERR! node -v v0.10.43
gyp ERR! node-gyp -v v3.3.0
gyp ERR! not ok
Build failed
'nodejs' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Users\\admin\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.3.2_4\\mt-os.windows.x86_32\\dev_bundle\\bin\\\\node.exe" "C:\\Users\\admin\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.3.2_4\\mt-os.windows.x86_32\\dev_bundle\\lib\\node_modules\\npm\\bin\\npm-cli.js" "install" "--global" "chimp"
npm ERR! node v0.10.43
npm ERR! npm  v2.14.22
npm ERR! code ELIFECYCLE

npm ERR! fibers@1.0.10 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fibers@1.0.10 install script 'node build.js || nodejs build.js'.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node build.js || nodejs build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs fibers
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls fibers
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     e:\MERIS\npm-debug.log
1 reply
Apr '16

tmeasday

I don’t believe this is the case. I think you could happily install chimp with whatever version of node/npm.

2 replies