Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove system test it.only and prevent CI from ever running onlys #20276

Merged
merged 2 commits into from
Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions system-tests/lib/system-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const snapshot = require('snap-shot-it')
import { SpawnOptions } from 'child_process'
import { expect } from './spec_helper'

const isCi = require('is-ci')

require('mocha-banner').register()
const chalk = require('chalk').default
const _ = require('lodash')
Expand Down Expand Up @@ -525,7 +527,7 @@ const copy = function () {
}
}

const getMochaItFn = function (only, skip, browser, specifiedBrowser) {
const getMochaItFn = function (title, only, skip, browser, specifiedBrowser) {
// if we've been told to skip this test
// or if we specified a particular browser and this
// doesn't match the one we're currently trying to run...
Expand All @@ -535,6 +537,12 @@ const getMochaItFn = function (only, skip, browser, specifiedBrowser) {
}

if (only) {
if (isCi) {
// fixes the problem where systemTests can accidentally by skipped using systemTests.it.only(...)
// https://github.com/cypress-io/cypress/pull/20276
throw new Error(`the system test: "${chalk.yellow(title)}" has been set to run with an it.only() which is not allowed in CI environments.\n\nPlease remove the it.only()`)
}

return it.only
}

Expand Down Expand Up @@ -605,7 +613,7 @@ const localItFn = function (title: string, opts: ItOptions) {
const browsersToTest = getBrowsers(options.browser)

const browserToTest = function (browser) {
const mochaItFn = getMochaItFn(options.only, options.skip, browser, specifiedBrowser)
const mochaItFn = getMochaItFn(title, options.only, options.skip, browser, specifiedBrowser)

const testTitle = `${title} [${browser}]`

Expand Down
2 changes: 1 addition & 1 deletion system-tests/test/deprecated_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('deprecated before:browser:launch args', () => {
psInclude: ['--foo', '--bar'],
})

systemTests.it.only('concat return returns once', {
systemTests.it('concat return returns once', {
// TODO: implement webPreferences.additionalArgs here
// once we decide if/what we're going to make the implemenation
// SUGGESTION: add this to Cypress.browser.args which will capture
Expand Down