chore: rename experimental network stubbing (#8450)

This commit is contained in:
Zach Bloomquist
2020-08-31 11:46:00 -04:00
committed by GitHub
parent b448c16df8
commit 2469473eb2
11 changed files with 16 additions and 16 deletions

View File

@@ -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.)"

View File

@@ -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.

View File

@@ -8,6 +8,6 @@
"reporterOptions": {
"configFile": "../../mocha-reporter-config.json"
},
"experimentalNetworkMocking": true,
"experimentalNetworkStubbing": true,
"experimentalShadowDomSupport": true
}

View File

@@ -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.')

View File

@@ -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
}

View File

@@ -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) {

View File

@@ -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')
}

View File

@@ -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 }) => {

View File

@@ -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,

View File

@@ -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',

View File

@@ -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: {