Add 'slow' option to configure slow test threshold

This commit is contained in:
BlueWinds
2021-10-05 14:38:28 -07:00
parent b898d11afe
commit 1ff421fc71
13 changed files with 66 additions and 14 deletions

View File

@@ -125,6 +125,7 @@ const descriptions = {
record: 'records the run. sends test results, screenshots and videos to your Cypress Dashboard.',
reporter: 'runs a specific mocha reporter. pass a path to use a custom reporter. defaults to "spec"',
reporterOptions: 'options for the mocha reporter. defaults to "null"',
slow: '"slow" test threshold in milliseconds. defaults to 5000',
spec: 'runs specific spec file(s). defaults to "all"',
tag: 'named tag(s) for recorded runs in the Cypress Dashboard',
version: 'prints Cypress version',
@@ -264,6 +265,7 @@ const addCypressRunCommand = (program) => {
.option('-r, --reporter <reporter>', text('reporter'))
.option('-o, --reporter-options <reporter-options>', text('reporterOptions'))
.option('-s, --spec <spec>', text('spec'))
.option('-S, --slow <milliseconds>', text('slow'))
.option('-t, --tag <tag>', text('tag'))
.option('--dev', text('dev'), coerceFalse)
}
@@ -451,6 +453,7 @@ module.exports = {
.option('-r, --reporter <reporter>', text('reporter'))
.option('-o, --reporter-options <reporter-options>', text('reporterOptions'))
.option('-s, --spec <spec>', text('spec'))
.option('-S, --slow <milliseconds>', text('slow'))
.option('-t, --tag <tag>', text('tag'))
.option('--dev', text('dev'), coerceFalse)
.action((opts) => {

View File

@@ -128,6 +128,10 @@ const processRunOptions = (options = {}) => {
args.push('--reporter-options', options.reporterOptions)
}
if (options.slow) {
args.push('--slow', options.slow)
}
// if we have specific spec(s) push that into the args
if (options.spec) {
args.push('--spec', options.spec)

View File

@@ -220,6 +220,7 @@ const parseOpts = (opts) => {
'reporterOptions',
'record',
'runProject',
'slow',
'spec',
'tag')

View File

@@ -44,6 +44,11 @@
"default": null,
"description": "The reporter options used. Supported options depend on the reporter. See https://on.cypress.io/reporters#Reporter-Options"
},
"slow": {
"type": "number",
"default": 5000,
"description": "Slow test timeout passed to mocha. See See https://on.cypress.io/configuration#Global"
},
"testFiles": {
"type": [
"string",

View File

@@ -91,6 +91,10 @@ declare namespace CypressCommandLine {
* Specify mocha reporter options
*/
reporterOptions: any
/**
* Specify a slow test threshold in milliseconds
*/
slow: number
/**
* Specify the specs to run
*/

View File

@@ -2572,6 +2572,11 @@ declare namespace Cypress {
* @default "spec"
*/
reporterOptions: { [key: string]: any }
/**
* A slow test threshold in milliseconds
* @default 5000
*/
slow: number | null
/**
* Whether Cypress will watch and restart tests on test file changes
* @default true