簡體   English   中英

賽普拉斯采用 Docker 和 Jenkins 流水線。 字符串不匹配模式錯誤信息

[英]Cypress with Docker and Jenkins pipeline. String does not match pattern error message

我正在參加 cypress 6+ 培訓課程,並且正在嘗試使用 docker 運行 Jenkins 管道。 我的終端顯示以下消息。 我試圖弄清楚如何解決這個問題。

{
    "resource": "/Users/xxx/Documents/CypressDocker_JenkinsPipeline/package.json",
    "owner": "_generated_diagnostic_collection_name_#2",
    "severity": 4,
    "message": "String does not match the pattern of \"^(?:@[a-z0-9-*~][a-z0-9-*._~]*/)?[a-z0-9-~][a-z0-9-._~]*$\".",
    "startLineNumber": 2,
    "startColumn": 11,
    "endLineNumber": 2,
    "endColumn": 26
}

package json 似乎有問題,所以我看了一下。 老實說,我看不出問題出在哪里,我很想用另一雙眼睛看一看。

    {
  "name": "CypressDocker_JenkinsPipeline",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "cypress run",
    "headTest": "npm run test -- --headed ",
    "choromeTest": "npm run test -- --browser chrome ",
    "build:and:test": "npm run cy:run start-server-and-test start https://react-redux.realworld.io/ cy:run"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "cypress": "^7.1.0"
  },
  "devDependencies": {},
  "description": ""
}

您需要更新腳本'build:and:test',我看到啟動 cypress 的問題 - 正確的命令應該是

npm run cy:run

請分享課程鏈接

好的,我知道出了什么問題。 我從另一個文件復制了該文件,但沒有創建新的 package.json 文件。 因此,當我保存文件時,package.json 用於原始文件,並未反映新文件中的更改。 所以賽普拉斯對發生的事情感到困惑。

然后,我創建了一個新的 package.json 文件,其中包含正確的信息,我添加了運行 cypress 腳本的命令(標題為 Chrome 和 Docker)。 保存它,重新啟動 VS 代碼,錯誤就消失了。

我還修改了構建和測試。 所以代碼現在讀入 package.json

"build:and:test": "npm run start-server-and-test start https://react-redux.realworld.io/ cy:run"

只是讓它仔細檢查命令是否正確。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM