CKA*_*CKA 8 https webpack-dev-server create-react-app cypress
我正在使用 create-react-app 并在 https 中运行我的开发 webpack 服务器。所以运行 npm run cypress:open,我期望
仅发生了第一步,cypress 启动器未打开。
这是我在 package.json 中的脚本配置。
"scripts": {
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
"start-js": "export HTTPS=true&&react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"cy:open": "cypress open",
"cypress:open": "start-server-and-test start http-get://localhost:3000 cy:open"
}
Run Code Online (Sandbox Code Playgroud)
我只遇到 https 问题,而不是 http 问题。
如果您使用 HTTPS 运行应用程序并且您的证书无效,您可以添加START_SERVER_AND_TEST_INSECURE=1
为环境变量。
"scripts": {
"cypress:open": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start https-get://localhost:3000 cy:open"
}
Run Code Online (Sandbox Code Playgroud)
https://github.com/bahmutov/start-server-and-test#disable-https-certificate-checks
您正在使用http-get
,但您可能需要使用,https-get
因为您使用的是 HTTPS,而不是 HTTP。
在你的 package.json 中,它应该如下所示:
{
"scripts": {
"cypress:open": "start-server-and-test start https-get://localhost:3000 cy:open"
}
}
Run Code Online (Sandbox Code Playgroud)
您可以查看wait-on
使用文档以获取更多信息(start-server-and-test
基于wait-on
)
归档时间: |
|
查看次数: |
6601 次 |
最近记录: |