启动服务器并测试“服务器意外关闭”

时间:2020-04-22 20:42:09

标签: node.js azure cypress

我正在使用start-server-and-test package在Azure管道上启动服务器以运行Cypress。

这是我用来启动所有内容的yarn命令:yarn cy:build:workspace

“ cy:build:workspace”:“纱线cy:clean &&启动服务器并测试开始http://localhost:8080 cy:run:workspace”

我正在Azure环境中运行NODE_VERSION:“ 12.10.0”。

"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a\_temp\ce28689e-eef6-4eeb-bad2-82310f748e1b.cmd""
yarn run v1.22.4
$ yarn cy:clean && start-server-and-test start http://localhost:3000 cy:run:workspace
$ rimraf cypress/reports/*
1: starting server using command "npm run start"
and when url "[ 'http://localhost:3000' ]" is responding with HTTP status code 200
running tests using command "npm run cy:run:workspace"


> @someProjectsbs/suite-packages@0.1.1 start D:\a\1\s
> lerna exec --scope=@someProjectsbs/suite -- yarn start --all-apps

lerna notice cli v3.20.2
lerna info ci enabled
lerna notice filter including "@someProjectsbs/suite"
lerna info filter [ '@someProjectsbs/suite' ]
lerna info Executing command in 1 package: "yarn start --all-apps"
$ cross-env react-app-rewired start --extended-linting --all-apps
[]
[info] [webpackbar] Compiling @someProjectsbs/suite
(node:4672) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
i 「wds」: Project is running at http://192.168.0.100/
i 「wds」: webpack output is served from 
i 「wds」: Content not from webpack is served from D:\a\1\s\packages\app\suite\public
i 「wds」: 404s will fallback to /
Starting the development server...

lerna success exec Executed command in 1 package: "yarn start --all-apps"
Error: server closed unexpectedly
    at ChildProcess.onClose (D:\a\1\s\node_modules\start-server-and-test\src\index.js:69:14)
    at ChildProcess.emit (events.js:209:13)
    at ChildProcess.cp.emit (D:\a\1\s\node_modules\start-server-and-test\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
##[error]Cmd.exe exited with code '1'.
Finishing: Run Cypress testsk

我在本地运行着所有东西,关于服务器为何在Azure环境中停止的任何建议?

3 个答案:

答案 0 :(得分:5)

如果使用的是“反应脚本”,请检查package.json:将“ 3.4.1”降级为3.4.0

还要验证此链接以对纱线使用启动服务器并进行测试,您需要像一些字符串一样添加一些纱线命令https://github.com/bahmutov/start-server-and-test#note-for-yarn-users

答案 1 :(得分:0)

我遇到了同样的问题,但是转到wait-on可以解决这个问题

https://docs.cypress.io/guides/guides/continuous-integration.html#Boot-your-server

答案 2 :(得分:0)