bahmutov / start-server-and-test

Starts server, waits for URL, then runs test command; when the tests end, shuts down server
MIT License
1.54k stars 96 forks source link

Unable to run with serve npm package #293

Open Sebosek opened 3 years ago

Sebosek commented 3 years ago

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'"
  },
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.
snapwich commented 3 years ago

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\""

revelt commented 3 months ago

@Sebosek if switching to double quotes helped, please close this issue