Path Issues for "Cypress Run"

Viewed 2986

I'm making good progress with Cypress but come a bit unstuck when trying to call a single Spec.

The line in package.json look like:

  "cypress:runST": "cypress run --spec'/cypress/integration/02_DBM_H1_ST_spec.js'",

I start this with npm run cypress:runST...errors!

Even if I try running this as:

`npm run cypress run --spec '/cypress/integration/02_DBM_H1_ST_spec.js'

I still get errors:

Can't run because no spec files were found.

We searched for any files matching this glob pattern:

'\cypress\integration\02_DBM_H1_ST_spec.js'    

and from NPM Logs:

10 silly lifecycle cypress_research@1.0.0~cypress:runST: Args: [ '/d /s /c',
10 silly lifecycle   'cypress run --spec \'/cypress/integration/02_DBM_H1_ST_spec.js\'' ]
11 silly lifecycle cypress_research@1.0.0~cypress:runST: Returned: code: 1  signal: null
12 info lifecycle cypress_research@1.0.0~cypress:runST: Failed to exec cypress:runST script

I have a feeling it's the syntax in the command but then again if that was the case it would run 'bare'..but I get the same error. No idea where the '\' afer spec and after .js come from.

Any ideas please? Thanks

2 Answers

Assuming package.json is at the same level as the cypress folder, this should work

"cypress:runST": "cypress run --spec cypress/integration/02_DBM_H1_ST_spec.js",

From windows command prompt, cd to the cypress folder. Then please try running the command like below;

cypress run --spec cypress/integration/02_DBM_H1_ST_spec.js

The screenshot below, refer to an example of my test-spec.js run from the command prompt

enter image description here

Related