Spacejam phantomjs no route for the path /local flowrouter

I’m running into issues similar to what’s described in another thread: No route for path error running unit tests

I run into trouble when trying to use spacejam. I’m pasting the terminal session at the end…

Does anyone have some idea as to what could be happening? Thanks :slight_smile:

./node_modules/spacejam/bin/spacejam test --driver-package practicalmeteor:mocha
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: There is no route for the path: /local
    http://localhost:4096/packages/kadira_flow-router.js?hash=09ea12875d3801955ee70797bf8e4a70feebc570: 519
spacejam: phantomjs exited with code: 6
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: Unhandled error in meteor client side code. Exiting.
1 Like

Hello @meteoraccount try this

First: meteor add practicalmeteor:mocha-console-runner

To run the tests:
spacejam test --driver-package practicalmeteor:mocha-console-runner

Thanks for your reply @jsep :smiley:

I still can’t get it to work. This is what I’m doing:

  1. At the top of my meteor project’s file hierarchy, I’m running the following…

     meteor add practicalmeteor:mocha-console-runner
     meteor npm install spacejam
    
  2. For the spacejam invocation, I’m running the following at the top of my meteor project’s file hierarchy…

     ./node_modules/spacejam/bin/spacejam test --driver-package practicalmeteor:mocha-console-runner
    
  3. The node executable for the hashbang of node_modules/spacejam/bin/spacejam is provided by nvm…

     which node
     /home/user/.nvm/versions/node/v6.2.1/bin/node
    

In the end, I get the same error…

./node_modules/spacejam/bin/spacejam test --driver-package practicalmeteor:mocha-console-runner
(node:5904) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
spacejam: meteor mongodb is ready
=> Meteor 1.3.4.1 is available. Update this project with 'meteor update'.
I20160701-13:10:35.023(-5)? import complete
=> 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: There is no route for the path: /local
    http://localhost:4096/packages/kadira_flow-router.js?hash=09ea12875d3801955ee70797bf8e4a70feebc570: 519
spacejam: phantomjs exited with code: 6
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: Unhandled error in meteor client side code. Exiting.

Hi, i getting the same error in here. But in my case, i’m trying export a report, with the

practicalmeteor:/meteor-mocha-xunit-reporter

@jsep already try to help me, but the error persists.
He told me to try:

FlowRouter.route('/xunit', {
    action: function(params, queryParams) {
        console.log("XUnit reporter");
    }
});

But no success. I wondering if, have some way to make kadira_flw-router ignore the route. Any help will be nice.

hi @meteoraccount,

With the help of @jsep i make things work here.
But in my case a have a public route.js file.
And i create two empty files tests.js and tests.index, put then in my
public folder template. And here is how the code of my public route:

route.js

import { FlowRouter } from 'meteor/kadira:flow-router';

import '../../../ui/public/tests.js';

const publicRedirect = (context, redirect) => {
  if (Meteor.userId()) {
    redirect('index');
  }
};

const tests = FlowRouter.group({
    name: 'xunit',
    triggersEnter: [publicRedirect],
});

tests.route('/xunit', {
  name: 'xunit',
  triggersEnter: [publicRedirect],
});

To run i use

spacejam test --driver-package=practicalmeteor:mocha-xunit-reporter --xunit-out file.xml

And now he created this file.xml in the root direct of the project.
A hope this can help you in some way.
Cheers.

Hi @mlpinheiro - I couldn’t get your solution to work but I’m not sure I’m following your instructions correctly.

Could you post a forked meteor-todos repo with your changes?

Thx!

1 Like

Hi @noahsw, sorry for the late response, i move to another project and got a lot busy. My solution did not work wll, i talk to a friend and we agree that the best way to deal with this is removing the Kadira from the package files from Meteor, when i will run the tests and generate the report. So before my tests run, i remove all pakcages from kadira, with Meteor Remove. But this works for us, because our tests run in a jenkins slave, so we don’t use this package in our tests ( for now lol).
Hope this help you guys.
Sorry for the english.

Ia this seriously the state of our testing?

really enjoyed the testing experience until trying to set this up on a CI server and needing a console reporter.

Anyone know how we tackle this?

