xolvio / qualityfaster

An example project showing how to create robust and maintainable acceptance tests
262 stars 58 forks source link

Error when running test script: cannot find module 'selenium-standalone' #18

Open andersr opened 8 years ago

andersr commented 8 years ago

Hi,

I cloned this repo and ran the test script locally. The main start script appears to run fine but when the test script runs, after all unit test pass, there is an error which appears to be related to a missing 'selenium-standalone' module. Please see the complete log below.

I attempted to manually install the selenium-standalone package but that had no impact.

⚡   npm run test

> @ test /Users/Anders/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices
> .scripts/test.js

11 02 2016 12:20:35.844:INFO [karma]: Karma v0.13.19 server started at http://localhost:9876/
11 02 2016 12:20:35.874:INFO [launcher]: Starting browser Chrome
11 02 2016 12:20:38.243:INFO [Chrome 48.0.2564 (Mac OS X 10.10.5)]: Connected on socket /#JARPs4O3-dFsIHhNAAAA with id 10328110
Chrome 48.0.2564 (Mac OS X 10.10.5): Executed 4 of 4 SUCCESS (0.205 secs / 0.182 secs)
stream error Network error: ws://localhost:3000/websocket: connect ECONNREFUSED
I20160211-12:21:19.883(-5)? [velocity] is in continuous integration mode
I20160211-12:21:20.978(-5)? [velocity] jasmine-server-integration is starting a mirror at http://localhost:64324/.
I20160211-12:21:20.983(-5)? [velocity] You can see the mirror logs at: tail -f /Users/Anders/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices/src/.meteor/local/log/jasmine-server-integration.log
PASSED jasmine-server-integration : initialization event:Account Holder => should create an account with a balance of 0
PASSED jasmine-server-integration : initialization event:Account Holder => should create an account with 0 number of checks
PASSED jasmine-server-integration : create:Account Service => creates and returns an AccountHolder backed by a Meteor user account
PASSED jasmine-server-integration : create:Account Service => does not store the password on the account holder object
PASSED jasmine-server-integration : create:Account Service => sets the branch on the account
PASSED jasmine-server-integration : transfer:Bank Service => transfers an amount from account A to the account B
PASSED jasmine-server-integration : transfer:Bank Service => returns an error when there are insufficient funds
PASSED jasmine-server-integration : transfer API:Bank Service => transfers an amount from account A to the account B
PASSED jasmine-server-integration : transfer API:Bank Service => returns an error when the owner is not logged in
PASSED jasmine-server-integration : issueChecks:Bank Service => increment the number of checks the account holder has
PASSED jasmine-server-integration : for the same bank:sameBankDepositCheck:Bank Service => should transfer the amount from account A to account B when the check is valid
PASSED jasmine-server-integration : for the same bank:sameBankDepositCheck:Bank Service => should decrease the number of checks when the check is valid
PASSED jasmine-server-integration : for the same bank:sameBankDepositCheck:Bank Service => should return an error message when account holder A does not have enough checks
PASSED jasmine-server-integration : for the same bank:sameBankDepositCheck:Bank Service => should return an error message when account holder A branch is different
PASSED jasmine-server-integration : for the same bank:sameBankDepositCheck:Bank Service => should return an error message when account holder B branch is different
TESTS RAN SUCCESSFULLY
[[[[[
~/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices/src
]]]]]

=> Started proxy.
=> Started MongoDB.
=> Started your app.

=> App running at: http://localhost:3000
module.js:341
    throw err;
    ^

Error: Cannot find module 'selenium-standalone'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/Anders/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices/node_modules/chimp/lib/selenium.js:3:22)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/Anders/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices/node_modules/chimp/lib/chimp.js:26:20)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
Chimp exited with code 1
Chimp exited with code 1

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/5.5.0/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v5.5.0
npm ERR! npm  v3.5.3
npm ERR! code ELIFECYCLE
npm ERR! @ test: `.scripts/test.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ test script '.scripts/test.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     .scripts/test.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs 
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls 
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Anders/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices/npm-debug.log

Npm debug log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/5.5.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'test' ]
2 info using npm@3.5.3
3 info using node@v5.5.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle @~pretest: @
6 silly lifecycle @~pretest: no script for pretest, continuing
7 info lifecycle @~test: @
8 verbose lifecycle @~test: unsafe-perm in lifecycle true
9 verbose lifecycle @~test: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/Anders/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices/node_modules/.bin:/Users/Anders/.rvm/gems/ruby-2.2.1/bin:/Users/Anders/.rvm/gems/ruby-2.2.1@global/bin:/Users/Anders/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/Users/Anders/Dropbox/dev/bash_scripts:/Applications/Postgres.app/Contents/Versions/9.4/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/Anders/.rvm/bin
10 verbose lifecycle @~test: CWD: /Users/Anders/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices
11 silly lifecycle @~test: Args: [ '-c', '.scripts/test.js' ]
12 silly lifecycle @~test: Returned: code: 1  signal: null
13 info lifecycle @~test: Failed to exec test script
14 verbose stack Error: @ test: `.scripts/test.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack     at emitTwo (events.js:100:13)
14 verbose stack     at EventEmitter.emit (events.js:185:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:100:13)
14 verbose stack     at ChildProcess.emit (events.js:185:7)
14 verbose stack     at maybeClose (internal/child_process.js:821:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid @
16 verbose cwd /Users/Anders/Dropbox/dev/learning/meteor/testing/xolvio/automated-testing-best-practices
17 error Darwin 14.5.0
18 error argv "/usr/local/Cellar/node/5.5.0/bin/node" "/usr/local/bin/npm" "run" "test"
19 error node v5.5.0
20 error npm  v3.5.3
21 error code ELIFECYCLE
22 error @ test: `.scripts/test.js`
22 error Exit status 1
23 error Failed at the @ test script '.scripts/test.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the  package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     .scripts/test.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
calebl commented 8 years ago

upgrading chimp to a version > 0.26.0 in your package.json file under devDependencies solved this problem for me. I think 0.28.1 is latest version of chimp now.

andersr commented 8 years ago

Upgrading to > 0.26.0 had no impact on my end. I also tried nuking and re-installing node/npm but that had no impact.

However, everything except CI runs as expected after disabling the following in /.scripts/test.js

function runChimp(callback) {
  startProcess({
    name: 'Chimp',
    // options: {
    //   env: extend({CI: 1}, process.env)
    // },
    command: chimpScript
  }, callback);
}

That's all the troubleshooting I have time for atm, but perhaps this will help further isolate the issue.

ghost commented 8 years ago

Could be that you have upgraded from Node.js 4 to 5? Then a reinstall of the dependencies should do it. On CI you can clear the cache. rm -rf node_modules && npm install.