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: changes to correct typescript detection behavior #22058

Merged
merged 9 commits into from
Jun 2, 2022

Conversation

tgriesser
Copy link
Member

User facing changelog

  • Changes the detection to ensure typescript actually exists (via require.resolve) and is specified in dependencies / devDependencies before migrating a project to use it.
  • Improves the checks to match the algorithm of whether we should use the *tsconfig.json glob, which should only happen when we're creating a new project, not migrating an existing one. If we're migrating, looking at the existing files in the cypress folder should be enough info to make the determination.
  • Ensures we explicitly don't include .d.ts files when making the determination of JS vs. TS project

Additional details

Steps to test

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?

@tgriesser tgriesser requested review from a team as code owners June 2, 2022 19:19
@tgriesser tgriesser requested review from jennifer-shehane and removed request for a team June 2, 2022 19:19
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 2, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Jun 2, 2022



Test summary

37552 1 454 0Flakiness 5


Run details

Project cypress
Status Failed
Commit 482f29b
Started Jun 2, 2022 9:29 PM
Ended Jun 2, 2022 9:46 PM
Duration 16:20 💡
OS Linux Debian - 10.11
Browser Multiple

View run in Cypress Dashboard ➡️


Failures

cypress/e2e/commands/actions/click.cy.js Failed
1 ... > scroll-behavior > can scroll to and click elements in html with scroll-behavior: smooth

Flakiness

commands/navigation.cy.js Flakiness
1 src/cy/commands/navigation > #visit > window immediately resolves and doesn't reload when visiting the same URL with hashes
e2e/origin/commands/actions.cy.ts Flakiness
1 cy.origin actions > #consoleProps > .submit()
cypress/proxy-logging.cy.ts Flakiness
1 Proxy Logging > request logging > xhr log has response body/status code when xhr response is logged second
2 Proxy Logging > request logging > xhr log has response body/status code when xhr response is logged second
e2e/origin/commands/assertions.cy.ts Flakiness
1 cy.origin assertions > #consoleProps > .should() and .and()

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

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
@tgriesser tgriesser requested a review from mjhenkes June 2, 2022 20:13
…hub.com:cypress-io/cypress into tgriesser/fix/change-typescript-detection-rules

* 'tgriesser/fix/change-typescript-detection-rules' of github.com:cypress-io/cypress:
  Update packages/scaffold-config/src/detect.ts
@mjhenkes mjhenkes linked an issue Jun 2, 2022 that may be closed by this pull request
…hub.com:cypress-io/cypress into tgriesser/fix/change-typescript-detection-rules

* 'tgriesser/fix/change-typescript-detection-rules' of github.com:cypress-io/cypress:
  fix: do not watch specs on run mode (#22060)
  fix: #22038 support esm import for windows (#22042)
  fix: Change ffmpeg to post process at priority 20 (#21587)
Copy link
Contributor

@ZachJW34 ZachJW34 left a comment

Choose a reason for hiding this comment

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

Ran through all the scenarios, works great.

@@ -120,7 +120,24 @@ export function detectLanguage (projectRoot: string, pkgJson: PkgJson): 'js' | '
debug('Did not find cypress.config file')
}

if ('typescript' in (pkgJson.dependencies || {}) || 'typescript' in (pkgJson.devDependencies || {})) {
// If we can't find an installed TypeScript or ESBuild, there's no way we can assume the project is using TypeScript,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: or ESBuild I don't see anywhere we are checking for ESBuild

@tgriesser tgriesser merged commit 309c31f into develop Jun 2, 2022
@tgriesser tgriesser deleted the tgriesser/fix/change-typescript-detection-rules branch June 2, 2022 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants