practicalmeteor/spacejam

spacejam not working with test-packages Meteor 1.3.4

Closed this issue · 1 comments

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.

Finally after marking all my scripts as server side:

api.mainModule('meteor-plivo-tests.js', 'server');

I was able to make them work:

spacejam test-packages --driver-package=practicalmeteor:mocha-console-runner ./ --settings ./dummy-settings.json
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
I20160705-03:10:37.136(-3)? MochaRunner.runServerTests: Starting server side tests with run id zLQ6D8sPKMDitvTiq
W20160705-03:10:37.202(-3)? (STDERR) MochaRunner.runServerTests: failures: 0
S: Meteor Plivo Tests Package : passed


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

spacejam: phantomjs exited with code: 0
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: All tests have passed. Exiting.

This is the Build Passing:
Passing