Open markafitzgerald1 opened 6 years ago
To elaborate on #32: both gulp-nightwatch
and now gulp-gh-pages
had bugs not present in the underlying or alternative Gulp-free dependencies.
Non-Gulp lint
script
added to issue-51-replace-gulp-with-npm-scripts branch in b7f219a9b4a3c8743e9231d562921045a5cd4b39.
Trying to get webpack
working outside of Gulp now. ./node_modules/.bin/webpack
gives the rather cryptic error ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Users\Mark\Documents\Code\Git repositories\cribbage-analyst'
. Cause: src/index.js
does not exist! (Current default Webpack entry point of this project used by Gulp is src/cribbageAnalyst.js
!) Note this en route to adding Webpack to npm
scripts
.
./node_modules/.bin/webpack src/cribbageAnalyst.js --output dist/cribbageAnalyst.bundle.js --output-library cribbageAnalyst
, aside from a warning about incomplete configuration, seems to yield a bundle which does the same thing as the gulp-generated one. Just need to resolve that warning before having webpack
in npm scripts
.
./node_modules/.bin/webpack src/cribbageAnalyst.js --mode=development --output dist/cribbageAnalyst.bundle.js --output-library cribbageAnalyst
resolves the webpack warning and yields a nearly identical in size (within 1%) to the Gulp webpack produced bundle. Likely the existing Gulp set-up was outputting a development
mode bundle as well, or no production
mode existed when I set up webpack in this project about 2 years ago.
Just need to have a way for Travis CI deploy to deploy a production mode bundle to make this solution ideal for shipping.
Can address eventual Travis CI need to deploy a production bundle via separate npm
scripts
to create a production bundle and copy static resources to the same dist/production
folder for deploy by Travis CI. Not necessary in this Issue - take care of in #71 instead.
webpack
script added. Remaining to be done: clean
, copy
, start
, coverage
, deploy
.
copy
and related dist
(build
then webpack
in parallel with copy
) added; clean
, start
, coverage
and deploy
remain to be done.
Added npm
clean
script in 116eb06. Only start
, coverage
and deploy
remain to be done.
npm start
script added; coverage
and deploy
remain to be done, then convert of Travis CI to use npm
scripts
, and finally removal of Gulpfile and dependencies creating so many deprecation warnings. :)
Discovered that src/cribbageAnalyst.js
has no unit or integration test coverage - added a bit but put rest in #73 as it isn't essential to the resolution of this issue.
nyc
coverage reporting and calculation added to all test*
npm
scripts
; only deploy
needs to be added before moving Travis CI over to npm
scripts
and removing gulpfile.js
and the project's Gulp and (many) Gulp plugin dependencies.
Oops: nightwatch
also needs porting from Gulp to npm scripts
in addition to and before deploy
. (Then can move Travis CI from Gulp to npm scripts
and remove Gulp.)
./node_modules/.bin/nightwatch
set up and working locally using nightwatch
from npm
but npm script
"test-end-to-end": "nightwatch"
timing out with Error retrieving a new session from the selenium server
... Connection refused! Is selenium server started?
Needs more investigation before ready to commit and push.
It appears that chromedriver
does not start when nightwatch
is run via an npm
scripts
script. chromedriver
is on my PATH
so should be found. Try removing from PATH
to see if ./node_modules/.bin/nightwatch
command starts failing. Try also changing script from nightwatch
to node_modules/.bin/nightwatch
or ./node_modules/.bin/nightwatch
to see if that helps it find chromedriver
when run via npm run
. Perhaps one of these test angles will lead to a resolution of this issue running Nightwatch from npm
script.
Removing chromedriver
from PATH
results in the same error in both Git Bash and cmd
(on Windows 10) when running ./node_modules/.bin/nightwatch
: Error retrieving a new session from the selenium server
... Connection refused! Is selenium server started?
Changing the test-end-to-end
script value from nightwatch
to node_modules/.bin/nightwatch
and then ./node_modules/.bin/nightwatch
did not change the result of running npm run test-end-to-end
: the same error retrieving a new session from the selenium server
still shows up after about 20 seconds.
The additional error details differ between the npm
scripts
run of nightwatch
with chromedriver
on PATH
and the command-line run of nightwatch
with chromedriver
not on PATH
.
Former (after a 20 second delay):
C:\Users\Mark\Documents\Code\Git repositories\cribbage-analyst>npm run test-end-to-end
> cribbage-analyst@0.2.3 test-end-to-end C:\Users\Mark\Documents\Code\Git repositories\cribbage-analyst
> nightwatch
Starting selenium server... started - PID: 28704
[Cribbage Analyst End To End Test] Test Suite
=================================================
Running: hand with fifteens and pairs points
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ value:
{ message:
'Timed out waiting for driver server to start.\nBuild info: version: \'3.14.0\', revision: \'aacccce0\', time: \'2018-08-02T20:13:22.693Z\'\nSystem info: host: \'FITZGERALD-ENVY\', ip: \'169.254.233.113\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'9.0.1\'\nDriver info: driver.version: unknown',
error: 'unknown error' },
status: 13 }
Latter (after a less than 1 second delay):
C:\Users\Mark\Documents\Code\Git repositories\cribbage-analyst>.\node_modules\.bin\nightwatch
Starting selenium server... started - PID: 25944
[Cribbage Analyst End To End Test] Test Suite
=================================================
Running: hand with fifteens and pairs points
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ value:
{ message:
'Unable to create new service: ChromeDriverService\nBuild info: version: \'3.14.0\', revision: \'aacccce0\', time: \'2018-08-02T20:13:22.693Z\'\nSystem info: host: \'FITZGERALD-ENVY\', ip: \'169.254.233.113\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'9.0.1\'\nDriver info: driver.version: unknown',
error: 'session not created' },
status: 33 }
That said, chromedriver
is not starting up in either of the above scenarios. chromedriver
does start up as a child process of java -jar selenium-server-standalone-3.14.0.jar
when executing ./node_modules/.bin/nightwatch
, which in turn runs the end to end tests successfully.
Running nightwatch
via absolute file system path from the command line also succeeds.
Next idea: try upgrading chromedriver
and/or selenium
to the latest compatible version pair.
Update of chromedriver
and selenium-server-standalone-jar
to latest versions (2.43.3 and 3.141.5, respectively) did not change anything: command-line invocation of ./node_modules/.bin/nightwatch
works but execution of same via npm
scripts
run
fails via timeout and non-start of chromedriver
.
Gulp plugins add extra complexity and dependency/version tracking/debugging issues as witnessed in #32. See https://medium.freecodecamp.org/why-i-left-gulp-and-grunt-for-npm-scripts-3d6853dd22b8 for ideas on how to proceed with cross-platform support - the main reason I adopted Gulp over npm scripts.