Giter VIP home page Giter VIP logo

spacejam's Introduction

This project is no longer maintained

Due to leaving the meteor community, this project and all of it's related projects are no longer maintained by it's owners and contributors and has been taken out of meteor's official guide.

Overview

An npm package to run your meteor package tinytests and mocha tests from the command line with phantomjs. Can be used in continuous integration environments, such as Travis CI.

Quickstart

Installation

npm install -g spacejam

Running

spacejam works the same as meteor tests commands i.e.:

For apps:

# For apps
spacejam test --driver-package my:driver-package
# For packages
spacejam test-packages <package>


Running package tinytests

Assuming you use tinytest for your package tests:

# Inside a meteor package folder
spacejam test-packages ./
# Inside a meteor app folder
spacejam test-packages myaccount:mypkg1 myaccount:mypkg2

Running package mocha tests

Assuming you use practicalmeteor:mocha for your package tests:

# Inside a meteor package folder
spacejam test-packages --driver-package=practicalmeteor:mocha-console-runner ./
# Inside a meteor app folder
spacejam test-packages --driver-package=practicalmeteor:mocha-console-runner myaccount:mypkg1 myaccount:mypkg2

Alternatively, just use the spacejam-mocha wrapper script to avoid specifying the driver-package on the command line:

spacejam-mocha ./
spacejam-mocha myaccount:mypkg1 myaccount:mypkg2

Table of Contents

Installation

For current user:

npm install -g spacejam

For all users:

# The -H is required
sudo -H npm install -g spacejam

This will automatically add spacejam, mrun and mtp to your path.

spacejam test-packages

spacejam test-packages [options] [package...]

package... can be a list of packages with tinytests or mocha tests.

If not specified, will call meteor test-packages without arguments which will result in meteor testing all of the following packages:

  1. All of your app's packages, if run from within a meteor app folder.

  2. All of the packages meteor will find in all the folders specified in the PACKAGE_DIRS environment variable.

spacejam test-packages also sets process.env.METEOR_TEST_PACKAGES to '1', so packages can know they are running in the context of meteor test-packages. Not really a good practice, but sometimes just unavoidable.

The following options are specific to spacejam:

--loglevel <level>

spacejam log level. One of trace|debug|info|warn|error. Defaults to info.

--root-url <url>

The meteor ROOT_URL. Defaults to http://localhost:--port/, and not ROOT_URL, to avoid conflicts with your meteor app ROOT_URL.

--mongo-url <url>

The meteor MONGO_URL. Defaults to none, and not MONGO_URL, to avoid conflicts with your meteor app MONGO_URL.

--phantomjs-options "<options...>"

The command line options to pass to phantomjs. The default is --load-images=no --ssl-protocol=TLSv1.

--xunit-out <file>

If specified, saves results as xunit output to file.

--timeout <milliseconds>

Total timeout for all tests. Defaults to no timeout.

The following options are meteor options and are passed through to meteor (all are optional):

--driver-package=<driver-package>

For running your practicalmeteor:mocha tests, use practicalmeteor:mocha-console-runner

--port <port>

The meteor port. Defaults to 4096, and not PORT, to avoid conflicts with your meteor app PORT.

--settings <file>

Path to a meteor settings file.

--production

Simulate meteor production mode. Minify and bundle CSS and JS files.

--release <version>

Specify the release of Meteor to use.

--use-system-phantomjs

Use the installed version of PhantomJS instead of the one from the PhantomJS NPM package

To get help, just:

spacejam help

Running your package tests standalone

to run your package tests without a meteor app, from within your package folder, run:

