mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-29 19:41:16 -05:00
Revert "Throw error on this.slow() informing users about slowTestThreshold inside tests, hooks and suites."
This reverts commit 1496833756.
This commit is contained in:
@@ -892,11 +892,6 @@ export default {
|
||||
|
||||
https://on.cypress.io/test-retries
|
||||
`,
|
||||
manually_set_slow: stripIndent`\
|
||||
Mocha \`this.slow()\` syntax is not supported.
|
||||
|
||||
The slow threshold can only be configured globally by \`slowTestThreshold\`. See https://on.cypress.io/configuration#Global
|
||||
`,
|
||||
hook_registered_late: stripIndent`\
|
||||
Cypress detected you registered a(n) \`{{hookTitle}}\` hook while a test was running (possibly a hook nested inside another hook). All hooks must be registered before a test begins executing.
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@ const suiteAddTest = Suite.prototype.addTest
|
||||
const suiteAddSuite = Suite.prototype.addSuite
|
||||
const suiteRetries = Suite.prototype.retries
|
||||
const hookRetries = Hook.prototype.retries
|
||||
const suiteSlow = Suite.prototype.slow
|
||||
const hookSlow = Suite.prototype.slow
|
||||
const suiteBeforeAll = Suite.prototype.beforeAll
|
||||
const suiteBeforeEach = Suite.prototype.beforeEach
|
||||
const suiteAfterAll = Suite.prototype.afterAll
|
||||
@@ -202,14 +200,6 @@ const restoreSuiteRetries = () => {
|
||||
Suite.prototype.retries = suiteRetries
|
||||
}
|
||||
|
||||
const restoreSuiteSlow = () => {
|
||||
Suite.prototype.slow = suiteSlow
|
||||
}
|
||||
|
||||
const restoreHookSlow = () => {
|
||||
Suite.prototype.slow = hookSlow
|
||||
}
|
||||
|
||||
const restoreTestClone = () => {
|
||||
Test.prototype.clone = testClone
|
||||
}
|
||||
@@ -274,24 +264,6 @@ const patchHookRetries = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const patchSuiteSlow = () => {
|
||||
Suite.prototype.slow = function (...args) {
|
||||
// Mocha calls this.slow() internally to set the default value of 75ms
|
||||
// Any other value, we assume it's a user and inform them that this is doesn't actually do anything
|
||||
if (args[0] !== undefined && args[0] !== 75) {
|
||||
throw $errUtils.cypressErrByPath('mocha.manually_set_slow')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const patchHookSlow = () => {
|
||||
Hook.prototype.slow = function (...args) {
|
||||
if (args[0] !== undefined && args[0] !== 75) {
|
||||
throw $errUtils.cypressErrByPath('mocha.manually_set_slow')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// matching the current Runner.prototype.fail except
|
||||
// changing the logic for determing whether this is a valid err
|
||||
const patchRunnerFail = () => {
|
||||
@@ -406,10 +378,6 @@ const patchSuiteAddTest = (specWindow, config) => {
|
||||
return testRetries.apply(this, args)
|
||||
}
|
||||
|
||||
test.slow = function () {
|
||||
throw $errUtils.cypressErrByPath('mocha.manually_set_slow')
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
}
|
||||
@@ -500,8 +468,6 @@ const restore = () => {
|
||||
restoreRunnableResetTimeout()
|
||||
restoreSuiteRetries()
|
||||
restoreHookRetries()
|
||||
restoreSuiteSlow()
|
||||
restoreHookSlow()
|
||||
restoreRunnerRunTests()
|
||||
restoreTestClone()
|
||||
restoreSuiteAddTest()
|
||||
@@ -516,8 +482,6 @@ const override = (specWindow, Cypress, config) => {
|
||||
patchRunnableResetTimeout()
|
||||
patchSuiteRetries()
|
||||
patchHookRetries()
|
||||
patchSuiteSlow()
|
||||
patchHookSlow()
|
||||
patchRunnerRunTests()
|
||||
patchTestClone()
|
||||
patchSuiteAddTest(specWindow, config)
|
||||
|
||||
Reference in New Issue
Block a user