start-server-and-test
start-server-and-test copied to clipboard
Unable to run with serve npm package
Hi, with the following configuration, start-server-and-test isn't able to run (maybe even parse arguments).
"scripts": {
"dev": "cross-env NODE_ENV=development webpack",
"build": "cross-env NODE_ENV=production webpack --env production",
"serve": "webpack serve",
"start": "serve -l 8080 ./public",
"test": "jest",
"coverage": "jest --coverage --coverageReporters=cobertura",
"cypress": "cypress open",
"lint": "tsc --noEmit && eslint src/**/*.{ts,tsx,js,jsx} --fix",
"ci": "start-test 'yarn run start' 8080 './node_modules/.bin/cypress run'"
},
- version: 1.11.7, node: v14.15.1, yarn: 1.22.10
- platform: Windows 10,
- expected behaviour: Application is started and cypress runs tests.
- actual behaviour: The following error is shown.
Error: expected <NPM script name that starts server> <url or port> <NPM script name that runs tests>
example: start-test start 8080 test
see https://github.com/bahmutov/start-server-and-test#use
at lazyAssLogic (C:\Projects\React Starter\node_modules\lazy-ass\index.js:110:14)
at lazyAss (C:\Projects\React Starter\node_modules\lazy-ass\index.js:115:28)
at Object.getArguments (C:\Projects\React Starter\node_modules\start-server-and-test\src\utils.js:51:5)
at Object.<anonymous> (C:\Projects\React Starter\node_modules\start-server-and-test\src\bin\start.js:10:22)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
error Command failed with exit code 1.
I needed to change the single quotes to double quotes for this to work on my windows machine. (single quotes worked fine on OSX)
e.g.
"ci": "start-test \"yarn run start\" 8080 \"./node_modules/.bin/cypress run\""