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

fix: scope config to current testing type #20677

Merged

Conversation

estrada9166
Copy link
Member

User facing changelog

Additional details

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 17, 2022

Thanks for taking the time to open a PR!

…jandro/fix/scope-config-to-current-testing-type
@cypress
Copy link

cypress bot commented Mar 17, 2022



Test summary

4333 0 48 0Flakiness 0


Run details

Project cypress
Status Passed
Commit 19f90ae
Started Mar 23, 2022 11:56 PM
Ended Mar 24, 2022 12:09 AM
Duration 12:14 💡
OS Linux Debian - 10.10
Browser Electron 94

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@estrada9166 estrada9166 marked this pull request as ready for review March 22, 2022 02:43
@@ -296,12 +296,12 @@ describe('lib/util/config-file-updater', () => {
}
`

const output = await insertValueInJSString(src, { component: { specFilePattern: 'src/**/*.spec.cy.js' } })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find.!

Comment on lines +212 to +213
cy.get('.bg-teal-100').contains('tests/**/*')
cy.get('.bg-teal-100').contains('tests/_support/spec_helper.js')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what caused this to change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that now we are not returning the values as a nested property of the e2e or component and bc it was set as from config the whole object was highlighted

@@ -98,6 +98,11 @@ const isValidConfig = (key: string, config: any) => {
return true
}

export const defaultSpecPattern = {
Copy link
Member

@emilyrohrbough emilyrohrbough Mar 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update the e2e & component configuration values to return these?

Nevermind you did. Why do these need to be exported separately? Can't we pull these values from the resolved config?

Copy link
Member Author

@estrada9166 estrada9166 Mar 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be exported separately because it replaces this file that was removed - also we can't get the values from the resolved config bc there's no gonna be nested properties based on the testing type - just the top-level ones, so we do not now the default value if it's overridden by the one set on the config file and also we may not be able to know the default value of the testing type that is not being selected

@@ -500,6 +505,12 @@ const runtimeOptions: Array<RuntimeConfigOption> = [
validation: validate.isString,
isInternal: true,
canUpdateDuringTestTime: false,
}, {
name: 'additionalIgnorePattern',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a new config value I had missed. Will add to the changelog. Are others able to add to this or is this internal to Cypress? I'd expect the excludeSpecPattern to be leverage instead of needing to add another option as well.

Can we scope this to the component config? it appears to be specific to component testing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking below, do we need this at all? Seems like we can just pull the specPattern and it'll resolve to either the default e2e specPttern or the custom specPattern provided: https://github.com/cypress-io/cypress/pull/20677/files#diff-0349e7b425446de9ccaf2edbb623f43cffd420688dd312850417888318b9f609R162

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is only used internally when we are getting the specs for the CT we want to ignore as well the specPattern that is set on the e2e property, the reason why we can just pull the specPattern is bc know that we are removing the nested properties, we are not gonna be able to know what was the value set on the e2e, the one that is going to be on the top level is the one of the CT - so we may end up ignoring the specPattern that we are looking for

@@ -217,7 +217,7 @@ export class ProjectDataSource {

const MINIMATCH_OPTIONS = { dot: true, matchBase: true }

const { specPattern = [], excludeSpecPattern = [] } = await this.ctx.project.specPatternsForTestingType(this.ctx.currentProject, this.ctx.coreData.currentTestingType)
const { specPattern = [], excludeSpecPattern = [] } = await this.ctx.project.specPatterns()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't remove the ignoreSpecPattern config option, shouldn't it be taken into account here?

@@ -203,6 +211,11 @@ export function mergeDefaults (
throw errors.get(err, ...args)
})

delete config['e2e']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment on why this is being done? I doesn't feel obvious if I were to read this later.

estrada9166 and others added 3 commits March 23, 2022 11:51
…jandro/fix/scope-config-to-current-testing-type
…github.com:cypress-io/cypress into alejandro/fix/scope-config-to-current-testing-type
@estrada9166 estrada9166 requested review from a team as code owners March 23, 2022 23:24
@estrada9166 estrada9166 removed request for a team March 23, 2022 23:30
@estrada9166 estrada9166 merged commit 61f7cfc into 10.0-release Mar 24, 2022
@estrada9166 estrada9166 deleted the alejandro/fix/scope-config-to-current-testing-type branch March 24, 2022 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants