keystonejs / keystone-classic

Node.js CMS and web app framework
http://v4.keystonejs.com
MIT License
14.63k stars 2.2k forks source link

Tests broken out of the box on Windows 10 #3945

Closed OskarKlintrot closed 7 years ago

OskarKlintrot commented 7 years ago

Steps to reproduce the behavior

On Windows 10 PS:

> git clone url/to/keystone
> cd keystone

Add "linebreak-style": 0 to .eslintrc

> npm install
> npm run test-all

Expected behavior

Tests passing

Actual behavior

Tests not passing.


output from PowerShell npm-debug.log

bassjacob commented 7 years ago

I believe the npm run test-all command runs npm run test-e2e-bg which is intended for linux. @webteckie what's the correct way to run this on windows? should we be using cross-env rather than export here?

bassjacob commented 7 years ago

@webteckie the error output complain about the export shell command in the test-e2e-bg command from the package.json

jstockwin commented 7 years ago

@bassjacob If you look at the PowerShell output, the error is to do with the Mocha tests not the e2e tests :)

bassjacob commented 7 years ago

@jstockwin, I don't think so. All the unit tests pass (the printout during the unit test run is console.error output from a model validator).

Line 53 of the output from powershell shows the actual failure:

> keystone@4.0.0-beta.5 test-e2e-bg C:\_repos\keystone
> export KNE_SELENIUM_START_PROCESS=false && node test/e2e/server.js --env default

'export' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test-e2e-bg"
npm ERR! node v6.2.2
npm ERR! npm  v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! keystone@4.0.0-beta.5 test-e2e-bg: `export KNE_SELENIUM_START_PROCESS=false && node test/e2e/server.js --env default`
npm ERR! Exit status 1
jstockwin commented 7 years ago

Ah yeah okay my bad. export works on my (Windows 10) machine... strange. Maybe it's PowerShell.

Running npm test-e2e should work, as it won't export anything. As a fix, cross-env looks good to me.

bassjacob commented 7 years ago

@jstockwin works ok for you running in powershell? or in git-bash or cygwin or another *nix emulator shell?

jstockwin commented 7 years ago

@bassjacob Huh, no it doesn't work in PowerShell OR git bash. I guess I've always just run npm run test-e2e...

bassjacob commented 7 years ago

huh, weird. definitely worth us taking a look if we want people to run it in order to submit a PR.

jstockwin commented 7 years ago

@bassjacob cross-env worked nicely for me. See #3947

OskarKlintrot commented 7 years ago

I still get the Mongoose model 'error' event fired on 'DependsOn' with error-error with the fix from your PR. Otherwise it works just fine.

bassjacob commented 7 years ago

that's ok, it's not an error :smile: there's a couple of tests that assert that mongo will not save an invalid model. since we don't supress output from a console.error call, mongoose prints a "failure" to the terminal, which is exactly what the test expects.

OskarKlintrot commented 7 years ago

I just couldn't understand how all tests could be passing when I clearly could see an error in the log 💡