mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-26 10:59:23 -06:00
chore: rename experimental network stubbing (#8450)
This commit is contained in:
@@ -234,7 +234,7 @@
|
||||
"default": false,
|
||||
"description": "Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm."
|
||||
},
|
||||
"experimentalNetworkMocking": {
|
||||
"experimentalNetworkStubbing": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Enables `cy.route2`, which can be used to dynamically intercept/stub/await any HTTP request or response (XHRs, fetch, beacons, etc.)"
|
||||
|
||||
2
cli/types/cypress.d.ts
vendored
2
cli/types/cypress.d.ts
vendored
@@ -2583,7 +2583,7 @@ declare namespace Cypress {
|
||||
* Enables `cy.route2`, which can be used to dynamically intercept/stub/await any HTTP request or response (XHRs, fetch, beacons, etc.)
|
||||
* @default false
|
||||
*/
|
||||
experimentalNetworkMocking: boolean
|
||||
experimentalNetworkStubbing: boolean
|
||||
/**
|
||||
* Enables shadow DOM support. Adds the `cy.shadow()` command and
|
||||
* the `includeShadowDom` option to some DOM commands.
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
"reporterOptions": {
|
||||
"configFile": "../../mocha-reporter-config.json"
|
||||
},
|
||||
"experimentalNetworkMocking": true,
|
||||
"experimentalNetworkStubbing": true,
|
||||
"experimentalShadowDomSupport": true
|
||||
}
|
||||
|
||||
@@ -277,10 +277,10 @@ describe('network stubbing', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('if experimentalNetworkMocking is falsy', function (done) {
|
||||
it('if experimentalNetworkStubbing is falsy', function (done) {
|
||||
sinon.stub(Cypress, 'config').callThrough()
|
||||
// @ts-ignore
|
||||
.withArgs('experimentalNetworkMocking').returns(false)
|
||||
.withArgs('experimentalNetworkStubbing').returns(false)
|
||||
|
||||
cy.on('fail', (err) => {
|
||||
expect(err.message).to.contain('`cy.route2()` requires experimental network mocking to be enabled.')
|
||||
|
||||
@@ -878,7 +878,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
|
||||
}
|
||||
|
||||
// hack to make cy.visits interceptable by network stubbing
|
||||
if (Cypress.config('experimentalNetworkMocking')) {
|
||||
if (Cypress.config('experimentalNetworkStubbing')) {
|
||||
options.selfProxy = true
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ module.exports = (Commands, Cypress, cy, state) => {
|
||||
|
||||
options.type = type
|
||||
|
||||
if (Cypress.config('experimentalNetworkMocking')) {
|
||||
if (Cypress.config('experimentalNetworkStubbing')) {
|
||||
const req = waitForRoute(alias, state, type)
|
||||
|
||||
if (req) {
|
||||
|
||||
@@ -241,7 +241,7 @@ export function addCommand (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy,
|
||||
}
|
||||
|
||||
function route2 (matcher: RouteMatcher, handler?: RouteHandler | StringMatcher, arg2?: RouteHandler) {
|
||||
if (!Cypress.config('experimentalNetworkMocking')) {
|
||||
if (!Cypress.config('experimentalNetworkStubbing')) {
|
||||
return $errUtils.throwErrByPath('net_stubbing.route2.needs_experimental')
|
||||
}
|
||||
|
||||
|
||||
@@ -954,7 +954,7 @@ module.exports = {
|
||||
needs_experimental: stripIndent`\
|
||||
${cmd('route2')} requires experimental network mocking to be enabled.
|
||||
|
||||
Set the \`experimentalNetworkMocking\` config value to \`true\` to access this command.
|
||||
Set the \`experimentalNetworkStubbing\` config value to \`true\` to access this command.
|
||||
|
||||
Read more: https://on.cypress.io/experiments`,
|
||||
invalid_handler: ({ handler }) => {
|
||||
|
||||
@@ -113,7 +113,7 @@ const experimentalConfigKeys = [
|
||||
'experimentalComponentTesting',
|
||||
'experimentalShadowDomSupport',
|
||||
'experimentalFetchPolyfill',
|
||||
'experimentalNetworkMocking',
|
||||
'experimentalNetworkStubbing',
|
||||
]
|
||||
|
||||
const CONFIG_DEFAULTS = {
|
||||
@@ -178,7 +178,7 @@ const CONFIG_DEFAULTS = {
|
||||
// experimental keys (should all start with "experimental" prefix)
|
||||
experimentalComponentTesting: false,
|
||||
experimentalSourceRewriting: false,
|
||||
experimentalNetworkMocking: false,
|
||||
experimentalNetworkStubbing: false,
|
||||
experimentalShadowDomSupport: false,
|
||||
experimentalFetchPolyfill: false,
|
||||
retries: { runMode: 0, openMode: 0 },
|
||||
@@ -226,7 +226,7 @@ const validationRules = {
|
||||
// experimental flag validation below
|
||||
experimentalComponentTesting: v.isBoolean,
|
||||
experimentalSourceRewriting: v.isBoolean,
|
||||
experimentalNetworkMocking: v.isBoolean,
|
||||
experimentalNetworkStubbing: v.isBoolean,
|
||||
experimentalShadowDomSupport: v.isBoolean,
|
||||
experimentalFetchPolyfill: v.isBoolean,
|
||||
retries: v.isValidRetriesConfig,
|
||||
|
||||
@@ -52,7 +52,7 @@ interface StringValues {
|
||||
*/
|
||||
const _summaries: StringValues = {
|
||||
experimentalComponentTesting: 'Framework-specific component testing, uses `componentFolder` to load component specs',
|
||||
experimentalNetworkMocking: 'Enables `cy.route2`, which can be used to dynamically intercept/stub/await any HTTP request or response (XHRs, fetch, beacons, etc.)',
|
||||
experimentalNetworkStubbing: 'Enables `cy.route2`, which can be used to dynamically intercept/stub/await any HTTP request or response (XHRs, fetch, beacons, etc.)',
|
||||
experimentalSourceRewriting: 'Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm.',
|
||||
experimentalFetchPolyfill: 'Polyfills `window.fetch` to enable Network spying and stubbing',
|
||||
experimentalShadowDomSupport: 'Enables support for shadow DOM traversal, introduces the `shadow()` command and the `includeShadowDom` option to traversal commands.',
|
||||
@@ -70,7 +70,7 @@ const _summaries: StringValues = {
|
||||
*/
|
||||
const _names: StringValues = {
|
||||
experimentalComponentTesting: 'Component Testing',
|
||||
experimentalNetworkMocking: 'Experimental network mocking',
|
||||
experimentalNetworkStubbing: 'Experimental network mocking',
|
||||
experimentalSourceRewriting: 'Improved source rewriting',
|
||||
experimentalShadowDomSupport: 'Shadow DOM Support',
|
||||
experimentalFetchPolyfill: 'Fetch polyfill',
|
||||
|
||||
@@ -1190,7 +1190,7 @@ describe('lib/config', () => {
|
||||
experimentalComponentTesting: { value: false, from: 'default' },
|
||||
componentFolder: { value: 'cypress/component', from: 'default' },
|
||||
experimentalShadowDomSupport: { value: false, from: 'default' },
|
||||
experimentalNetworkMocking: { value: false, from: 'default' },
|
||||
experimentalNetworkStubbing: { value: false, from: 'default' },
|
||||
experimentalFetchPolyfill: { value: false, from: 'default' },
|
||||
retries: { value: { runMode: 0, openMode: 0 }, from: 'default' },
|
||||
})
|
||||
@@ -1269,7 +1269,7 @@ describe('lib/config', () => {
|
||||
experimentalComponentTesting: { value: false, from: 'default' },
|
||||
componentFolder: { value: 'cypress/component', from: 'default' },
|
||||
experimentalShadowDomSupport: { value: false, from: 'default' },
|
||||
experimentalNetworkMocking: { value: false, from: 'default' },
|
||||
experimentalNetworkStubbing: { value: false, from: 'default' },
|
||||
experimentalFetchPolyfill: { value: false, from: 'default' },
|
||||
retries: { value: { runMode: 0, openMode: 0 }, from: 'default' },
|
||||
env: {
|
||||
|
||||
Reference in New Issue
Block a user