Skip to content

Commit dac398b

Browse files
test(test-optimization): respect v5 Cypress support range (#9697)
1 parent 731497f commit dac398b

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

packages/dd-trace/test/ci-visibility/manifest-scaffold.spec.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ const {
1818
getManifestInputFiles,
1919
} = require('../../../../ci/test-optimization-validation/runner-command')
2020
const { getRunnerContract } = require('../../../../ci/test-optimization-validation/runner-contract')
21+
const { DD_MAJOR } = require('../../../../version')
2122
const {
2223
FRAMEWORKS,
2324
createRepositoryFixture,
2425
removeFixture,
2526
withRepositoryFixture,
2627
} = require('./validation-test-helpers')
2728

29+
const CYPRESS_UNSUPPORTED_VERSION = DD_MAJOR >= 6 ? '11.2.0' : '6.6.0'
30+
const CYPRESS_MINIMUM_VERSION = DD_MAJOR >= 6 ? '12.0.0' : '6.7.0'
31+
2832
function scaffoldFramework (fixture, framework) {
2933
return createManifestScaffold({ root: fixture.root, frameworks: new Set([framework]) }).frameworks[0]
3034
}
@@ -2085,16 +2089,16 @@ describe('test optimization validation manifest scaffold', () => {
20852089
const installedPackageJsonPath = path.join(fixture.root, 'node_modules', 'cypress', 'package.json')
20862090
for (const filename of [packageJsonPath, installedPackageJsonPath]) {
20872091
const packageJson = JSON.parse(fs.readFileSync(filename))
2088-
packageJson.version = filename === installedPackageJsonPath ? '11.2.0' : packageJson.version
2089-
if (filename === packageJsonPath) packageJson.devDependencies.cypress = '11.2.0'
2092+
packageJson.version = filename === installedPackageJsonPath ? CYPRESS_UNSUPPORTED_VERSION : packageJson.version
2093+
if (filename === packageJsonPath) packageJson.devDependencies.cypress = CYPRESS_UNSUPPORTED_VERSION
20902094
fs.writeFileSync(filename, `${JSON.stringify(packageJson)}\n`)
20912095
}
20922096
const framework = scaffoldFramework(fixture, 'cypress')
20932097

20942098
assert.strictEqual(framework.status, 'detected_not_runnable')
20952099
assert.strictEqual(framework.blockerCategory, 'UNSUPPORTED_VERSION')
2096-
assert.match(framework.notes[0], /Cypress 11\.2\.0 was detected/)
2097-
assert.match(framework.notes[0], /live validation requires >=12\.0\.0/)
2100+
assert.ok(framework.notes[0].includes(`Cypress ${CYPRESS_UNSUPPORTED_VERSION} was detected`))
2101+
assert.ok(framework.notes[0].includes(`live validation requires >=${CYPRESS_MINIMUM_VERSION}`))
20982102
assert.match(framework.notes[0], /normal dependency workflow/)
20992103
})
21002104
})

packages/dd-trace/test/ci-visibility/validation-cli.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {
1818
EXECUTION_LOCK_FILENAME,
1919
} = require('../../../../ci/test-optimization-validation/execution-lock')
2020
const { createManifestScaffold } = require('../../../../ci/test-optimization-validation/manifest-scaffold')
21+
const { DD_MAJOR } = require('../../../../version')
2122
const {
2223
createRepositoryFixture,
2324
removeFixture,
@@ -26,6 +27,7 @@ const {
2627

2728
const PACKAGE_ROOT = path.resolve(__dirname, '../../../..')
2829
const VALIDATOR = path.join(PACKAGE_ROOT, 'ci', 'validate-test-optimization.js')
30+
const CYPRESS_UNSUPPORTED_VERSION = DD_MAJOR >= 6 ? '11.2.0' : '6.6.0'
2931

3032
describe('test optimization validation CLI', () => {
3133
it('uses only published files and runtime dependencies', () => {
@@ -172,8 +174,8 @@ describe('test optimization validation CLI', () => {
172174
const installedPackageJsonPath = path.join(fixture.root, 'node_modules', 'cypress', 'package.json')
173175
for (const filename of [packageJsonPath, installedPackageJsonPath]) {
174176
const packageJson = JSON.parse(fs.readFileSync(filename))
175-
if (filename === packageJsonPath) packageJson.devDependencies.cypress = '11.2.0'
176-
else packageJson.version = '11.2.0'
177+
if (filename === packageJsonPath) packageJson.devDependencies.cypress = CYPRESS_UNSUPPORTED_VERSION
178+
else packageJson.version = CYPRESS_UNSUPPORTED_VERSION
177179
fs.writeFileSync(filename, `${JSON.stringify(packageJson)}\n`)
178180
}
179181
assert.strictEqual(runCli(fixture.root, ['--init-manifest', '--framework', 'cypress']).status, 0)

0 commit comments

Comments
 (0)