-
Notifications
You must be signed in to change notification settings - Fork 129
feat: Have only 1 spec arg. Allow glob patterns in the list. #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bvandercar-vt
wants to merge
4
commits into
tnicola:master
Choose a base branch
from
bvandercar-vt:refactor/only-1-spec-arg
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,13 @@ Reduce up to 40% your Cypress suite execution time parallelizing the test run on | |
## Install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just copied this from |
||
|
||
``` | ||
npm i cypress-parallel | ||
npm i cypress-parallel -D | ||
``` | ||
|
||
or | ||
|
||
``` | ||
yarn add cypress-parallel | ||
yarn add cypress-parallel -D | ||
``` | ||
|
||
## Add a new script | ||
|
@@ -40,7 +40,7 @@ In your `package.json` add a new script: | |
"scripts" :{ | ||
... | ||
"cy:run": "cypress run", // It can be any cypress command with any argument | ||
"cy:parallel" : "cypress-parallel -s cy:run -t 2 -d <your-cypress-specs-folder> -a '\"<your-cypress-cmd-args>\"'" | ||
"cy:parallel" : "cypress-parallel -s cy:run -t 2 --spec '<your-cypress-specs-folder(s)-or-file(s)>' -a '\"<your-cypress-cmd-args>\"'" | ||
... | ||
} | ||
``` | ||
|
@@ -64,26 +64,32 @@ or | |
Run with npx (no package installation needed) | ||
|
||
``` | ||
npx cy:parallel -s cy:run -t 2 -d <your-cypress-specs-folder> -a '\"<your-cypress-cmd-args>\"' | ||
npx cy:parallel -s cy:run -t 2 --spec '<your-cypress-specs-folder(s)-or-file(s)>' -a '"<your-cypress-cmd-args>"' | ||
``` | ||
|
||
## Passing Multiple Specs | ||
|
||
``` | ||
cypress-parallel -s cy:run -t 2 -a '\"<your-cypress-cmd-args>\"' --spec path/to/spec1.spec.js path/to/spec2.spec.js path/to/more/specs/**/*.js | ||
``` | ||
|
||
### Scripts options | ||
|
||
| Option | Alias | Description | Type | | ||
| ----------------- | ----- | ---------------------------------- | ------ | | ||
| --help | | Show help | | | ||
| --version | | Show version number | | | ||
| --script | -s | Your npm Cypress command | string | | ||
| --args | -a | Your npm Cypress command arguments | string | | ||
| --threads | -t | Number of threads | number | | ||
| --specsDir | -d | Cypress specs directory | string | | ||
| --weightsJson | -w | Parallel weights json file | string | | ||
| --reporter | -r | Reporter to pass to Cypress. | string | | ||
| --reporterOptions | -o | Reporter options | string | | ||
| --reporterModulePath | -n | Specify the reporter module path | string | | ||
| --bail | -b | Exit on first failing thread | string | | ||
| --verbose | -v | Some additional logging | string | | ||
| --strictMode | -m | Add stricter checks after running the tests | boolean | | ||
| Option | Alias | Description | Type | | ||
| -------------------- | ----- | --------------------------------------------------------------------- | ------- | | ||
| --help | | Show help | | | ||
| --version | | Show version number | | | ||
| --script | -s | Your npm Cypress command | string | | ||
| --args | -a | Your npm Cypress command arguments | string | | ||
| --threads | -t | Number of threads | number | | ||
| --spec | -d | Cypress spec file path(s), or glob pattern(s). Can be one, or a list. | string | | ||
| --weightsJson | -w | Parallel weights json file | string | | ||
| --reporter | -r | Reporter to pass to Cypress. | string | | ||
| --reporterOptions | -o | Reporter options | string | | ||
| --reporterModulePath | -n | Specify the reporter module path | string | | ||
| --bail | -b | Exit on first failing thread | string | | ||
| --verbose | -v | Some additional logging | string | | ||
| --strictMode | -m | Add stricter checks after running the tests | boolean | | ||
|
||
**NB**: If you use *cypress-cucumber-preprocesor*, please **disable** the *strictMode* to avoid possible errors: | ||
|
||
|
@@ -105,10 +111,21 @@ npx cy:parallel -s cy:run -t 2 -d <your-cypress-specs-folder> -a '\"<your-cypres | |
} | ||
``` | ||
|
||
## Env variables | ||
|
||
### CYPRESS_THREAD | ||
|
||
You can get the current thread index by reading the `CYPRESS_THREAD` variable. | ||
|
||
```javascript | ||
const threadIndex = process.env.CYPRESS_THREAD; | ||
// return 1, 2, 3, 4, ... | ||
``` | ||
|
||
# Contributors | ||
|
||
Looking for contributors. | ||
|
||
# License | ||
|
||
MIT | ||
This project is licensed under the MIT license. See [LICENSE](LICENSE). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-d
still totally works just the same, not broken with this change!--spec
just makes more sense to recommend, because it can now be a dir or a file or a glob.