diff --git a/packages/driver/src/cy/aliases.js b/packages/driver/src/cy/aliases.js index 2500567adffb..5a9aee2f2264 100644 --- a/packages/driver/src/cy/aliases.js +++ b/packages/driver/src/cy/aliases.js @@ -7,7 +7,7 @@ const aliasRe = /^@.+/ const aliasDisplayRe = /^([@]+)/ const requestXhrRe = /\.request$/ -const blacklist = ['test', 'runnable', 'timeout', 'slow', 'skip', 'inspect'] +const blocklist = ['test', 'runnable', 'timeout', 'slow', 'skip', 'inspect'] const aliasDisplayName = (name) => { return name.replace(aliasDisplayRe, '') @@ -39,7 +39,7 @@ const validateAlias = (alias) => { $errUtils.throwErrByPath('as.empty_string') } - if (blacklist.includes(alias)) { + if (blocklist.includes(alias)) { return $errUtils.throwErrByPath('as.reserved_word', { args: { alias } }) } } diff --git a/packages/driver/test/cypress/integration/commands/agents_spec.js b/packages/driver/test/cypress/integration/commands/agents_spec.js index 0088dfc6c210..5d804637b76e 100644 --- a/packages/driver/test/cypress/integration/commands/agents_spec.js +++ b/packages/driver/test/cypress/integration/commands/agents_spec.js @@ -352,11 +352,11 @@ describe('src/cy/commands/agents', () => { }).to.throw('`cy.as()` cannot be passed an empty string.') }) - _.each(['test', 'runnable', 'timeout', 'slow', 'skip', 'inspect'], (blacklist) => { - it(`throws on a blacklisted word: ${blacklist}`, () => { + _.each(['test', 'runnable', 'timeout', 'slow', 'skip', 'inspect'], (blocklist) => { + it(`throws on a blocklisted word: ${blocklist}`, () => { expect(() => { - cy.stub().as(blacklist) - }).to.throw(`\`cy.as()\` cannot be aliased as: \`${blacklist}\`. This word is reserved.`) + cy.stub().as(blocklist) + }).to.throw(`\`cy.as()\` cannot be aliased as: \`${blocklist}\`. This word is reserved.`) }) }) }) @@ -433,11 +433,11 @@ describe('src/cy/commands/agents', () => { }).to.throw('`cy.as()` cannot be passed an empty string.') }) - _.each(['test', 'runnable', 'timeout', 'slow', 'skip', 'inspect'], (blacklist) => { - it(`throws on a blacklisted word: ${blacklist}`, () => { + _.each(['test', 'runnable', 'timeout', 'slow', 'skip', 'inspect'], (blocklist) => { + it(`throws on a blocklisted word: ${blocklist}`, () => { expect(() => { - cy.stub().as(blacklist) - }).to.throw(`\`cy.as()\` cannot be aliased as: \`${blacklist}\`. This word is reserved.`) + cy.stub().as(blocklist) + }).to.throw(`\`cy.as()\` cannot be aliased as: \`${blocklist}\`. This word is reserved.`) }) }) }) diff --git a/packages/driver/test/cypress/integration/commands/aliasing_spec.js b/packages/driver/test/cypress/integration/commands/aliasing_spec.js index 3a88ff2d70fb..b3d7a6f7aeeb 100644 --- a/packages/driver/test/cypress/integration/commands/aliasing_spec.js +++ b/packages/driver/test/cypress/integration/commands/aliasing_spec.js @@ -232,16 +232,16 @@ describe('src/cy/commands/aliasing', () => { cy.get('@my@Alias') }) - _.each(['test', 'runnable', 'timeout', 'slow', 'skip', 'inspect'], (blacklist) => { - it(`throws on a blacklisted word: ${blacklist}`, (done) => { + _.each(['test', 'runnable', 'timeout', 'slow', 'skip', 'inspect'], (blocklist) => { + it(`throws on a blocklisted word: ${blocklist}`, (done) => { cy.on('fail', (err) => { - expect(err.message).to.eq(`\`cy.as()\` cannot be aliased as: \`${blacklist}\`. This word is reserved.`) + expect(err.message).to.eq(`\`cy.as()\` cannot be aliased as: \`${blocklist}\`. This word is reserved.`) expect(err.docsUrl).to.eq('https://on.cypress.io/as') done() }) - cy.get('div:first').as(blacklist) + cy.get('div:first').as(blocklist) }) }) }) diff --git a/packages/network/README.md b/packages/network/README.md index 335dc6489e40..dc1317aaa5a0 100644 --- a/packages/network/README.md +++ b/packages/network/README.md @@ -8,7 +8,7 @@ You can see a list of the modules exported from this package in [./lib/index.ts] * `agent` is a HTTP/HTTPS [agent][1] with support for HTTP/HTTPS proxies and keepalive whenever possible * `allowDestroy` can be used to wrap a `net.Server` to add a `.destroy()` method -* `blacklist` is a utility for matching glob blacklists +* `blocklist` is a utility for matching glob blocklists * `concatStream` is a wrapper around [`concat-stream@1.6.2`][2] that makes it always yield a `Buffer` * `connect` contains utilities for making network connections, including `createRetryingSocket` * `cors` contains utilities for Cross-Origin Resource Sharing diff --git a/packages/network/lib/blacklist.ts b/packages/network/lib/blocklist.ts similarity index 100% rename from packages/network/lib/blacklist.ts rename to packages/network/lib/blocklist.ts diff --git a/packages/network/lib/index.ts b/packages/network/lib/index.ts index f40984659a19..6616d9dabd4c 100644 --- a/packages/network/lib/index.ts +++ b/packages/network/lib/index.ts @@ -1,12 +1,12 @@ import agent from './agent' -import * as blacklist from './blacklist' +import * as blocklist from './blocklist' import * as connect from './connect' import * as cors from './cors' import * as uri from './uri' export { agent, - blacklist, + blocklist, connect, cors, uri, diff --git a/packages/network/test/unit/blacklist_spec.ts b/packages/network/test/unit/blacklist_spec.ts index 81e223b4f915..e0969085bec5 100644 --- a/packages/network/test/unit/blacklist_spec.ts +++ b/packages/network/test/unit/blacklist_spec.ts @@ -1,4 +1,4 @@ -import { blacklist } from '../..' +import { blocklist } from '../..' import { expect } from 'chai' const hosts = [ @@ -10,22 +10,22 @@ const hosts = [ ] const matchesStr = function (url, host, val) { - const m = blacklist.matches(url, host) + const m = blocklist.matches(url, host) expect(!!m).to.eq(val, `url: '${url}' did not pass`) } const matchesArray = function (url, val) { - const m = blacklist.matches(url, hosts) + const m = blocklist.matches(url, hosts) expect(!!m).to.eq(val, `url: '${url}' did not pass`) } const matchesHost = (url, host) => { - expect(blacklist.matches(url, hosts)).to.eq(host) + expect(blocklist.matches(url, hosts)).to.eq(host) } -describe('lib/blacklist', () => { +describe('lib/blocklist', () => { it('handles hosts, ports, wildcards', () => { matchesArray('https://mail.google.com/foo', true) matchesArray('https://shop.apple.com/bar', true) diff --git a/packages/proxy/lib/http/request-middleware.ts b/packages/proxy/lib/http/request-middleware.ts index 5181504b8794..b65266ebe9ca 100644 --- a/packages/proxy/lib/http/request-middleware.ts +++ b/packages/proxy/lib/http/request-middleware.ts @@ -1,6 +1,6 @@ import _ from 'lodash' import debugModule from 'debug' -import { blacklist, cors } from '@packages/network' +import { blocklist, cors } from '@packages/network' import { HttpMiddleware } from './' export type RequestMiddleware = HttpMiddleware<{ @@ -50,11 +50,11 @@ const EndRequestsToBlacklistedHosts: RequestMiddleware = function () { const { blocklistHosts } = this.config if (blocklistHosts) { - const matches = blacklist.matches(this.req.proxiedUrl, blocklistHosts) + const matches = blocklist.matches(this.req.proxiedUrl, blocklistHosts) if (matches) { - this.res.set('x-cypress-matched-blacklisted-host', matches) - debug('blacklisting request %o', { + this.res.set('x-cypress-matched-blocklisted-host', matches) + debug('blocklisting request %o', { url: this.req.proxiedUrl, matches, }) diff --git a/packages/server/lib/server.js b/packages/server/lib/server.js index 3dade2ef8a4c..78f4b28cb3f8 100644 --- a/packages/server/lib/server.js +++ b/packages/server/lib/server.js @@ -15,7 +15,7 @@ const compression = require('compression') const debug = require('debug')('cypress:server:server') const { agent, - blacklist, + blocklist, concatStream, cors, uri, @@ -293,16 +293,16 @@ class Server { // if we are currently matching then we're // not making a direct connection anyway // so we only need to check this if we - // have blacklist hosts and are not matching. + // have blocklist hosts and are not matching. // - // if we have blacklisted hosts lets + // if we have blocklisted hosts lets // see if this matches - if so then // we cannot allow it to make a direct // connection if (blocklistHosts && !isMatching) { - isMatching = blacklist.matches(urlToCheck, blocklistHosts) + isMatching = blocklist.matches(urlToCheck, blocklistHosts) - debug(`HTTPS request ${urlToCheck} matches blacklist?`, isMatching) + debug(`HTTPS request ${urlToCheck} matches blocklist?`, isMatching) } // make a direct connection only if diff --git a/packages/server/test/e2e/1_blacklist_hosts_spec.js b/packages/server/test/e2e/1_blacklist_hosts_spec.js index b7ea65a1e955..565fb41268c4 100644 --- a/packages/server/test/e2e/1_blacklist_hosts_spec.js +++ b/packages/server/test/e2e/1_blacklist_hosts_spec.js @@ -14,7 +14,7 @@ const onServer = function (app) { }) } -describe('e2e blacklist', () => { +describe('e2e blocklist', () => { e2e.setup({ servers: [{ port: 3131, @@ -31,7 +31,7 @@ describe('e2e blacklist', () => { it('passes', function () { return e2e.exec(this, { - spec: 'blacklist_hosts_spec.coffee', + spec: 'blocklist_hosts_spec.coffee', snapshot: true, }) }) diff --git a/packages/server/test/integration/http_requests_spec.js b/packages/server/test/integration/http_requests_spec.js index 7434b39cd6c7..c22d2b550460 100644 --- a/packages/server/test/integration/http_requests_spec.js +++ b/packages/server/test/integration/http_requests_spec.js @@ -3727,7 +3727,7 @@ describe('Routes', () => { }) }) - context('blacklisted hosts', () => { + context('blocklisted hosts', () => { beforeEach(function () { return this.setup({ config: { @@ -3744,7 +3744,7 @@ describe('Routes', () => { it('returns 503 and custom headers for all hosts', function () { const expectedHeader = (res, val) => { - expect(res.headers['x-cypress-matched-blacklisted-host']).to.eq(val) + expect(res.headers['x-cypress-matched-blocklisted-host']).to.eq(val) } return Promise.all([ diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/blacklist_hosts_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/blocklist_hosts_spec.coffee similarity index 91% rename from packages/server/test/support/fixtures/projects/e2e/cypress/integration/blacklist_hosts_spec.coffee rename to packages/server/test/support/fixtures/projects/e2e/cypress/integration/blocklist_hosts_spec.coffee index 47fecb9a4e39..864ab0c8f6a6 100644 --- a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/blacklist_hosts_spec.coffee +++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/blocklist_hosts_spec.coffee @@ -1,5 +1,5 @@ -describe "blacklist", -> - it "forces blacklisted hosts to return 503", -> +describe "blocklist", -> + it "forces blocklisted hosts to return 503", -> cy .visit("http://localhost:3232")