spacejam test-packages ./
OR
spacejam-mocha test-packages ./
```

### Exit codes

```spacejam``` will return the following exit codes:

* ```0``` All the tests have passed in all packages.
* ```1``` ```spacejam``` usage or internal error.
* ```2``` At least one test has failed.
* ```3``` The meteor app has errors.
* ```4``` The tests have timed out.
* ```6``` An uncaught error happened client side before or during tests.

## spacejam package-version

Prints the package version in the current working directory's package.js

## spacejam-mocha wrapper script

A wrapper script so you don't have to specify --driver-package=practicalmeteor:mocha-console-runner on the command line every time, i.e.:

```
spacejam-mocha --production ./
```

## meteor-mocha wrapper script

A wrapper script so you don't have to specify --driver-package=practicalmeteor:mocha on the command line every time, i.e.:

```
meteor-mocha --port 4000 pkg1 pkg2
```

## mrun (meteor run)

Runs `meteor run` with the provided options. Supports the following additional environment variables:

### METEOR_APP_HOME

If set, will cd $METEOR_APP_HOME && meteor run, so you can run your app from any folder, without leaving that folder.

### METEOR_SETTINGS_PATH

If set, runs meteor with --settings $METEOR_SETTINGS_PATH

## mtp (meteor test-packages)

Runs `meteor test-packages` with the provided options on port 3100 and with MONGO_URL unset so you can run your app and your package tests in parallel, without port or mongodb conflicts, if you use an external mongodb for your app.

It also always sets METEOR_TEST_PACKAGES to '1', so packages can know they run in the context of meteor test-packages. Not really a good practice, but sometimes just unavoidable.

Supports the following additional environment variables:

### TEST_PORT

Runs meteor with --port $TEST_PORT and sets PORT to TEST_PORT. Defaults to 3100.

### TEST_ROOT_URL

If set, sets ROOT_URL to TEST_ROOT_URL. If not set, sets ROOT_URL to http://localhost:$TEST_PORT/

### TEST_MONGO_URL

If set, sets MONGO_URL to TEST_MONGO_URL. If not set, unsets MONGO_URL.

### TEST_METEOR_SETTINGS_PATH

If set, runs meteor with --settings $TEST_METEOR_SETTINGS_PATH. Useful if you use different settings for your app and your package tests.

### METEOR_SETTINGS_PATH

If set, runs meteor with --settings $METEOR_SETTINGS_PATH. Useful if you use the same settings for your app and your package tests.

## Changelog

See [CHANGELOG.md](CHANGELOG.md)

## Contributing

Contributions are more than welcome. Just create pull requests and make sure to include proper test coverage. We use mocha.js for tests and run our tests using CoffeScript's cake, so `npm test` will run `cake test`.

Note that we plan to include support for running tests in any browser and in sauce from the command line so if you plan to add this, check with us if we already started working on it.

## License

[MIT](LICENSE.txt)

spacejam's People

Contributors

benweissmann avatar meonkeys avatar ranfis-spacejam avatar rbabayoff avatar settinghead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spacejam's Issues

Any idea why this build fails with "Unhandled 'error' event"?

https://travis-ci.org/Wylio/meteor-mandrill/builds/71746610

$ node_modules/.bin/spacejam --mongo-url mongodb:// test-packages ./
spacejam: spawning meteor
spacejam: killing meteor
events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1011:11)
    at Process.ChildProcess._handle.onexit (child_process.js:802:34)
The command "node_modules/.bin/spacejam --mongo-url mongodb:// test-packages ./" exited with 8.

Support OS X

Hey there, I've been trying to get SpaceJam running so I can use it for automated package testing and have encountered this error:

Matts-MBP:matthew:foundation5-sass matthew$ spacejam test-packages ./
Spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
I20141017-08:15:42.229(-4)? test-in-console listening
=> Started your app.

=> App running at: http://localhost:4096/
Couldn't find any mongod child:
 { [Error: Command failed: ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
] killed: false, code: 1, signal: null }
spacejam: meteor is ready

/usr/local/lib/node_modules/spacejam/src/MeteorMongodb.coffee:30
      return this.mongodChilds.length > 0;
                              ^
TypeError: Cannot read property 'length' of undefined
  at MeteorMongodb.hasMongodb (/usr/local/lib/node_modules/spacejam/src/MeteorMongodb.coffee:20:18)
  at Meteor.hasMongodb (/usr/local/lib/node_modules/spacejam/src/Meteor.coffee:202:27)
  at Meteor.<anonymous> (/usr/local/lib/node_modules/spacejam/src/SpaceJam.coffee:71:63)
  at Meteor.EventEmitter.emit (events.js:92:17)
  at /usr/local/lib/node_modules/spacejam/src/Meteor.coffee:196:10
  at /usr/local/lib/node_modules/spacejam/src/MeteorMongodb.coffee:34:9
  at /usr/local/lib/node_modules/spacejam/node_modules/ps-node/lib/index.js:120:20
  at /usr/local/lib/node_modules/spacejam/node_modules/ps-node/lib/index.js:72:24
  at ChildProcess.exithandler (child_process.js:651:7)
  at ChildProcess.EventEmitter.emit (events.js:98:17)
  at maybeClose (child_process.js:753:16)
  at Socket.<anonymous> (child_process.js:966:11)
  at Socket.EventEmitter.emit (events.js:95:17)
  at Pipe.close (net.js:465:12)

Just for good measure, I checked spacejam out locally and ran the tests, of which, number failed:

Matts-MBP:spacejam matthew$ npm test

> [email protected] test /Users/matthew/src/spacejam
> cake test

ChildProcess.exec() { '0': 'mocha --colors --compilers coffee:coffee-script --reporter spec tests/*Test.coffee',
  '1': 'mocha' }
mocha pid: 68726
/Users/matthew/src/spacejam/bin/spacejam


  Meteor.coffee
    ✓ exec() 
    ✓ getDefaultRootUrl() 
Spawning meteor
    ✓ testPackages() - should spawn meteor with no package arguments 
Spawning meteor
    ✓ testPackages() - should spawn meteor with a package name argument 
Spawning meteor
    ✓ testPackages() - should spawn meteor with a --settings argument 
Spawning meteor
    ✓ testPackages() - should spawn meteor with a --production argument 
Spawning meteor
    ✓ testPackages() - should spawn meteor with a --release argument 
Spawning meteor
    ✓ testPackages() - should spawn meteor with ROOT_URL set to --root-url 
Spawning meteor
    ✓ testPackages() - should spawn meteor with MONGO_URL set to --mongo-url 
Spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Meteor 0.9.4 is available. Update this project with 'meteor update'.
=> Started MongoDB.     
I20141017-08:18:00.448(-4)? test-in-console listening
=> Started your app.

=> App running at: http://localhost:4096/
Couldn't find any mongod child:
 { [Error: Command failed: ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
] killed: false, code: 1, signal: null }
    1) kill() - should kill internal mongodb child processes

  spacejam test-packages
Spawning meteor
Can't listen on port 4096. Perhaps another Meteor is running?

Running two copies of Meteor in the same application directory
will not work. If something else is using port 4096, you can
specify an alternative port with --port <port>.
meteor exited with code: 254
/Users/matthew/src/spacejam/bin/spacejam exited with code: 3
    2) should exit with 0 if tests pass for a meteor app package
Killing  /Users/matthew/src/spacejam/bin/spacejam
Spawning meteor
Can't listen on port 4096. Perhaps another Meteor is running?

Running two copies of Meteor in the same application directory
will not work. If something else is using port 4096, you can
specify an alternative port with --port <port>.
meteor exited with code: 254
/Users/matthew/src/spacejam/bin/spacejam exited with code: 3
    3) should exit with 0 if tests pass for a standalone package
Killing  /Users/matthew/src/spacejam/bin/spacejam
Spawning meteor
Error: spacejam needs to be run from within a meteor app or package folder.
  at Meteor.testPackages (/Users/matthew/src/spacejam/src/Meteor.coffee:78:17)
  at Meteor.testPackages (/Users/matthew/src/spacejam/src/Meteor.coffee:1:1)
  at Object.testPackages [as test-packages] (/Users/matthew/src/spacejam/src/SpaceJam.coffee:84:21)
  at Function.SpaceJam.exec (/Users/matthew/src/spacejam/src/SpaceJam.coffee:42:7)
  at Object.<anonymous> (/Users/matthew/src/spacejam/bin/spacejam:4:30)
  at Object.<anonymous> (/Users/matthew/src/spacejam/bin/spacejam:6:4)
  at Module._compile (module.js:456:26)

/Users/matthew/src/spacejam/bin/spacejam exited with code: 1
    ✓ should exit with 1, if not in a meteor app or package folder (380ms)
Killing  /Users/matthew/src/spacejam/bin/spacejam
Spawning meteor
|
putative package directory /Users/matthew/src/spacejam/tests/leaderboard/packages/standalone-package doesn't exist?meteor exited with code: 1
/Users/matthew/src/spacejam/bin/spacejam exited with code: 3
    ✓ should exit with 3, if package could not be found (2294ms)
Killing  /Users/matthew/src/spacejam/bin/spacejam
Spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Meteor 0.9.4 is available. Update this project with 'meteor update'.
=> Started MongoDB.     
I20141017-08:18:22.088(-4)? test-in-console listening
=> Started your app.

=> App running at: http://localhost:6096/
Couldn't find any mongod child:
 { [Error: Command failed: ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
] killed: false, code: 1, signal: null }
spacejam: meteor is ready

/Users/matthew/src/spacejam/src/MeteorMongodb.coffee:30
      return this.mongodChilds.length > 0;
                              ^
TypeError: Cannot read property 'length' of undefined
  at MeteorMongodb.hasMongodb (/Users/matthew/src/spacejam/src/MeteorMongodb.coffee:20:18)
  at Meteor.hasMongodb (/Users/matthew/src/spacejam/src/Meteor.coffee:202:27)
  at Meteor.<anonymous> (/Users/matthew/src/spacejam/src/SpaceJam.coffee:71:63)
  at Meteor.EventEmitter.emit (events.js:92:17)
  at /Users/matthew/src/spacejam/src/Meteor.coffee:196:10
  at /Users/matthew/src/spacejam/src/MeteorMongodb.coffee:34:9
  at /Users/matthew/src/spacejam/node_modules/ps-node/lib/index.js:120:20
  at /Users/matthew/src/spacejam/node_modules/ps-node/lib/index.js:72:24
  at ChildProcess.exithandler (child_process.js:651:7)
  at ChildProcess.EventEmitter.emit (events.js:98:17)
  at maybeClose (child_process.js:753:16)
  at Process.ChildProcess._handle.onexit (child_process.js:820:5)

/Users/matthew/src/spacejam/bin/spacejam exited with code: 8
    4) should exit with 2, if tests failed
Killing  /Users/matthew/src/spacejam/bin/spacejam
Spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Meteor 0.9.4 is available. Update this project with 'meteor update'.
=> Started MongoDB.     
Tests timed out after 10000 milliseconds.
Killing  meteor
/Users/matthew/src/spacejam/bin/spacejam exited with code: 4
    ✓ should exit with 4, if --timeout has passed (10311ms)
Killing  /Users/matthew/src/spacejam/bin/spacejam
Spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Meteor 0.9.4 is available. Update this project with 'meteor update'.
=> Started MongoDB.     
W20141017-08:18:44.687(-4)? (STDERR) 
W20141017-08:18:44.741(-4)? (STDERR) /Users/matthew/.meteor/packages/meteor-tool/.1.0.31.1y1vh87++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141017-08:18:44.741(-4)? (STDERR)                        throw(ex);
W20141017-08:18:44.742(-4)? (STDERR)                              ^
W20141017-08:18:44.742(-4)? (STDERR) ReferenceError: FAIL is not defined
W20141017-08:18:44.742(-4)? (STDERR)     at Package (packages/local-test:appfails/appfails-test.coffee:1)
W20141017-08:18:44.742(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/packages/local-test_appfails.js:25:4
W20141017-08:18:44.742(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/packages/local-test_appfails.js:32:3
W20141017-08:18:44.742(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/boot.js:161:10
W20141017-08:18:44.743(-4)? (STDERR)     at Array.forEach (native)
W20141017-08:18:44.743(-4)? (STDERR)     at Function._.each._.forEach (/Users/matthew/.meteor/packages/meteor-tool/.1.0.31.1y1vh87++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141017-08:18:44.743(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
W20141017-08:18:48.511(-4)? (STDERR) 
W20141017-08:18:48.513(-4)? (STDERR) /Users/matthew/.meteor/packages/meteor-tool/.1.0.31.1y1vh87++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141017-08:18:48.513(-4)? (STDERR)                        throw(ex);
W20141017-08:18:48.513(-4)? (STDERR)                              ^
W20141017-08:18:48.513(-4)? (STDERR) ReferenceError: FAIL is not defined
W20141017-08:18:48.514(-4)? (STDERR)     at Package (packages/local-test:appfails/appfails-test.coffee:1)
W20141017-08:18:48.514(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/packages/local-test_appfails.js:25:4
W20141017-08:18:48.514(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/packages/local-test_appfails.js:32:3
W20141017-08:18:48.514(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/boot.js:161:10
W20141017-08:18:48.514(-4)? (STDERR)     at Array.forEach (native)
W20141017-08:18:48.514(-4)? (STDERR)     at Function._.each._.forEach (/Users/matthew/.meteor/packages/meteor-tool/.1.0.31.1y1vh87++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141017-08:18:48.515(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
W20141017-08:18:51.823(-4)? (STDERR) 
W20141017-08:18:51.825(-4)? (STDERR) /Users/matthew/.meteor/packages/meteor-tool/.1.0.31.1y1vh87++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141017-08:18:51.826(-4)? (STDERR)                        throw(ex);
W20141017-08:18:51.826(-4)? (STDERR)                              ^
W20141017-08:18:51.826(-4)? (STDERR) ReferenceError: FAIL is not defined
W20141017-08:18:51.826(-4)? (STDERR)     at Package (packages/local-test:appfails/appfails-test.coffee:1)
W20141017-08:18:51.827(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/packages/local-test_appfails.js:25:4
W20141017-08:18:51.827(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/packages/local-test_appfails.js:32:3
W20141017-08:18:51.827(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/boot.js:161:10
W20141017-08:18:51.827(-4)? (STDERR)     at Array.forEach (native)
W20141017-08:18:51.827(-4)? (STDERR)     at Function._.each._.forEach (/Users/matthew/.meteor/packages/meteor-tool/.1.0.31.1y1vh87++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141017-08:18:51.827(-4)? (STDERR)     at /private/var/folders/br/wm4xtx_d0pvfz64d7y2r07r80000gq/T/meteor-test-rundt2pye/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
Couldn't find any mongod child:
 { [Error: Command failed: ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
] killed: false, code: 1, signal: null }
spacejam: meteor has errors, exiting

/Users/matthew/src/spacejam/src/MeteorMongodb.coffee:30
      return this.mongodChilds.length > 0;
                              ^
TypeError: Cannot read property 'length' of undefined
  at MeteorMongodb.hasMongodb (/Users/matthew/src/spacejam/src/MeteorMongodb.coffee:20:18)
  at Meteor.hasMongodb (/Users/matthew/src/spacejam/src/Meteor.coffee:202:27)
  at Meteor.<anonymous> (/Users/matthew/src/spacejam/src/SpaceJam.coffee:79:63)
  at Meteor.EventEmitter.emit (events.js:92:17)
  at /Users/matthew/src/spacejam/src/Meteor.coffee:187:10
  at /Users/matthew/src/spacejam/src/MeteorMongodb.coffee:34:9
  at /Users/matthew/src/spacejam/node_modules/ps-node/lib/index.js:120:20
  at /Users/matthew/src/spacejam/node_modules/ps-node/lib/index.js:72:24
  at ChildProcess.exithandler (child_process.js:651:7)
  at ChildProcess.EventEmitter.emit (events.js:98:17)
  at maybeClose (child_process.js:753:16)
  at Socket.<anonymous> (child_process.js:966:11)
  at Socket.EventEmitter.emit (events.js:95:17)
  at Pipe.close (net.js:465:12)

/Users/matthew/src/spacejam/bin/spacejam exited with code: 8
    5) should exit with 2, if the meteor app crashes
Killing  /Users/matthew/src/spacejam/bin/spacejam
Spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Meteor 0.9.4 is available. Update this project with 'meteor update'.
=> Started MongoDB.     
I20141017-08:19:05.816(-4)? test-in-console listening
=> Started your app.

=> App running at: http://localhost:10096/
Couldn't find any mongod child:
 { [Error: Command failed: ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
] killed: false, code: 1, signal: null }
spacejam: meteor is ready

/Users/matthew/src/spacejam/src/MeteorMongodb.coffee:30
      return this.mongodChilds.length > 0;
                              ^
TypeError: Cannot read property 'length' of undefined
  at MeteorMongodb.hasMongodb (/Users/matthew/src/spacejam/src/MeteorMongodb.coffee:20:18)
  at Meteor.hasMongodb (/Users/matthew/src/spacejam/src/Meteor.coffee:202:27)
  at Meteor.<anonymous> (/Users/matthew/src/spacejam/src/SpaceJam.coffee:71:63)
  at Meteor.EventEmitter.emit (events.js:92:17)
  at /Users/matthew/src/spacejam/src/Meteor.coffee:196:10
  at /Users/matthew/src/spacejam/src/MeteorMongodb.coffee:34:9
  at /Users/matthew/src/spacejam/node_modules/ps-node/lib/index.js:120:20
  at /Users/matthew/src/spacejam/node_modules/ps-node/lib/index.js:72:24
  at ChildProcess.exithandler (child_process.js:651:7)
  at ChildProcess.EventEmitter.emit (events.js:98:17)
  at maybeClose (child_process.js:753:16)
  at Socket.<anonymous> (child_process.js:966:11)
  at Socket.EventEmitter.emit (events.js:95:17)
  at Pipe.close (net.js:465:12)

/Users/matthew/src/spacejam/bin/spacejam exited with code: 8
    6) should exit with 0, in case of a complete test, with a settings file, multiple packages, including wildcards in package names
Killing  /Users/matthew/src/spacejam/bin/spacejam


  12 passing (1m)
  6 failing
|
  1) Meteor.coffee kill() - should kill internal mongodb child processes:
     Uncaught AssertionError: could not find mongod children: expected [Error: Command failed: ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
] to be falsy


  2) spacejam test-packages should exit with 0 if tests pass for a meteor app package:

      spacejam exited with errors
      + expected - actual

      +0
      -3

      at ChildProcess.<anonymous> (/Users/matthew/src/spacejam/tests/SpaceJamTest.coffee:48:56)
      at ChildProcess.EventEmitter.emit (events.js:117:20)
      at Process.ChildProcess._handle.onexit (child_process.js:807:12)

  3) spacejam test-packages should exit with 0 if tests pass for a standalone package:

      spacejam exited with errors
      + expected - actual

      +0
      -3

      at ChildProcess.<anonymous> (/Users/matthew/src/spacejam/tests/SpaceJamTest.coffee:61:56)
      at ChildProcess.EventEmitter.emit (events.js:117:20)
      at Process.ChildProcess._handle.onexit (child_process.js:807:12)

  4) spacejam test-packages should exit with 2, if tests failed:

      spacejam exited with the wrong code
      + expected - actual

      +2
      -8

      at ChildProcess.<anonymous> (/Users/matthew/src/spacejam/tests/SpaceJamTest.coffee:96:64)
      at ChildProcess.EventEmitter.emit (events.js:117:20)
      at Process.ChildProcess._handle.onexit (child_process.js:807:12)

  5) spacejam test-packages should exit with 2, if the meteor app crashes:

      Uncaught AssertionError: expected 8 to equal 3
      + expected - actual

      +3
      -8

      at ChildProcess.<anonymous> (/Users/matthew/src/spacejam/tests/SpaceJamTest.coffee:121:25)
      at ChildProcess.EventEmitter.emit (events.js:117:20)
      at Process.ChildProcess._handle.onexit (child_process.js:807:12)

  6) spacejam test-packages should exit with 0, in case of a complete test, with a settings file, multiple packages, including wildcards in package names:

      spacejam exited with errors
      + expected - actual

      +0
      -8

      at ChildProcess.<anonymous> (/Users/matthew/src/spacejam/tests/SpaceJamTest.coffee:133:56)
      at ChildProcess.EventEmitter.emit (events.js:117:20)
      at Process.ChildProcess._handle.onexit (child_process.js:807:12)



mocha exit code: 6
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

Any thoughts?

--xunit-out creates empty output file

Performing the following command:
$ spacejam-mocha --xunit-out results.xml

This runs all testcases for all project packages and reports the results to the console normally. However, although the results.xml file does get created, its contents are empty. I've tried conditions where all test cases pass and where some fail but the result is the same.

Am I invoking the option correctly?

I'm using version 1.5.1 of spacejam against meteor 1.2.1

Tests fail in tinytest, but not spacejam

Man, I'm really looking for a predictable command-line testing tool for packages, but getting disheartened.

The first package I wrote and tried to validate this tool on, I get only the following output on the console (did it pass, fail, error?), and a 0 exit code regardless of whether tinytest sees the failure.

spacejam test-packages packages/schedule-the-things\:data/
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
spacejam: killing meteor
~/src/deanius/schedule-the-things (master *) $ echo $?
0

Package source:
https://s3.amazonaws.com/www.chicagogrooves.com/spacejam-debug.zip

By contrast, arunoda's phantom jS runner in this case gives me something I can see is working, and which actually works:

node start_test.js
I20150426-22:17:02.662(-5)? test-in-console listening
starting testing...
Running Meteor tests in PhantomJS... http://localhost:10015/
S: tinytest - data : !!!!!!!!! FAIL !!!!!!!!!!!
{"groupPath":["tinytest"],"test":"data","events":[{"sequence":0,"type":"fail","details":{"type":"assert_equal","expected":"true","actual":"false","not":false}}],"server":true}
C: tinytest - data : !!!!!!!!! FAIL !!!!!!!!!!!
{"groupPath":["tinytest"],"test":"data","events":[{"sequence":0,"type":"fail","details":{"type":"assert_equal","expected":"true","actual":"false","not":false},"cookie":{"name":"data","offset":0,"groupPath":["tinytest"],"shortName":"data"}}]}
~~~~~~~ THERE ARE FAILURES ~~~~~~~
passed/expected/failed/total 0 / 0 / 2 / 2
##_meteor_magic##state: done

Is there any insight you have into why this package's failures aren't detected by Spacejam?

Spacejam: Unknown error with exit code 'null'

I need some help figuring out what's going on with this. I just installed spacejam for all users (sudo -H npm install -g spacejam) and tried spacejam test-packages ./ and I get:

$ spacejam test-packages ./
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
spacejam: killing meteor
spacejam: Unknown error with exit code 'null'. Exiting.

This package works fine and all tests pass using meteor test-packages ./ Worse, it does the same for all packages. That makes me pretty confident it's a installation or configuration issue, but I'm sure where to look. Any ideas? I've tried all sorts of combinations of options, like using the system phantomjs, etc, to no avail.

Support spacejam --version

I can't figure out how to print the spacejam version of the binary I'm using. It'd be great if the CLI supported this.

1.6.0 fails with coffee: No such file or directory

We recently noticed our builds were failing on circleci along with this error:

spacejam test-packages
/usr/bin/env: coffee: No such file or directory

spacejam test-packages returned exit code 127

on taking a look into it I realised they were installing 1.6.0 previously 1.5.2.

Any idea what's causing this issue on the latest version?

Is there some way to prevent meteor auto-restart?

I've got a situation where my Meteor package causes the tinytest Meteor app to crash the first time Exited with code: 8, but restarts and then works normally. This is caused by a failing db migration. After restarting, a "migrations locked" error is printed and the other tinytests succeed.

Is there some way to get spacejam to make sure Meteor does not restart?

Here's a simple repro. Create a Meteor package with this code:

Meteor.startup(function() {
  const fs = Npm.require('fs');
  if (!fs.existsSync('/tmp/failFlagFile')) {
    const fd = fs.openSync('/tmp/failFlagFile', 'w');
    fs.closeSync(fd);
    WILL_CRASH_HERE
  }
});

The crash only happens the first time. After restarting, it'll skip the block with the offending code. Example output:

node_modules/.bin/spacejam test-packages ./
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
I20151109-13:21:20.615(-8)? test-in-console listening
W20151109-13:21:20.616(-8)? (STDERR) 
W20151109-13:21:20.617(-8)? (STDERR) /home/adamm/.meteor/packages/meteor-tool/.1.1.10.16mo0i3++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151109-13:21:20.617(-8)? (STDERR)                        throw(ex);
W20151109-13:21:20.617(-8)? (STDERR)                              ^
W20151109-13:21:20.617(-8)? (STDERR) ReferenceError: WILL_CRASH_HERE is not defined
W20151109-13:21:20.617(-8)? (STDERR)     at Package (spacejam-startup-repro.js:6:5)
W20151109-13:21:20.617(-8)? (STDERR)     at /tmp/meteor-test-runtbda1u/.meteor/local/build/programs/server/boot.js:249:5
=> Exited with code: 8
I20151109-13:21:22.952(-8)? test-in-console listening
=> Meteor server restarted
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/local using test-in-console
ReferenceError: Can't find variable: Npm

  http://localhost:4096/packages/spacejam-startup-repro.js?6b3d78d22f812eab7d3f31026b197aef25e437d4:31
  http://localhost:4096/packages/meteor.js?9730f4ff059088b3f7f14c0672d155218a1802d4:777
  http://localhost:4096/packages/meteor.js?9730f4ff059088b3f7f14c0672d155218a1802d4:779
S: tinytest - example : OK
C: tinytest - example : OK
passed/expected/failed/total 2 / 0 / 0 / 2
##_meteor_magic##state: done
spacejam: phantomjs exited with code: 0
spacejam: killing meteor

env: coffee: No such file or directory

Getting this error on installing and running spacejam.
Meteor. 1.3.2-rc.5 , Mac OSX

npm install -g spacejam
// ok
spacejam test --driver-package practicalmeteor:mocha
// env: coffee: No such file or directory

First invocation of spacejam after fresh install always fails

We use spacejam for automatic testing in TeamCity on dynamic aws-ec2 agent-nodes.
These instances have an image where spacejam is installed with "npm install -g spacejam".
After startup always the first invocation "spacejam test-packages ./" fails because of the wrong app url.

 => App running at:
      https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/1.0.2

Any later run then works until agent is shutdown.
Maybe the root cause is meteor itself, since its also the first time used after install.

=> Started proxy.
 [14:46:06]=> Started MongoDB.
 [14:46:06]spacejam: meteor mongodb is ready
 [14:46:09] [34mI20141220-14:45:52.729(0)?  [39mtest-in-console listening
 [14:46:09]=> Started your app.
 [14:46:09]
 [14:46:09]=> App running at:
 [14:46:09]   https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/1.0.2
 [14:46:09]spacejam: meteor is ready
 [14:46:09]spacejam: spawning phantomjs
 [14:46:10]phantomjs: Running tests at http://localhost:4096/ using test-in-console

spacejam on Windows crashes during startup

Unfortunately, it looks like that age-old Mac to Windows issue where spaces in directory names are screwing up command execution.

spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
spacejam: Warning: Error enumerating mongod children:
 'C:\Users\Leonidas' is not recognized as an internal or external command,
operable program or batch file.

spacejam: Warning: Enumerating mongod children returned with error code:  1

And phantomjs crashes further down:

=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
   Type Control-C twice to stop.

phantomjs: Running tests at http://localhost:4096/local using test-in-console
phantomjs: Error: angular package is missing
    http://localhost:4096/packages/angular-templates.js?hash=bb9d31b69778266042ee846eece158ddb194c46c: 3
3
    http://localhost:4096/packages/angular-templates.js?hash=bb9d31b69778266042ee846eece158ddb194c46c: 8
5
spacejam: phantomjs exited with code: 6
spacejam: killing meteor
spacejam: Unknown error with exit code 'null'. Exiting.

MONGO_URL not honored?

I want to pass an empty MONGO_URL to meteor test-packages because my package doesn't do any DB work. This works normally, i.e. MONGO_URL=mongodb:// meteor test-packages ./ works perfectly. But it looks like spacejam sets its own MONGO_URL:

$ echo $MONGO_URL
mongodb://
$ MONGO_URL=mongodb:// spacejam test-packages ./
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
...

phantomjs: TypeError: undefined is not an object (evaluating 'Package.modules.meteorInstall')

Hi there.

Any clue why this happens?

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/xunit using test-in-console
phantomjs: TypeError: undefined is not an object (evaluating 'Package.modules.meteorInstall')
    http://localhost:4096/packages/es5-shim.js?hash=4187fffd3f43294b6953a57a6a17c24fbf2af5d2: 17
spacejam: phantomjs exited with code: 6
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: Unhandled error in meteor client side code. Exiting.

Unfortunately our build break due to this issue. But our tests with practicalmeteor:mocha driver run fine.

Cheers

EDIT:
Using latest Meteor Release 1.5

PhantomJS coverage fails by 'Failed to save html report'. How can I get more details?

I have a project where I once in a while run the tests including code-coverage. Today I discovered that it fails. After reading in other issues a bit I discovered this flag --loglevel debug, and this got me a bit closer ..

The tests themselves run all through and I get the following ending line:

--------------------------------------------------
---------------------RESULTS----------------------
PASSED: 890
FAILED: 0
SKIPPED: 0
TOTAL: 890
--------------------------------------------------
--------------------------------------------------

Tests are ok! Meteor-coverage is saving client side coverage to the server. Client js files saved  {"SUCCESS":1,"FAILED":0,"TOTAL":1}

But somewhere in there it aborts by the following lines:

[...]
I20170703-12:26:34.057(4)? isRefused /projectPath/imports/utils/client/groupZonesInRanges.test.js
I20170703-12:26:34.057(4)? [Accepted][*]:  /projectPath/imports/utils/subscriptionHelpers.js
I20170703-12:26:34.057(4)? Try to remove the content & create the file /projectPath/.coverage/ui/components/branches/branchesList.js.html
I20170703-12:26:34.057(4)? Creating a new html report /projectPath/.coverage/ui/components/branches/branchesListLinkerCollection.js.html
I20170703-12:26:34.947(4)? [Accepted][*]:  /projectPath/imports/api/projects/publications/my-active-projects.js
I20170703-12:26:34.948(4)? [Ignored][exclude.server]:  /projectPath/imports/api/projects/publications/my-active-projects.test.js
[...]
I20170703-12:26:35.129(4)? [Ignored][exclude.client]:  /projectPath/imports/utils/client/groupScans.test.js
I20170703-12:26:35.129(4)? isRefused /projectPath/imports/utils/client/groupScans.test.js
I20170703-12:26:35.129(4)? [Ignored][exclude.client]:  /projectPath/imports/utils/client/groupZonesInRanges.test.js
I20170703-12:26:35.130(4)? isRefused /projectPath/imports/utils/client/groupZonesInRanges.test.js
I20170703-12:26:35.130(4)? [Accepted][*]:  /projectPath/imports/utils/subscriptionHelpers.js
I20170703-12:26:35.130(4)? Try to remove the content & create the file /projectPath/.coverage/ui/components/branches/branchesListLinkerCollection.js.html
I20170703-12:26:35.130(4)? Creating a new html report /projectPath/.coverage/ui/components/branches/branchesRemoveButton.js.html
coverage error: Failed to save html report
ChildProcess.process.on 'exit': @command=phantomjs @killed=false code=7 signal=null
spacejam: phantomjs exited with code: 7
Meteor.kill() {} @childProcess?= true @mongodb?= true
ChildProcess.kill() signal=SIGTERM @command=meteor @killed=false
spacejam: killing meteor
MeteorMongodb.kill() killed= false
Spacejam.done() { '0': 7 }
Spacejam.done() @meteor?=true
Meteor.hasMongodb()
MeteorMongodb.hasMongodb()
Spacejam.done() @waitForMeteorMongodbKillDone=true
Spacejam.done() waiting for mongodb to exit before calling done
ChildProcess.process.on 'exit': @command=meteor @killed=true code=null signal=SIGTERM
spacejam: meteor killed with signal: SIGTERM
Spacejam.meteor.on 'exit': { '0': null, '1': 'SIGTERM' }
Spacejam.onMeteorMongodbKillDone() 7
spacejam: Unknown error with exit code '7'. Exiting.
ChildProcess.process.on 'exit': @command=meteor @killed=true code=7
ChildProcess.kill() signal=SIGTERM @command=meteor @killed=true
MeteorMongodb.process.on 'exit': code=7
MeteorMongodb.kill() killed= true
ChildProcess.process.on 'exit': @command=phantomjs @killed=true code=7
ChildProcess.kill() signal=SIGTERM @command=phantomjs @killed=true

As of the first chunk, I guess the system doesn't care if the file's name actually ends by '.js.html' or just by '.html', because it ran through at the file branchesListLinkerCollection.js.html and branchesList.js.html.

Here's how the file branchesRemoveButton.html looks like:

<md-icon md-svg-icon="action:ic_delete_24px" aria-label="{{ 'branches.remove-button.label' | translate }}" ng-click="branchesRemoveButton.remove(); $event.stopPropagation();"></md-icon>

How can I get more details about why it failed at that file there? The disk has quite some space left, removing the .coverage folder, where the files are stored in doesn't help either ... Any clue how I could get to a detailed error-message here?

EDIT: It seems PhantomJS is trying to save the coverage twice if I am not mistaken when taking a view into the folder in the file-system ...

I have the following versions:

  • PhantomJS 2.1.1
  • Spacejam 1.6.1
  • Meteor 1.4.3.2
  • Node 7.10.0

Windows support?

Now that Meteor is about to release official support for Windows, would there be interest in making spacejam run on Windows? I know it's intended for CI, which runs on *nix machines, but for local development, it would be useful to have Windows support. Right now, I get

> spacejam --mongo-url mongodb:// test-packages ./

spacejam: spawning meteor
spacejam: killing meteor

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:988:11)
    at Process.ChildProcess._handle.onexit (child_process.js:779:34)

Stuck on running-tests when using mocha-console-runner

Hi there,

Tests are working when I use meteor test --driver-package=practicalmeteor:mocha, but not with spacejam test --driver-package=practicalmeteor:mocha-console-runner

Here's my console output:

spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/local using test-in-console

And then, nothing happens.
http://localhost:4096/local shows a blank page without errors.

I'm using Meteor 1.4.1.1

Any ideas?

Test cannot run on client (error preventing script execution) but build is ok

Hi,

It seems that if the client side tests are not run because of a javascript error prior to the execution, the build will end successfully no matter what.

Here is an example
The Npm variable is not set because it is not expected to run on the client side, only the server side, this will prevent the client side test from ever being run... But the build will be marked as successful because the test server are successful.

Is their a way to get the correct behavior ? (ie: if it crash, then its not ok)

Thanks for your work on this package, it is really helpfull !

Error: Cannot find module '../lib/log' #57

travis can't run bin/spacejam, it throws this error: Error: Cannot find module '../lib/log'

Here is the list of operation that I did on travis

    npm install -g https://github.com/practicalmeteor/spacejam/tarball/master coveralls
    spacejam test            --loglevel debug --driver-package=practicalmeteor:mocha-console-runner --coverage
    module.js:340
    throw err;
    ^
    Error: Cannot find module '../lib/log'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/travis/.nvm/v0.10.40/lib/node_modules/spacejam/bin/spacejam:3:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    The command "spacejam test --loglevel debug --driver-package=practicalmeteor:mocha-console-runner --coverage" exited with 8.

You can find the entire log here: https://travis-ci.org/serut/meteor-coverage-app-exemple/builds/134144135

Node try to require the file ../lib/log.js and not the file ../lib/log.coffee. This is exactly this use case: https://stackoverflow.com/questions/4768748/requireing-a-coffeescript-file-from-a-javascript-file-or-repl
Please integrate my pull request #57 that fix this issue.

`Altered source could not be accessed:` error and no coverage generated

[email protected] installed globally

Running
COVERAGE=1 COVERAGE_VERBOSE=1 COVERAGE_APP_FOLDER=./.coverage spacejam test --driver-package practicalmeteor:mocha-console-runner --coverage out_coverage --loglevel debug

does not produce the coverage dump expected in .coverage and has the following result, including a number of Altered source could not be accessed: errors (in bold below):

Spacejam.constructor()
CLI.constructor()
CLI.exec()
command: test
CLI.exec() options: { 'driver-package': 'practicalmeteor:mocha-console-runner',
  coverage: 'out_coverage',
  loglevel: 'debug',
  packages: [],
  command: 'test' }
Spacejam.testPackages() { 'driver-package': 'practicalmeteor:mocha-console-runner',
  coverage: 'out_coverage',
  loglevel: 'debug',
  packages: [],
  command: 'test' }
{ 'phantomjs-script': 'phantomjs-test-in-console.js',
  'phantomjs-options': '--load-images=no --ssl-protocol=TLSv1',
  'driver-package': 'practicalmeteor:mocha-console-runner',
  coverage: 'out_coverage',
  loglevel: 'debug',
  packages: [],
  command: 'test' }
Meteor.runTestCommand() { '0': 'test',
  '1': 
   { 'phantomjs-script': 'phantomjs-test-in-console.js',
     'phantomjs-options': '--load-images=no --ssl-protocol=TLSv1',
     'driver-package': 'practicalmeteor:mocha-console-runner',
     coverage: 'out_coverage',
     loglevel: 'debug',
     packages: [],
     command: 'test' } }
meteor options: { dir: '.',
  port: 4096,
  packages: [],
  'driver-package': 'practicalmeteor:mocha-console-runner',
  'meteor-ready-text': '=> App running at:',
  'meteor-error-text': 'Waiting for file change.',
  'phantomjs-script': 'phantomjs-test-in-console.js',
  'phantomjs-options': '--load-images=no --ssl-protocol=TLSv1',
  coverage: 'out_coverage',
  loglevel: 'debug',
  command: 'test' }
meteor cwd=/Users/Elena/colonyDapp/app
Meteor.getTestArgs() { dir: '.',
  port: 4096,
  packages: [],
  'driver-package': 'practicalmeteor:mocha-console-runner',
  'meteor-ready-text': '=> App running at:',
  'meteor-error-text': 'Waiting for file change.',
  'phantomjs-script': 'phantomjs-test-in-console.js',
  'phantomjs-options': '--load-images=no --ssl-protocol=TLSv1',
  coverage: 'out_coverage',
  loglevel: 'debug',
  command: 'test' }
meteor args= [ 'test',
  '--driver-package',
  'practicalmeteor:mocha',
  '--port',
  4096 ]
ChildProcess.constructor()
ChildProcess.spawn() meteor [ 'test',
  '--driver-package',
  'practicalmeteor:mocha',
  '--port',
  4096 ]
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
MeteorMongodb.constructor() { '0': 10508 }
MeteorMongodb.findAllChildren() {}
@meteorPid 10508
spacejam: meteor mongodb is ready
Found meteor mongod child with pid:  10527
=> A patch (Meteor 1.4.1.2) for your current release is available!
   Update this project now with 'meteor update --patch'.
W20161018-10:05:04.337(3)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20161018-10:05:04.379(3)? (STDERR) While this implementation will work correctly, it is known to be
W20161018-10:05:04.379(3)? (STDERR) approximately three times slower than the native implementation.
W20161018-10:05:04.380(3)? (STDERR) In order to use the native implementation instead, run
W20161018-10:05:04.380(3)? (STDERR) 
W20161018-10:05:04.380(3)? (STDERR)   meteor npm install --save bcrypt
W20161018-10:05:04.381(3)? (STDERR) 
W20161018-10:05:04.381(3)? (STDERR) in the root directory of your application.
I20161018-10:05:05.384(3)? Coverage active
I20161018-10:05:05.387(3)? Loading default configuration
I20161018-10:05:05.387(3)? Coverage configuration:
I20161018-10:05:05.388(3)? - IS_COVERAGE_ACTIVE= true
I20161018-10:05:05.388(3)? - IS_COVERAGE_VERBOSE= true
I20161018-10:05:05.388(3)? - COVERAGE_APP_FOLDER= ./.coverage
I20161018-10:05:05.388(3)? .coverage.json values:
I20161018-10:05:05.405(3)? - exclude= { general: [],
I20161018-10:05:05.405(3)?   server: 
I20161018-10:05:05.405(3)?    [ '**/node_modules/**/*.json',
I20161018-10:05:05.405(3)?      '**/.?*/**',
I20161018-10:05:05.406(3)?      '**/packages/!(local-test_?*.js)',
I20161018-10:05:05.406(3)?      '**/+([^:]):+([^:])/**',
I20161018-10:05:05.406(3)?      '**/@(test|tests|spec|specs)/**',
I20161018-10:05:05.406(3)?      '**/?(*.)test?(s).?*',
I20161018-10:05:05.406(3)?      '**/?(*.)spec?(s).?*',
I20161018-10:05:05.407(3)?      '**/?(*.)app-test?(s).?*',
I20161018-10:05:05.407(3)?      '**/?(*.)app-spec?(s).?*' ],
I20161018-10:05:05.407(3)?   client: 
I20161018-10:05:05.407(3)?    [ '**/client/stylesheets/**',
I20161018-10:05:05.408(3)?      '**/.npm/package/node_modules/**',
I20161018-10:05:05.408(3)?      '**/web.browser/packages/**',
I20161018-10:05:05.408(3)?      '**/.?*/**',
I20161018-10:05:05.408(3)?      '**/packages/!(local-test_?*.js)',
I20161018-10:05:05.409(3)?      '**/+([^:]):+([^:])/**',
I20161018-10:05:05.409(3)?      '**/@(test|tests|spec|specs)/**',
I20161018-10:05:05.409(3)?      '**/?(*.)test?(s).?*',
I20161018-10:05:05.409(3)?      '**/?(*.)spec?(s).?*',
I20161018-10:05:05.409(3)?      '**/?(*.)app-test?(s).?*',
I20161018-10:05:05.410(3)?      '**/?(*.)app-spec?(s).?*' ] }
I20161018-10:05:05.410(3)? - include= []
I20161018-10:05:05.410(3)? - remapFormat= [ 'html',
I20161018-10:05:05.410(3)?   'cobertura',
I20161018-10:05:05.410(3)?   'clover',
I20161018-10:05:05.411(3)?   'json',
I20161018-10:05:05.411(3)?   'json-summary',
I20161018-10:05:05.411(3)?   'lcovonly',
I20161018-10:05:05.411(3)?   'teamcity',
I20161018-10:05:05.411(3)?   'text',
I20161018-10:05:05.412(3)?   'text-summary' ]
I20161018-10:05:05.412(3)? - COVERAGE_EXPORT_FOLDER= ./.coverage
I20161018-10:05:06.107(3)? [Ignored][exclude.server]:  /packages/tmeasday_test-reporter-helpers.js
I20161018-10:05:06.107(3)? [ServerSide][Package] file ignored: /packages/tmeasday_test-reporter-helpers.js
I20161018-10:05:06.108(3)? [Ignored][exclude.server]:  /packages/reload.js
I20161018-10:05:06.108(3)? [ServerSide][Package] file ignored: /packages/reload.js
I20161018-10:05:06.108(3)? [Ignored][exclude.server]:  /packages/autoupdate.js
I20161018-10:05:06.108(3)? [ServerSide][Package] file ignored: /packages/autoupdate.js
I20161018-10:05:06.109(3)? [Ignored][exclude.server]:  /packages/practicalmeteor_loglevel.js
I20161018-10:05:06.110(3)? [ServerSide][Package] file ignored: /packages/practicalmeteor_loglevel.js
I20161018-10:05:06.120(3)? [Ignored][exclude.server]:  /packages/practicalmeteor_mocha.js
I20161018-10:05:06.120(3)? [ServerSide][Package] file ignored: /packages/practicalmeteor_mocha.js
I20161018-10:05:06.196(3)? [Ignored][exclude.server]:  /packages/practicalmeteor_mocha-console-runner.js
I20161018-10:05:06.196(3)? [ServerSide][Package] file ignored: /packages/practicalmeteor_mocha-console-runner.js
I20161018-10:05:06.197(3)? [Ignored][exclude.server]:  /packages/hot-code-push.js
I20161018-10:05:06.197(3)? [ServerSide][Package] file ignored: /packages/hot-code-push.js
I20161018-10:05:06.197(3)? [Ignored][exclude.server]:  /packages/templating.js
I20161018-10:05:06.197(3)? [ServerSide][Package] file ignored: /packages/templating.js
I20161018-10:05:06.197(3)? [Ignored][exclude.server]:  /packages/global-imports.js
I20161018-10:05:06.198(3)? [ServerSide][Package] file ignored: /packages/global-imports.js
I20161018-10:05:06.198(3)? [Ignored][exclude.server]:  /private/var/folders/41/y_3bjvkj19b54sp51dzk63vh0000gn/T/meteor-test-run1ao7p4d/.meteor/local/build/programs/server/app/app.js
I20161018-10:05:06.199(3)? [ServerSide][App.js] file ignored: /app/app.js
I20161018-10:05:10.637(3)? [Ignored][exclude.server]:  /packages/mdg_validation-error.js
I20161018-10:05:10.638(3)? [ServerSide][Package] file ignored: /packages/mdg_validation-error.js
I20161018-10:05:10.704(3)? Kadira: completed instrumenting the app
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
Spacejam.runPhantom()
Phantomjs.run() { '0': 'http://localhost:4096/local',
  '1': '--load-images=no --ssl-protocol=TLSv1',
  '2': 'phantomjs-test-in-console.js',
  '3': undefined,
  '4': undefined,
  '5': false }
script=/usr/local/lib/node_modules/spacejam/lib/phantomjs-test-in-console.js
spawnArgs: [ '--load-images=no',
  '--ssl-protocol=TLSv1',
  'phantomjs-test-in-console.js' ]
spawnOptions: { cwd: '/usr/local/lib/node_modules/spacejam/lib',
  detached: false,
  env: 
   { COVERAGE_APP_FOLDER: './.coverage',
     COVERAGE_VERBOSE: '1',
     COVERAGE: '1',
     TERM_PROGRAM: 'Apple_Terminal',
     SHELL: '/bin/bash',
     TERM: 'xterm-256color',
     TMPDIR: '/var/folders/41/y_3bjvkj19b54sp51dzk63vh0000gn/T/',
     Apple_PubSub_Socket_Render: '/private/tmp/com.apple.launchd.nUVNSNXcu6/Render',
     TERM_PROGRAM_VERSION: '377',
     OLDPWD: '/Users/Elena/colonyDapp',
     TERM_SESSION_ID: 'A73842F3-F13D-49AD-BA42-55F5E8BB8194',
     USER: 'Elena',
     SSH_AUTH_SOCK: '/private/tmp/com.apple.launchd.H96gFV8a7X/Listeners',
     __CF_USER_TEXT_ENCODING: '0x1F5:0x0:0x2',
     PATH: '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin',
     PWD: '/Users/Elena/colonyDapp/app',
     LANG: 'en_GB.UTF-8',
     XPC_FLAGS: '0x0',
     XPC_SERVICE_NAME: '0',
     SHLVL: '1',
     HOME: '/Users/Elena',
     LOGNAME: 'Elena',
     DISPLAY: '/private/tmp/com.apple.launchd.JxKJCDQrR3/org.macosforge.xquartz:0',
     _: '/usr/local/bin/spacejam',
     ROOT_URL: 'http://localhost:4096/local' } }
ChildProcess.constructor()
ChildProcess.spawn() phantomjs [ '--load-images=no',
  '--ssl-protocol=TLSv1',
  'phantomjs-test-in-console.js' ]
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/local using test-in-console
I20161018-10:05:12.825(3)? [Ignored][exclude.client]:  /packages/underscore.js
I20161018-10:05:12.826(3)? [ClientSide][Public] file ignored: /packages/underscore.js
I20161018-10:05:12.827(3)? [Ignored][exclude.client]:  /packages/meteor.js
I20161018-10:05:12.827(3)? [ClientSide][Public] file ignored: /packages/meteor.js
I20161018-10:05:12.831(3)? [Ignored][exclude.client]:  /packages/meteor-base.js
I20161018-10:05:12.832(3)? [ClientSide][Public] file ignored: /packages/meteor-base.js
I20161018-10:05:14.080(3)? [Ignored][exclude.client]:  /packages/lmieulet_meteor-coverage.js
I20161018-10:05:14.081(3)? [ClientSide][Public] file ignored: /packages/lmieulet_meteor-coverage.js
I20161018-10:05:14.131(3)? [Ignored][exclude.client]:  /packages/practicalmeteor_loglevel.js
I20161018-10:05:14.131(3)? [ClientSide][Public] file ignored: /packages/practicalmeteor_loglevel.js
I20161018-10:05:14.149(3)? [Ignored][exclude.client]:  /packages/practicalmeteor_mocha.js
I20161018-10:05:14.150(3)? [ClientSide][Public] file ignored: /packages/practicalmeteor_mocha.js
I20161018-10:05:14.159(3)? [Ignored][exclude.client]:  /packages/practicalmeteor_mocha-console-runner.js
I20161018-10:05:14.163(3)? [ClientSide][Public] file ignored: /packages/practicalmeteor_mocha-console-runner.js
I20161018-10:05:14.164(3)? [Ignored][exclude.client]:  /packages/webapp.js
I20161018-10:05:14.165(3)? [ClientSide][Public] file ignored: /packages/webapp.js
I20161018-10:05:14.165(3)? [Ignored][exclude.client]:  /packages/livedata.js
I20161018-10:05:14.166(3)? [ClientSide][Public] file ignored: /packages/livedata.js
I20161018-10:05:14.538(3)? [Ignored][exclude.client]:  /packages/hot-code-push.js
I20161018-10:05:14.539(3)? [ClientSide][Public] file ignored: /packages/hot-code-push.js
I20161018-10:05:14.540(3)? [Ignored][exclude.client]:  /packages/ui.js
I20161018-10:05:14.542(3)? [ClientSide][Public] file ignored: /packages/ui.js
I20161018-10:05:14.630(3)? [Ignored][exclude.client]:  /packages/global-imports.js
I20161018-10:05:14.631(3)? [ClientSide][Public] file ignored: /packages/global-imports.js
I20161018-10:05:14.649(3)? [Accepted][*]:  /app/app.js
I20161018-10:05:14.649(3)? [ClientSide][Public] file instrumented: /app/app.js
I20161018-10:05:14.649(3)? registerSourceMap ../web.browser/app/app.js
I20161018-10:05:14.667(3)? Add source map for file ../web.browser/app/app.js.map
I20161018-10:05:14.667(3)? registerSourceMap ../web.browser/app/app.js
**W20161018-10:05:14.669(3)? (STDERR) Cannot access .coverage/client/imports/lib/taskClient.js
W20161018-10:05:14.670(3)? (STDERR) Altered source could not be accessed: meteor://💻app/client/imports/lib/taskClient.js
W20161018-10:05:14.670(3)? (STDERR) Cannot access .coverage/client/imports/lib/blockies.js
W20161018-10:05:14.670(3)? (STDERR) Altered source could not be accessed: meteor://💻app/client/imports/lib/blockies.js**
I20161018-10:05:19.940(3)? [Ignored][exclude.client]:  /packages/mdg_validation-error.js
I20161018-10:05:19.940(3)? [ClientSide][Public] file ignored: /packages/mdg_validation-error.js
I20161018-10:05:21.035(3)? MochaRunner.runServerTests: Starting server side tests with run id YFmpZbio4vBPbFRt2
W20161018-10:05:21.238(3)? (STDERR) { type: 'TEST' }
W20161018-10:05:21.239(3)? (STDERR) { type: 'TEST' }
W20161018-10:05:21.262(3)? (STDERR) { type: 'TEST', data: { tests: 'to test all the things' } }
W20161018-10:05:21.303(3)? (STDERR) No getter registered for boo
W20161018-10:05:21.308(3)? (STDERR) No getter registered for boo
W20161018-10:05:21.309(3)? (STDERR) No getter registered for boo
W20161018-10:05:21.317(3)? (STDERR) No getter registered for boo
W20161018-10:05:21.318(3)? (STDERR) No getter registered for buu
W20161018-10:05:22.248(3)? (STDERR) { [Error: child "cardId" fails because ["cardId" is required] [validation-error]]
W20161018-10:05:22.248(3)? (STDERR)   error: 'validation-error',
W20161018-10:05:22.248(3)? (STDERR)   reason: 'child "cardId" fails because ["cardId" is required]',
W20161018-10:05:22.249(3)? (STDERR)   details: undefined,
W20161018-10:05:22.249(3)? (STDERR)   message: 'child "cardId" fails because ["cardId" is required] [validation-error]',
W20161018-10:05:23.459(3)? (STDERR) { [Error: [error]]
W20161018-10:05:23.459(3)? (STDERR)   error: 'error',
W20161018-10:05:23.459(3)? (STDERR)   reason: undefined,
W20161018-10:05:23.459(3)? (STDERR)   details: undefined,
W20161018-10:05:23.460(3)? (STDERR)   message: '[error]',
W20161018-10:05:23.460(3)? (STDERR)   errorType: 'Meteor.Error' }
W20161018-10:05:23.460(3)? (STDERR) [Error: error]
W20161018-10:05:24.288(3)? (STDERR) MochaRunner.runServerTests: failures: 0
ChildProcess.process.on 'exit': @command=phantomjs @killed=false code=0 signal=null
spacejam: phantomjs exited with code: 0
Meteor.kill() {} @childProcess?= true @mongodb?= true
ChildProcess.kill() signal=SIGTERM @command=meteor @killed=false
spacejam: killing meteor
MeteorMongodb.kill() killed= false
Spacejam.done() { '0': 0 }
Spacejam.done() @meteor?=true
Meteor.hasMongodb()
MeteorMongodb.hasMongodb()
Spacejam.done() @waitForMeteorMongodbKillDone=true
Spacejam.done() waiting for mongodb to exit before calling done
ChildProcess.process.on 'exit': @command=meteor @killed=true code=null signal=SIGTERM
spacejam: meteor killed with signal: SIGTERM
Spacejam.meteor.on 'exit': { '0': null, '1': 'SIGTERM' }
Spacejam.onMeteorMongodbKillDone() 0
spacejam: All tests have passed. Exiting.
ChildProcess.process.on 'exit': @command=meteor @killed=true code=0
ChildProcess.kill() signal=SIGTERM @command=meteor @killed=true
MeteorMongodb.process.on 'exit': code=0
MeteorMongodb.kill() killed= true
ChildProcess.process.on 'exit': @command=phantomjs @killed=true code=0
ChildProcess.kill() signal=SIGTERM @command=phantomjs @killed=true

Inconsistent failure with meteor test-packages

Hello,

spacejam fails where meteor build-in test-packages ./ command does not. Here is a reproduction with one of my repositories:

$ cd /tmp
$ git clone https://github.com/mquandalle/meteor-harmony.git
$ cd meteor-harmony
$ git checkout 222331 # == master as time of writing
$ meteor test-packages ./ # All tests pass
[[[[[ Tests ]]]]]

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

=> App running at: http://localhost:3000/
^C
$ spacejam test-packages ./ # One test fail
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
I20141204-22:34:42.395(1)? test-in-console listening
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/ using test-in-console
TypeError: 'undefined' is not a function (evaluating 'ModuleStore.register.bind(ModuleStore)')

  http://localhost:4096/packages/mquandalle_harmony.js?96f826070eda23e92c4977520b06dde709005c58:1065
  http://localhost:4096/packages/mquandalle_harmony.js?96f826070eda23e92c4977520b06dde709005c58:1075
  http://localhost:4096/packages/mquandalle_harmony.js?96f826070eda23e92c4977520b06dde709005c58:2599
  http://localhost:4096/packages/mquandalle_harmony.js?96f826070eda23e92c4977520b06dde709005c58:2606
ReferenceError: Can't find variable: firstName

  http://localhost:4096/packages/local-test_mquandalle_harmony.js?182f84ea0cc4baac66888c234410bd61e49f35ef:89
S: tinytest - harmony - presence : OK
S: tinytest - harmony - compile : OK
S: tinytest - harmony - shared : OK
S: tinytest - harmony - arrow functions : OK
S: tinytest - harmony - classes : OK
S: tinytest - harmony - computed property names : OK
S: tinytest - harmony - default parameters : OK
S: tinytest - harmony - destructuring assignment : OK
S: tinytest - harmony - iterators and `for of` : OK
S: tinytest - harmony - generators : OK
S: tinytest - harmony - modules : OK
S: tinytest - harmony - numeric literals : OK
S: tinytest - harmony - property method assigment : OK
S: tinytest - harmony - object initializer shorthand : OK
S: tinytest - harmony - rest parameters : OK
S: tinytest - harmony - spread : OK
S: tinytest - harmony - template literals : OK
S: tinytest - harmony - promises : OK
C: tinytest - harmony - presence : !!!!!!!!! FAIL !!!!!!!!!!!
{"groupPath":["tinytest","harmony"],"test":"presence","events":[{"sequence":0,"type":"fail","details":{"type":"true"},"cookie":{"name":"harmony - presence","offset":0,"groupPath":["tinytest","harmony"],"shortName":"presence"}}]}
~~~~~~~ THERE ARE FAILURES ~~~~~~~
passed/expected/failed/total 18 / 0 / 1 / 19
##_meteor_magic##state: done
spacejam: phantomjs exited with code: 2
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM

Error given at line of file that doesn't exist

I'm getting an error that's referencing a file which does not exist. Otherwise the error descriptors are very useful giving line and character info, but as it is, they serve no purpose since the file doesn't exist. I'm assuming the file is built at runtime, then removed in a clean up process. This makes debugging errors very difficult. Is there a way to circumvent this behavior for files containing errors? Thanks for building this btw, its a very useful tool :)

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
I20150318-16:12:16.210(-7)? test-in-console listening
phantomjs: Running tests at http://localhost:4096/ using test-in-console
TypeError: 'undefined' is not an object (evaluating 'Dante')

  http://localhost:4096/packages/michelson_dante.js?ab34457c37a6f2a7bd2a91041d796514d6d58e43:2282
  http://localhost:4096/packages/michelson_dante.js?ab34457c37a6f2a7bd2a91041d796514d6d58e43:2284
  http://localhost:4096/packages/michelson_dante.js?ab34457c37a6f2a7bd2a91041d796514d6d58e43:4475
  http://localhost:4096/packages/michelson_dante.js?ab34457c37a6f2a7bd2a91041d796514d6d58e43:4484
TypeError: 'undefined' is not an object (evaluating 'Package['michelson:dante'].Dante')

  http://localhost:4096/packages/local-test_michelson_dante.js?a340085d8155b0fc004427a9dd673606cf246e0a:22
  http://localhost:4096/packages/local-test_michelson_dante.js?a340085d8155b0fc004427a9dd673606cf246e0a:54
passed/expected/failed/total 0 / 0 / 0 / 0
##_meteor_magic##state: done
spacejam: phantomjs exited with code: 0
spacejam: killing meteor

tests fail in spacejam but on under meteor test-packages

My test fails on this line:
scheduler.update().should.include.something.that.eql({

With:
TypeError: Cannot read property 'that' of undefined

'something.that' is chai-things syntax. It's a handy library for checking results. It seems to have a weird way of initializing the module, could that be it?
From: https://github.com/chaijs/chai-things/blob/master/lib/chai-things.js

// NodeJS
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
module.exports = chaiModule;
// AMD
else if (typeof define === "function" && define.amd)
define(function () { return chaiModule; });
// Other
else
chai.use(chaiModule);

Function.prototype.bind is undefined in SpaceJam

Great package! I use it for CI tests for my packages.

However, it said my test failed since my code under test was using Function.prototype.bind, which is undefined when running latest SpaceJam. I checked this by console.log-ing out myFunction.bind when running the test.

When using Underscore's _.bind, everything works smoothly.

Allow running spacejam from any folder, not only from app or package folders

I split my jade package in two distinct parts and I now use the undocumented test-app-path option to test both local packages at the same time. More context in this commit message: mquandalle/meteor-jade@6da3e81.

As the above message explains I use the following command to test my packages:

$ meteor test-packages --test-app-path . packages/*

and it works as expected. If I call the equivalent spacejam command just after the above it also works as expected. However if I first remove the .meteor directory, I get the following error:

$ spacejam test-packages --test-app-path . packages/*
Trace: [Error: spacejam needs to be run from within a meteor app or package folder.]
    at Spacejam.testPackages (/usr/lib/node_modules/spacejam/lib/Spacejam.js:117:17)
    at CLI.exec (/usr/lib/node_modules/spacejam/lib/CLI.js:126:53)
    at Object.<anonymous> (/usr/lib/node_modules/spacejam/bin/spacejam:5:29)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Since the .meteor directory is not committed to the repository this is what happen in the Travis CI worker (see https://travis-ci.org/mquandalle/meteor-jade/builds/42870817).

spacejam not working with test-packages Meteor 1.3.4

Hi there,

I'm trying to run TravisCI with a Meteor Package test.

1- Unhandled error in meteor client side code

spacejam test-packages ./ --settings ./dummy-settings.json
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
I20160705-00:53:40.590(-3)? test-in-console listening
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/local using test-in-console
phantomjs: ReferenceError: Can't find variable: Npm
    http://localhost:4096/packages/meteor-plivo.js?hash=aeae5811f0fffd69cd51655e9e31d219f583c2e9: 43
    http://localhost:4096/packages/modules-runtime.js?hash=b7370236eeaf57e8f4ac703424bc831028392451: 180
    http://localhost:4096/packages/modules-runtime.js?hash=b7370236eeaf57e8f4ac703424bc831028392451: 109
    http://localhost:4096/packages/meteor-plivo.js?hash=aeae5811f0fffd69cd51655e9e31d219f583c2e9: 61
spacejam: phantomjs exited with code: 6
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: Unhandled error in meteor client side code. Exiting.

See the entire log
https://travis-ci.org/cortezcristian/meteor-plivo/builds/142354998

What I have tried so far:

2- Meteor is crashing server side

Tried also this command with the --meteor-ready-text flag as seen in #44:

spacejam test-packages --driver-package=test-server-tests-in-console-once --meteor-error-text="Exited with code: 8" --meteor-ready-text="ALL TESTS PASSED"  ./ --settings ./dummy-settings.json

Which works but crashed at the end:

spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
I20160705-02:46:42.986(-3)? running server-side tests
I20160705-02:46:43.050(-3)? tinytest - meteor-plivo - example : OK
I20160705-02:46:43.050(-3)? passed/expected/failed/total 1 / 0 / 0 / 1
I20160705-02:46:43.050(-3)? ALL TESTS PASSED
=> Exited with code: 0
I20160705-02:46:46.774(-3)? running server-side tests
I20160705-02:46:46.779(-3)? tinytest - meteor-plivo - example : OK
I20160705-02:46:46.779(-3)? passed/expected/failed/total 1 / 0 / 0 / 1
I20160705-02:46:46.780(-3)? ALL TESTS PASSED
=> Exited with code: 0
I20160705-02:46:48.356(-3)? running server-side tests
I20160705-02:46:48.361(-3)? tinytest - meteor-plivo - example : OK
I20160705-02:46:48.361(-3)? passed/expected/failed/total 1 / 0 / 0 / 1
I20160705-02:46:48.361(-3)? ALL TESTS PASSED
=> Exited with code: 0
=> Your application is crashing. Waiting for file change.
spacejam: meteor has errors
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: meteor is crashing server side. Exiting.

3- Changed all suite to use mocha and chai

Also changed the suite to use:

import { chai } from 'meteor/practicalmeteor:chai';

// Import and rename a variable exported by meteor-plivo.js.
import { name as packageName } from "meteor/meteor-plivo";

describe('Meteor Plivo Tests', () => {
  it('Package', () =>{
    chai.assert.equal(packageName, "meteor-plivo");
  });
});

And...

// fragment
Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('practicalmeteor:mocha');
  api.use('practicalmeteor:chai');
  api.use('meteor-plivo');
  api.mainModule('meteor-plivo-tests.js');
});

which took me again to problem 1 when running:

spacejam test-packages --driver-package=practicalmeteor:mocha-console-runner ./ --settings ./dummy-settings.json

Output:

spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/local using test-in-console
phantomjs: ReferenceError: Can't find variable: Npm
    http://localhost:4096/packages/meteor-plivo.js?hash=aeae5811f0fffd69cd51655e9e31d219f583c2e9: 43
    http://localhost:4096/packages/modules-runtime.js?hash=b7370236eeaf57e8f4ac703424bc831028392451: 180
    http://localhost:4096/packages/modules-runtime.js?hash=b7370236eeaf57e8f4ac703424bc831028392451: 109
    http://localhost:4096/packages/meteor-plivo.js?hash=aeae5811f0fffd69cd51655e9e31d219f583c2e9: 61
spacejam: phantomjs exited with code: 6
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: Unhandled error in meteor client side code. Exiting.

Spacejam fails with "there is no route for the path: /local"

When I try running node_modules/spacejam/bin/spacejam test --driver-package=practicalmeteor:mocha-console-runner --loglevel debug, I get the following error: phantomjs: There is no route for the path: /local

Full output:

node_modules/spacejam/bin/spacejam test            --driver-package=practicalmeteor:mocha-console-runner --loglevel debug
Spacejam.constructor()
CLI.constructor()
CLI.exec()
command: test
CLI.exec() options: { 'driver-package': 'practicalmeteor:mocha-console-runner',
  loglevel: 'debug',
  packages: [],
  command: 'test' }
Spacejam.testPackages() { 'driver-package': 'practicalmeteor:mocha-console-runner',
  loglevel: 'debug',
  packages: [],
  command: 'test' }
{ 'phantomjs-script': 'phantomjs-test-in-console.js',
  'phantomjs-options': '--load-images=no --ssl-protocol=TLSv1',
  'driver-package': 'practicalmeteor:mocha-console-runner',
  loglevel: 'debug',
  packages: [],
  command: 'test' }
Meteor.runTestCommand() { '0': 'test',
  '1':
   { 'phantomjs-script': 'phantomjs-test-in-console.js',
     'phantomjs-options': '--load-images=no --ssl-protocol=TLSv1',
     'driver-package': 'practicalmeteor:mocha-console-runner',
     loglevel: 'debug',
     packages: [],
     command: 'test' } }
meteor options: { dir: '.',
  port: 4096,
  packages: [],
  'driver-package': 'practicalmeteor:mocha-console-runner',
  'meteor-ready-text': '=> App running at:',
  'meteor-error-text': 'Waiting for file change.',
  'phantomjs-script': 'phantomjs-test-in-console.js',
  'phantomjs-options': '--load-images=no --ssl-protocol=TLSv1',
  loglevel: 'debug',
  command: 'test' }
meteor cwd=/Users/noah/Projects/my-app/app
Meteor.getTestArgs() { dir: '.',
  port: 4096,
  packages: [],
  'driver-package': 'practicalmeteor:mocha-console-runner',
  'meteor-ready-text': '=> App running at:',
  'meteor-error-text': 'Waiting for file change.',
  'phantomjs-script': 'phantomjs-test-in-console.js',
  'phantomjs-options': '--load-images=no --ssl-protocol=TLSv1',
  loglevel: 'debug',
  command: 'test' }
meteor args= [ 'test',
  '--driver-package',
  'practicalmeteor:mocha-console-runner',
  '--port',
  4096 ]
ChildProcess.constructor()
ChildProcess.spawn() meteor [ 'test',
  '--driver-package',
  'practicalmeteor:mocha-console-runner',
  '--port',
  4096 ]
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
MeteorMongodb.constructor() { '0': 55741 }
MeteorMongodb.findAllChildren() {}
@meteorPid 55741
spacejam: meteor mongodb is ready
Found meteor mongod child with pid:  55760
I20160720-08:50:12.450(-7)? info: Initialized testing logger
I20160720-08:50:14.226(-7)? info: Initialized logger
I20160720-08:50:14.841(-7)? Kadira: completed instrumenting the app
I20160720-08:50:14.851(-7)? Cannot connect to Rollbar API as the following environment variables are not available: [ ROLLBAR_SERVER_ACCESS_TOKEN ]
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
Spacejam.runPhantom()
Phantomjs.run() { '0': 'http://localhost:4096/local',
  '1': '--load-images=no --ssl-protocol=TLSv1',
  '2': 'phantomjs-test-in-console.js',
  '3': undefined,
  '4': undefined,
  '5': false }
script=/Users/noah/Projects/my-app/app/node_modules/spacejam/lib/phantomjs-test-in-console.js
spawnArgs: [ '--load-images=no',
  '--ssl-protocol=TLSv1',
  'phantomjs-test-in-console.js' ]
spawnOptions: { cwd: '/Users/noah/Projects/my-app/app/node_modules/spacejam/lib',
  detached: false,
  env:
   { TERM_SESSION_ID: 'w0t0p1:6D33DA9C-73AE-4520-B9AF-A263F8896836',
     SSH_AUTH_SOCK: '/private/tmp/com.apple.launchd.JC8o9ezxw5/Listeners',
     Apple_PubSub_Socket_Render: '/private/tmp/com.apple.launchd.PYSVfq9IQE/Render',
     COLORFGBG: '7;0',
     ITERM_PROFILE: 'Default',
     XPC_FLAGS: '0x0',
     LANG: 'en_US.UTF-8',
     PWD: '/Users/noah/Projects/my-app/app',
     SHELL: '/bin/zsh',
     SECURITYSESSIONID: '186a7',
     TERM_PROGRAM_VERSION: '3.0.4',
     TERM_PROGRAM: 'iTerm.app',
     PATH: '/Users/noah/.nvm/versions/node/v4.2.2/bin:/Users/noah/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/sm/bin:/Users/noah/bin:/Applications/mysql-5.5.27/client',
     COMMAND_MODE: 'unix2003',
     TERM: 'xterm',
     HOME: '/Users/noah',
     TMPDIR: '/var/folders/p4/466pgnmx7sd_2qwwwl2vc33m0000gn/T/',
     USER: 'noah',
     XPC_SERVICE_NAME: '0',
     LOGNAME: 'noah',
     ITERM_SESSION_ID: 'w0t0p1:6D33DA9C-73AE-4520-B9AF-A263F8896836',
     __CF_USER_TEXT_ENCODING: '0x1F5:0x0:0x0',
     SHLVL: '1',
     OLDPWD: '/Users/noah/Projects/my-app/app',
     JAVA_HOME: '/usr',
     NVM_DIR: '/Users/noah/.nvm',
     NVM_NODEJS_ORG_MIRROR: 'https://nodejs.org/dist',
     NVM_IOJS_ORG_MIRROR: 'https://iojs.org/dist',
     MANPATH: '/Users/noah/.nvm/versions/node/v4.2.2/share/man:/usr/local/share/man:/usr/share/man:/Applications/mysql-5.5.27/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man',
     NVM_PATH: '/Users/noah/.nvm/versions/node/v4.2.2/lib/node',
     NVM_BIN: '/Users/noah/.nvm/versions/node/v4.2.2/bin',
     MARKPATH: '/Users/noah/.marks',
     PAGER: 'less',
     LESS: '-R',
     LC_CTYPE: 'en_US.UTF-8',
     LSCOLORS: 'Gxfxcxdxbxegedabagacad',
     DOCKER_HOST: 'tcp://:2376',
     DOCKER_CERT_PATH: '/Users/noah/.docker/machine/machines/dinghy',
     export: '',
     DOCKER_TLS_VERIFY: '1',
     DOCKER_MACHINE_NAME: 'dinghy',
     _: '/Users/noah/Projects/my-app/app/node_modules/spacejam/bin/spacejam',
     ROOT_URL: 'http://localhost:4096/local' } }
ChildProcess.constructor()
ChildProcess.spawn() phantomjs [ '--load-images=no',
  '--ssl-protocol=TLSv1',
  'phantomjs-test-in-console.js' ]
spacejam: spawning phantomjs



phantomjs: Running tests at http://localhost:4096/local using test-in-console
phantomjs: There is no route for the path: /local
    http://localhost:4096/packages/dispatch_mocha-phantomjs.js?hash=c9d8b77a2be80f5c71341225eac2fea43a33dc93: 214



ChildProcess.process.on 'exit': @command=phantomjs @killed=false code=6 signal=null
spacejam: phantomjs exited with code: 6
Meteor.kill() {} @childProcess?= true @mongodb?= true
ChildProcess.kill() signal=SIGTERM @command=meteor @killed=false
spacejam: killing meteor
MeteorMongodb.kill() killed= false
Spacejam.done() { '0': 6 }
Spacejam.done() @meteor?=true
Meteor.hasMongodb()
MeteorMongodb.hasMongodb()
Spacejam.done() @waitForMeteorMongodbKillDone=true
Spacejam.done() waiting for mongodb to exit before calling done
ChildProcess.process.on 'exit': @command=meteor @killed=true code=null signal=SIGTERM
spacejam: meteor killed with signal: SIGTERM
Spacejam.meteor.on 'exit': { '0': null, '1': 'SIGTERM' }
Spacejam.onMeteorMongodbKillDone() 6
spacejam: Unhandled error in meteor client side code. Exiting.
ChildProcess.process.on 'exit': @command=meteor @killed=true code=6
ChildProcess.kill() signal=SIGTERM @command=meteor @killed=true
MeteorMongodb.process.on 'exit': code=6
MeteorMongodb.kill() killed= true
ChildProcess.process.on 'exit': @command=phantomjs @killed=true code=6
ChildProcess.kill() signal=SIGTERM @command=phantomjs @killed=true

Debugging "Unhandled error in meteor client side code. Exiting."

I don't know what to do from there.

I've run spacejam with --loglevel trace but it doesn't provide any useful information.

I've run spacejam with --phantomjs-options="--load-images=no --ssl-protocol=TLSv1 --debug=true" but it shows that the setInterval callaback in the phantomjs-test-in-console.js script is run 6 or 7 times before entering the onError callback.

Please note that tests are running perfectly fine without spacejam with the practicalmeteor:mocha package in the browser

Edit

It's due to a warning Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead. popped by React as an error. In practice, it doesn't prevent the app to work properly, but because of the phantomjs-test-in-console.js script, it's considered as a failure.

PhantomJS dependency is being rate limited by bitbucket

This is a big problem with CI as builds will randomly fail based on phantomjs being installed or not.
Our current workaround is to use our forked spacejam package.

> [email protected] install /home/ubuntu/nvm/v0.10.33/lib/node_modules/spacejam/node_modules/phantomjs
> node install.js

PhantomJS detected, but wrong version 2.1.1 @ /usr/local/bin/phantomjs.
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Receiving...

Error requesting archive.
Status: 403
Request options: {
  "uri": "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2",
  "encoding": null,
  "followRedirect": true,
  "headers": {},
  "strictSSL": true
}
Response headers: {
  "x-amz-request-id": "EF0ED079FB70957F",
  "x-amz-id-2": "E0Nw03P++DfFE5A8NiRlEo5SzRbZaxyO4/Yo6NNR7VIDLGrcHDuplaT0ZU3/65SDTKM5eOK3P+E=",
  "content-type": "application/xml",
  "transfer-encoding": "chunked",
  "date": "Mon, 04 Apr 2016 23:17:23 GMT",
  "server": "AmazonS3"
}

Running `spacejam test-packages --driver-package=practicalmeteor:mocha-console-runner ./` fails

System info:

ProductName: Mac OS X
ProductVersion: 10.11.5

Node v5.5

Details

=> Meteor server restarted
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: killing meteor
path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.dirname (path.js:1324:5)
    at Phantomjs.run (/usr/local/lib/node_modules/spacejam/lib/Phantomjs.js:77:33)
    at Phantomjs.run (/usr/local/lib/node_modules/spacejam/lib/Phantomjs.js:4:61)
    at Spacejam.runPhantom (/usr/local/lib/node_modules/spacejam/lib/Spacejam.js:180:29)
    at Meteor.<anonymous> (/usr/local/lib/node_modules/spacejam/lib/Spacejam.js:115:24)
    at emitNone (events.js:86:13)
    at Meteor.emit (events.js:185:7)
    at Meteor.hasReadyText (/usr/local/lib/node_modules/spacejam/lib/Meteor.js:226:21)
    at Meteor.hasReadyText (/usr/local/lib/node_modules/spacejam/lib/Meteor.js:4:61)

Issue with wrong version of package... Can I enforce a certain version?

Our app works perfectly, and even running spacejam locally doesn't pose a problem.
However, since yesterday, all our automated tests on Circle CI fail:

/home/ubuntu/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
                        throw(ex);
                              ^
 Error: HTTP.methods not implemented on client-side
     at Object.HTTP.methods (packages/cfs_http-methods/http.methods.client.api.js:5:1)
     at [object Object]._.extend._registerHTTPMethod (packages/tap_i18n/lib/tap_i18n/tap_i18n-server.coffee:82:10)
     at packages/tap_i18n/lib/tap_i18n/tap_i18n-common.coffee:39:10
     at /tmp/meteor-test-run1jsjo92/.meteor/local/build/programs/server/boot.js:249:5

Turns out a lot of people were getting this problem at the same time: TAPevents/tap-i18n#160 . Not sure how, since neither tap:i18n nor cfs:http-methods had a recent update, and we're fixing the version of tap:i18n to @1.8.0 throughout our code, and tap:i18n is using cfs:[email protected]. Our own app's versions file has the version set to cfs:[email protected].

So, spacejam is creating a test app for all the packages, right? If so, where can I find its versions file? And how could I enforce a specific version?

Thanks a lot for any help. This is blocking us since all our automated tests are failing...

HTTP.get fails

Steps to reproduce:

git clone [email protected]:MeteorPackaging/isotope.git
cd isotope
git checkout 9e5c89bf0cb29f77c50f6cf94601ed418960d138
cp meteor/package.js .

Output:

$ spacejam test-packages ./
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
I20141129-21:00:50.532(-8)? test-in-console listening
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/ using test-in-console
C: tinytest - Isotope - fitRows : !!!!!!!!! FAIL !!!!!!!!!!!
{"groupPath":["tinytest","Isotope"],"test":"fitRows","events":[{"sequence":0,"type":"fail","details":{"message":"Error getting the test file. Do we have an Internet connection to rawgit.com?"},"cookie":{"name":"Isotope - fitRows","offset":0,"groupPath":["tinytest","Isotope"],"shortName":"fitRows"}}]}
~~~~~~~ THERE ARE FAILURES ~~~~~~~
passed/expected/failed/total 0 / 0 / 1 / 1
##_meteor_magic##state: done
spacejam: phantomjs exited with code: 2
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.