Reputation: 1537
I'm doing a cypress 6+ training course and I'm trying to run a Jenkins pipeline using docker. My terminal displayed the following message. I'm trying to figure out how to fix this.
{
"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
}
There appeared to be an issue with the package json so I took a look at it. I honestly can't see what the problem is and would love another pair of eyes to take a look.
{
"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": ""
}
Upvotes: 0
Views: 1175
Reputation: 1537
Ok, I figured out what went wrong. I copied the file from another file and I hadn't created a NEW package.json file. So When I saved the file the package.json was for the original file and did not reflect the changes in the NEW file. So cypress was confused as to what was happening.
Then, I created a new package.json file it contained the correct information, I added the commands to run the cypress scripts (headed, Chrome and Docker). Saved it, restarted VS code and the error went away.
I also modified Build and test. So the code now reads in the package.json
"build:and:test": "npm run start-server-and-test start https://react-redux.realworld.io/ cy:run"
Just getting it double checked that the command is right.
Upvotes: 0
Reputation: 19
You need to updated the script 'build:and:test', I see issue with launch cypress - the correct command should be
npm run cy:run
Please share the link to course
Upvotes: 1