Skip to content

Commit 284a51d

Browse files
authored
Merge branch '10.0-release' into alejandro/fix/default-spec-path-for-component
2 parents 6dfc2d7 + 123a930 commit 284a51d

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

packages/data-context/__snapshots__/codegen.spec.ts.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ const { defineConfig } = require('cypress')
229229
module.exports = defineConfig({
230230
component: {
231231
setupNodeEvents(on, config) {},
232-
componentFolder: '.',
233232
specPattern: './**/*.spec.cy.{js,ts,jsx,tsx}',
234233
},
235234
})

packages/data-context/src/sources/migration/codegen.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { hasDefaultExport } from './parserUtils'
1414
import type { LegacyCypressConfigJson } from '..'
1515
import { parse } from '@babel/parser'
1616
import generate from '@babel/generator'
17+
import _ from 'lodash'
18+
import { getBreakingKeys } from '@packages/config'
1719

1820
const debug = Debug('cypress:data-context:sources:migration:codegen')
1921

@@ -383,19 +385,23 @@ export function reduceConfig (cfg: LegacyCypressConfigJson, options: CreateConfi
383385
const isDefaultE2E = key === 'e2e' && specPattern === `cypress/e2e/${ext}`
384386
const isDefaultCT = key === 'component' && specPattern === ext
385387

388+
const breakingKeys = getBreakingKeys()
389+
const restWithoutBreakingKeys = _.omit(rest, breakingKeys)
390+
const existingWithoutBreakingKeys = _.omit(acc[key], breakingKeys)
391+
386392
if (isDefaultE2E || isDefaultCT) {
387393
return {
388394
...acc, [key]: {
389-
...rest,
390-
...acc[key],
395+
...restWithoutBreakingKeys,
396+
...existingWithoutBreakingKeys,
391397
},
392398
}
393399
}
394400

395401
return {
396402
...acc, [key]: {
397-
...rest,
398-
...acc[key],
403+
...restWithoutBreakingKeys,
404+
...existingWithoutBreakingKeys,
399405
specPattern,
400406
},
401407
}

packages/data-context/test/unit/sources/migration/codegen.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ describe('reduceConfig', () => {
415415
hasE2ESpec: false,
416416
hasPluginsFile: false,
417417
projectRoot: '',
418-
hasTypescript: false,
418+
isUsingTypeScript: false,
419419
isProjectUsingESModules: false,
420420
shouldAddCustomE2ESpecPattern: false,
421421
}
@@ -448,6 +448,7 @@ describe('reduceConfig', () => {
448448
}
449449
const newConfig = reduceConfig(config, options)
450450

451+
expect(newConfig.component.componentFolder).to.not.exist
451452
expect(newConfig.component.specPattern).to.eq('src/**/**.cy.js')
452453
expect(newConfig.e2e.specPattern).to.eq(`${config.e2e.integrationFolder}/${config.testFiles}`)
453454
})

system-tests/projects/migration-component-testing/cypress.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"componentFolder": "src",
33
"supportFile": false,
44
"component": {
5-
"testFiles": "**/*spec.{js,tsx}"
5+
"testFiles": "**/*spec.{js,tsx}",
6+
"componentFolder": "src"
67
}
78
}

0 commit comments

Comments
 (0)