Skip to content

Commit d966bdb

Browse files
author
Lais Tomaz
committed
Rename all instances of blacklistHosts
1 parent 7597bf9 commit d966bdb

File tree

11 files changed

+45
-45
lines changed

11 files changed

+45
-45
lines changed

cli/schema/cypress.schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
"default": null,
176176
"description": "Enables you to override the default user agent the browser sends in all request headers. User agent values are typically used by servers to help identify the operating system, browser, and browser version. See User-Agent MDN Documentation for example user agent values here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent"
177177
},
178-
"blacklistHosts": {
178+
"blocklistHosts": {
179179
"type": [
180180
"string",
181181
"array"
@@ -184,7 +184,7 @@
184184
"type": "string"
185185
},
186186
"default": null,
187-
"description": "A String or Array of hosts that you wish to block traffic for. Please read the notes for examples on using this https://on.cypress.io/configuration#blacklistHosts"
187+
"description": "A String or Array of hosts that you wish to block traffic for. Please read the notes for examples on using this https://on.cypress.io/configuration#blocklistHosts"
188188
},
189189
"modifyObstructiveCode": {
190190
"type": "boolean",

packages/desktop-gui/cypress/fixtures/config.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"cypressHostUrl": "http://localhost:2020",
110110
"cypressEnv": "development",
111111
"env": {},
112-
"blacklistHosts": [
112+
"blocklistHosts": [
113113
"www.google-analytics.com",
114114
"hotjar.com"
115115
],
@@ -376,7 +376,7 @@
376376
"from": "default",
377377
"value": true
378378
},
379-
"blacklistHosts": {
379+
"blocklistHosts": {
380380
"from": "config",
381381
"value": [
382382
"www.google-analytics.com",

packages/desktop-gui/cypress/integration/settings_spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe('Settings', () => {
154154
cy.get('@config-vars')
155155
.contains('span', 'Electron').parent('span').should('have.class', 'plugin')
156156

157-
cy.contains('span', 'blacklistHosts').parents('div').first().find('span').first().click()
157+
cy.contains('span', 'blocklistHosts').parents('div').first().find('span').first().click()
158158
cy.get('@config-vars')
159159
.contains('span', 'www.google-analytics.com').parent('span').should('have.class', 'config')
160160

@@ -207,8 +207,8 @@ describe('Settings', () => {
207207
cy.get('.line').contains('*.foobar.com, *.bazqux.com')
208208
})
209209

210-
it('displays "array" values for blacklistHosts', () => {
211-
cy.contains('.line', 'blacklistHosts').contains('www.google-analytics.com, hotjar.com')
210+
it('displays "array" values for blocklistHosts', () => {
211+
cy.contains('.line', 'blocklistHosts').contains('www.google-analytics.com, hotjar.com')
212212
})
213213

214214
it('opens help link on click', () => {

packages/network/lib/blacklist.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import _ from 'lodash'
22
import minimatch from 'minimatch'
33
import { stripProtocolAndDefaultPorts } from './uri'
44

5-
export function matches (urlToCheck, blacklistHosts) {
5+
export function matches (urlToCheck, blocklistHosts) {
66
// normalize into flat array
7-
blacklistHosts = [].concat(blacklistHosts)
7+
blocklistHosts = [].concat(blocklistHosts)
88

99
urlToCheck = stripProtocolAndDefaultPorts(urlToCheck)
1010

@@ -14,5 +14,5 @@ export function matches (urlToCheck, blacklistHosts) {
1414
return minimatch(urlToCheck, hostMatcher)
1515
}
1616

17-
return _.find(blacklistHosts, matchUrl)
17+
return _.find(blocklistHosts, matchUrl)
1818
}

packages/proxy/lib/http/request-middleware.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ const RedirectToClientRouteIfNotProxied: RequestMiddleware = function () {
4747
}
4848

4949
const EndRequestsToBlacklistedHosts: RequestMiddleware = function () {
50-
const { blacklistHosts } = this.config
50+
const { blocklistHosts } = this.config
5151

52-
if (blacklistHosts) {
53-
const matches = blacklist.matches(this.req.proxiedUrl, blacklistHosts)
52+
if (blocklistHosts) {
53+
const matches = blacklist.matches(this.req.proxiedUrl, blocklistHosts)
5454

5555
if (matches) {
5656
this.res.set('x-cypress-matched-blacklisted-host', matches)

packages/server/lib/config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ folders.push('componentFolder')
5757
const configKeys = toWords(`\
5858
animationDistanceThreshold fileServerFolder
5959
baseUrl fixturesFolder
60-
blacklistHosts
60+
blocklistHosts
6161
chromeWebSecurity
6262
modifyObstructiveCode integrationFolder
6363
env pluginsFile
@@ -119,7 +119,7 @@ const CONFIG_DEFAULTS = {
119119
isTextTerminal: false,
120120
reporter: 'spec',
121121
reporterOptions: null,
122-
blacklistHosts: null,
122+
blocklistHosts: null,
123123
clientRoute: '/__/',
124124
xhrRoute: '/xhrs/',
125125
socketIoRoute: '/__socket.io',
@@ -175,7 +175,7 @@ const CONFIG_DEFAULTS = {
175175
const validationRules = {
176176
animationDistanceThreshold: v.isNumber,
177177
baseUrl: v.isFullyQualifiedUrl,
178-
blacklistHosts: v.isStringOrArrayOfStrings,
178+
blocklistHosts: v.isStringOrArrayOfStrings,
179179
browsers: v.isValidBrowserList,
180180
chromeWebSecurity: v.isBoolean,
181181
configFile: v.isStringOrFalse,

packages/server/lib/server.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class Server {
240240

241241
createServer (app, config, project, request, onWarning) {
242242
return new Promise((resolve, reject) => {
243-
const { port, fileServerFolder, socketIoRoute, baseUrl, blacklistHosts } = config
243+
const { port, fileServerFolder, socketIoRoute, baseUrl, blocklistHosts } = config
244244

245245
this._server = http.createServer(app)
246246

@@ -299,8 +299,8 @@ class Server {
299299
// see if this matches - if so then
300300
// we cannot allow it to make a direct
301301
// connection
302-
if (blacklistHosts && !isMatching) {
303-
isMatching = blacklist.matches(urlToCheck, blacklistHosts)
302+
if (blocklistHosts && !isMatching) {
303+
isMatching = blacklist.matches(urlToCheck, blocklistHosts)
304304

305305
debug(`HTTPS request ${urlToCheck} matches blacklist?`, isMatching)
306306
}

packages/server/test/e2e/1_blacklist_hosts_spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('e2e blacklist', () => {
2525
}],
2626
settings: {
2727
baseUrl: 'http://localhost:3232',
28-
blacklistHosts: 'localhost:3131',
28+
blocklistHosts: 'localhost:3131',
2929
},
3030
})
3131

packages/server/test/integration/http_requests_spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3731,7 +3731,7 @@ describe('Routes', () => {
37313731
beforeEach(function () {
37323732
return this.setup({
37333733
config: {
3734-
blacklistHosts: [
3734+
blocklistHosts: [
37353735
'*.google.com',
37363736
'shop.apple.com',
37373737
'cypress.io',

packages/server/test/unit/args_spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ describe('lib/util/args', () => {
198198
const config = {
199199
pageLoadTimeout: 10000,
200200
waitForAnimations: false,
201-
blacklistHosts: ['one.com', 'www.two.io'],
201+
blocklistHosts: ['one.com', 'www.two.io'],
202202
hosts: {
203203
'foobar.com': '127.0.0.1',
204204
},
@@ -211,15 +211,15 @@ describe('lib/util/args', () => {
211211

212212
// as mixed usage
213213
const hosts = JSON.stringify(config.hosts)
214-
const blacklistHosts = JSON.stringify(config.blacklistHosts)
214+
const blocklistHosts = JSON.stringify(config.blocklistHosts)
215215

216216
options = this.setup(
217217
'--config',
218218
[
219219
'pageLoadTimeout=10000',
220220
'waitForAnimations=false',
221221
`hosts=${hosts}`,
222-
`blacklistHosts=${blacklistHosts}`,
222+
`blocklistHosts=${blocklistHosts}`,
223223
].join(','),
224224

225225
)
@@ -276,7 +276,7 @@ describe('lib/util/args', () => {
276276
context('.toObject', () => {
277277
beforeEach(function () {
278278
this.hosts = { a: 'b', b: 'c' }
279-
this.blacklistHosts = ['a.com', 'b.com']
279+
this.blocklistHosts = ['a.com', 'b.com']
280280
this.specs = [
281281
path.join(cwd, 'foo'),
282282
path.join(cwd, 'bar'),
@@ -293,7 +293,7 @@ describe('lib/util/args', () => {
293293
env: this.env,
294294
hosts: this.hosts,
295295
requestTimeout: 1234,
296-
blacklistHosts: this.blacklistHosts,
296+
blocklistHosts: this.blocklistHosts,
297297
reporterOptions: {
298298
foo: 'bar',
299299
},
@@ -307,7 +307,7 @@ describe('lib/util/args', () => {
307307
'--get-key',
308308
'--env=foo=bar,baz=quux,bar=foo=quz',
309309
'--config',
310-
`requestTimeout=1234,blacklistHosts=${s(this.blacklistHosts)},hosts=${s(this.hosts)}`,
310+
`requestTimeout=1234,blocklistHosts=${s(this.blocklistHosts)},hosts=${s(this.hosts)}`,
311311
'--reporter-options=foo=bar',
312312
'--spec=foo,bar,baz',
313313
)
@@ -334,7 +334,7 @@ describe('lib/util/args', () => {
334334
it('can transpose back to an array', function () {
335335
const mergedConfig = JSON.stringify({
336336
requestTimeout: this.config.requestTimeout,
337-
blacklistHosts: this.blacklistHosts,
337+
blocklistHosts: this.blocklistHosts,
338338
hosts: this.hosts,
339339
env: this.env,
340340
reporterOptions: {

packages/server/test/unit/config_spec.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -649,27 +649,27 @@ describe('lib/config', () => {
649649
})
650650
})
651651

652-
context('blacklistHosts', () => {
652+
context('blocklistHosts', () => {
653653
it('passes if a string', function () {
654-
this.setup({ blacklistHosts: 'google.com' })
654+
this.setup({ blocklistHosts: 'google.com' })
655655

656656
return this.expectValidationPasses()
657657
})
658658

659659
it('passes if an array of strings', function () {
660-
this.setup({ blacklistHosts: ['google.com'] })
660+
this.setup({ blocklistHosts: ['google.com'] })
661661

662662
return this.expectValidationPasses()
663663
})
664664

665665
it('fails if not a string or array', function () {
666-
this.setup({ blacklistHosts: 5 })
666+
this.setup({ blocklistHosts: 5 })
667667

668668
return this.expectValidationFails('be a string or an array of strings')
669669
})
670670

671671
it('fails if not an array of strings', function () {
672-
this.setup({ blacklistHosts: [5] })
672+
this.setup({ blocklistHosts: [5] })
673673
this.expectValidationFails('be a string or an array of strings')
674674

675675
return this.expectValidationFails('the value was: `[5]`')
@@ -717,8 +717,8 @@ describe('lib/config', () => {
717717
}
718718
})
719719

720-
it('includes blacklistHosts', function () {
721-
return this.includes('blacklistHosts')
720+
it('includes blocklistHosts', function () {
721+
return this.includes('blocklistHosts')
722722
})
723723
})
724724

@@ -957,19 +957,19 @@ describe('lib/config', () => {
957957
return this.defaults('supportFile', false, { supportFile: false })
958958
})
959959

960-
it('blacklistHosts=null', function () {
961-
return this.defaults('blacklistHosts', null)
960+
it('blocklistHosts=null', function () {
961+
return this.defaults('blocklistHosts', null)
962962
})
963963

964-
it('blacklistHosts=[a,b]', function () {
965-
return this.defaults('blacklistHosts', ['a', 'b'], {
966-
blacklistHosts: ['a', 'b'],
964+
it('blocklistHosts=[a,b]', function () {
965+
return this.defaults('blocklistHosts', ['a', 'b'], {
966+
blocklistHosts: ['a', 'b'],
967967
})
968968
})
969969

970-
it('blacklistHosts=a|b', function () {
971-
return this.defaults('blacklistHosts', ['a', 'b'], {
972-
blacklistHosts: ['a', 'b'],
970+
it('blocklistHosts=a|b', function () {
971+
return this.defaults('blocklistHosts', ['a', 'b'], {
972+
blocklistHosts: ['a', 'b'],
973973
})
974974
})
975975

@@ -1097,7 +1097,7 @@ describe('lib/config', () => {
10971097
projectId: { value: null, from: 'default' },
10981098
port: { value: 1234, from: 'cli' },
10991099
hosts: { value: null, from: 'default' },
1100-
blacklistHosts: { value: null, from: 'default' },
1100+
blocklistHosts: { value: null, from: 'default' },
11011101
browsers: { value: [], from: 'default' },
11021102
userAgent: { value: null, from: 'default' },
11031103
reporter: { value: 'json', from: 'cli' },
@@ -1172,7 +1172,7 @@ describe('lib/config', () => {
11721172
projectId: { value: 'projectId123', from: 'env' },
11731173
port: { value: 2020, from: 'config' },
11741174
hosts: { value: null, from: 'default' },
1175-
blacklistHosts: { value: null, from: 'default' },
1175+
blocklistHosts: { value: null, from: 'default' },
11761176
browsers: { value: [], from: 'default' },
11771177
userAgent: { value: null, from: 'default' },
11781178
reporter: { value: 'spec', from: 'default' },

0 commit comments

Comments
 (0)