I am currently working through this AngularJS tutorial (https://docs.angularjs.org/tutorial/) and have encountered an interesting problem when attempting to run unit tests using 'npm test'. This is described at step 2 of the tutorial (https://docs.angularjs.org/tutorial/step_02).
My setup is as follows:
- host machine is Windows 10
- running a vagrant homestead box (https://laravel.com/docs/4.2/homestead)
- use Putty to ssh into my box, e.g. to install npm
- use mapped/shared vagrant folders to do coding in my Win10 environment
- use Firefox/Chrome on host machine to view website (http://192.168.10.10/angular-phonecat/app/)
Problem: The tutorial discusses unit tests and says to execute these with 'npm test' command. This will trigger the opening of either the Chrome or Firefx browser and then run the tests. So far so good. But: when I run the 'npm test' command in my Putty ssh shell, there is (obviously) no Chrome or FF browser window that can be opened. Hence, I get this error:
vagrant@homestead:~/Code/angular-phonecat$ npm test
> angular-phonecat@0.0.0 pretest /home/vagrant/Code/angular-phonecat
> npm install
npm WARN install:nopt@3.0.6 EPROTO: protocol error, symlink '../nopt/bin/nopt.js' -> '/home/vagrant/Code/angular-phonecat/node_modules/.bin/nopt'
> angular-phonecat@0.0.0 postinstall /home/vagrant/Code/angular-phonecat
> bower install
> angular-phonecat@0.0.0 test /home/vagrant/Code/angular-phonecat
> node node_modules/karma/bin/karma start test/karma.conf.js
INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
ERROR [launcher]: No binary for Chrome browser on your platform.
Please, set "CHROME_BIN" env variable.
INFO [launcher]: Starting browser Firefox
ERROR [launcher]: Cannot start Firefox
INFO [launcher]: Trying to start Firefox again (1/2).
ERROR [launcher]: Cannot start Firefox
INFO [launcher]: Trying to start Firefox again (2/2).
ERROR [launcher]: Cannot start Firefox
ERROR [launcher]: Firefox failed 2 times (cannot start). Giving up.
Note that this is not the same as the types of problems reported in these posts:
Setting environment variable for CHROME_BIN does not work
How to fix error "Please set env variable CHROME_BIN" when running Angular.js with grunt
These posts (and there may be others) assume that the npm test tool (Karma?) is used on a Windows machine, which has Chrome and FF installed. But I am remotely logging on to a Ubuntu machine, which has FF installed and the FIREFOX_BIN environment variable set correctly (/usr/bin/firefox), but cannot open a visual windows because I am looged on through a commnd line shell.
So, my question is: how can I use npm test (or Karma) to run my unit tests using the setup described above?
Unfortunately I don't know how to ask my question or state the problem any better than this, so if you need any other details to help me, please let me know.
Thanks AHL