Take a look at dispatch:mocha https://github.com/DispatchMe/meteor-mocha there has been a serious refactor recently. I’m running server and client tests successfully on circelci. Use the nightmare/electron option, instead of phantomjs.

It’s a flow:router issue, as far as I could understand it… https://github.com/kadirahq/flow-router/pull/615

There’s a flow:router fork that might be useful… https://github.com/serut/flow-router

Good luck! :slight_smile:

thanks, got this running using phantom and dispatch:mocha on circle, but phantom fails on OSX, @meteoraccount - I tried to use the flow router fork to no avail unfortunately.

so I’m reporting with practiclemeteor:mocha on localhost and dispatch:mocha on circle. Which is fine because I like the browser reporter, but would love to have the console tests run on a pre-commit hook, so will definately give nightmare a try.

Keen to give nightmare/electron a go, looks like a great project. just now getting chimp setup for the first time.

@lpgeiger @meteoraccount I appreciate the help.

@pushplaybang: can you give an update if you go things running on CI?

I just stumbled upon the same problems using practicalmeteor:mocha-xunit-reporter and would be thankful for some tips

I have indeed. I’m using spacejam and the mocha console reporter for ci, which I have running under OSX as well.

Theres quite a lot of moving parts to get testing setup for meteor, especially if you’re going to do unit, feature, and acceptance tests, as well as get it running on CI.

The Todo’s project as a good source of inspiration, I haven’t played with too many of the other reporters though.

I have landed up using my own local version of flow-router, the forked version isn’t a complete fix, the check for test mode needs to check for appTest as well

// on line 347 in flow-router/client/router.js the condition should be
(!Meteor.isTest && !Meteor.isAppTest && !Meteor.isPackageTest)

some weirdness with package versions / conflicts - here are the test packages I’m using

practicalmeteor:mocha-console-runner  
practicalmeteor:mocha                 
practicalmeteor:chai                  
practicalmeteor:sinon                 
velocity:meteor-stubs                 
hwillson:stub-collections             
johanbrook:publication-collector      
dburles:factory                       
pushplaybang:backdoor-testonly        
pushplaybang:email-stub-redux         
tmeasday:acceptance-test-driver       
lmieulet:meteor-coverage              

some weirdness with phantom - make sure you’re using phantom-prebuilt^2.1.14

I’ve put a lot of the commands into bash scripts, here how I’m running these tests

# unit tests
cd app/ && spacejam test --settings settings/settings-test.json --driver-package practicalmeteor:mocha-console-runner --port 7357

# integration tests
cd app/ && spacejam test --full-app --once --settings settings/settings-test.json --driver-package practicalmeteor:mocha-console-runner --port 7357

For the acceptance tests I followed the todo project, and used their scripts as a starting point, which I’d highly recommend.

1 Like

@pushplaybang: Thanks a lot for the very detailed info. :slight_smile: So concerning unit-tests you got the standard “spec” reporter running? With chimp I had great luck with mocha-circleci-reporter which gives a much nicer output by combining spec+junit-outputs.

Right now I am quite close to getting dispatch:mocha running, BUT if I don’t get it to work I’ll soon try your solution. Is your FlowRouter Fork public?

BTW: This Flow-Router stuff feels really shitty… I hope that there will be an agreement on WHO is the NEW FlowRouter (Flow Router is dead. Long live Flow Router).

Yeah I had a look at circleCi reporter, let me know if you get that running, I didn’t win, but didn’t try that hard. and would love better output on circle.

After using dispatch mocha for a while, I’d highly recommend switching to practicalmeteor:mocha-console-runner but dispatch worked fine as well.

Yeah the flow router thing is shitty, quite bleak about it, haven’t made the fork public, as I didn’t want to add to the noise right now, really hope MDG step up on this, its a critical component for any app, and if you’re not using react your options are limited.

@pushplaybang: I tried hard and finally got it running. Check it out and have some fun with it Enhanced, but simply-stupid CircleCi setup that first runs UNIT-INTEGRATION-tests and then CHIMP-ACCEPTANCE tests?

If somebody still stumbles over this issue, here’s a PR that should fix it including a work-around I proposed: