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(cypress-schematic): suffix template files so they are not ignored #23645

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

ZachJW34
Copy link
Contributor

User facing changelog

Fix cypress schematic files that were not being included in the published npm package

NOTE: Not applicable to Cypress changelog

Additional details

The folder structure for the schematic template files was recently updated but the .npmignore pattern was not, causing all of the .ts files to not be included in the published package. I opted to rename all of the .ts files to use the .template suffix, since they can contain invalid syntax and shouldn't be typechecked

Steps to test

With latest published package:

  1. Create a new angular cli application with ng new my-app (might need to npm i -g @angular/cli)
  2. cd my-app and run ng add @cypress/schematic
  3. Follow prompts (no CT testing), and check the cypress folder, it will be missing e2e/spec.cy.ts and support/**
  4. Look in node_modules/@cypress/schematic/src/schematics/ng-add/files-core, it is missing the relevant files

With local (my branch)

  1. In Cypress repo: cd npm/cypress-schematic && npm pack
  2. Inside new Angular app, run npm i @cypress/schematic@file:<absolute-path-to-tgz>cypress-schematic-0.0.0-development.tgz
  3. Revert changes made in angular app and run ng add @cypress/schematic
  4. Verify files are scaffolded correctly, check in node_modules for properly included files

How has the user experience changed?

Before:
Screen Shot 2022-08-31 at 9 45 46 AM

After:
Screen Shot 2022-08-31 at 9 46 34 AM

PR Tasks

  • [na] Have tests been added/updated?
  • [na] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?

@ZachJW34 ZachJW34 requested a review from admah August 31, 2022 14:47
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 31, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Aug 31, 2022



Test summary

39662 0 3348 0Flakiness 0


Run details

Project cypress
Status Passed
Commit dc8305c
Started Aug 31, 2022 2:41 PM
Ended Aug 31, 2022 2:56 PM
Duration 14:53 💡
OS Linux Debian - 11.3
Browser Multiple

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

Copy link
Contributor

@admah admah left a comment

Choose a reason for hiding this comment

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

LGTM

@mike-plummer
Copy link
Contributor

mike-plummer commented Aug 31, 2022

Creates file as specified, but I want to confirm expected behavior - accepting the defaults for ng add @cypress/schematic I end up with a project with E2E and CT enabled, and a single empty scaffolded e2e spec but no component spec. Feels kind of odd for something component-testing specific, but I could be over-thinking it

@ZachJW34
Copy link
Contributor Author

ZachJW34 commented Aug 31, 2022

@mike-plummer could be another bug, I believe the behavior for CT should be that it reads all of your component files and generates specs for each component it finds, will verify.

Edit: The defaults will give you all the scaffolding, but there is another option --addCtSpecs that must be specified in order for it to generate component tests. It's not bound to the prompts so it will default to false, not sure if that's intentional or not, @admah can verify here.

Copy link
Contributor

@mike-plummer mike-plummer left a comment

Choose a reason for hiding this comment

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

Approving since this change fixes the intended issue

@ZachJW34 ZachJW34 merged commit 3fd56bc into master Aug 31, 2022
@ZachJW34 ZachJW34 deleted the zachw/fix-cypress-schematic branch August 31, 2022 17:30
lmiller1990 added a commit that referenced this pull request Jan 24, 2023
* chore: release @cypress/angular-v1.1.0

[skip ci]

* chore: release @cypress/schematic-v2.1.0

[skip ci]

* chore: release @cypress/mount-utils-v2.1.0

[skip ci]

* chore: release @cypress/react-v6.2.0

[skip ci]

* chore: release @cypress/react18-v1.1.0

[skip ci]

* chore: release @cypress/svelte-v1.0.0

[skip ci]

* chore: release @cypress/vue-v4.2.0

[skip ci]

* chore: release @cypress/vue2-v1.1.0

[skip ci]

* chore: release @cypress/webpack-dev-server-v2.3.0

[skip ci]

* fix(cypress-schematic): suffix template files so they are not ignored (#23645)

* chore: release @cypress/schematic-v2.1.1

[skip ci]

* fix: Use tsconfig from build if exists (closes #23673) (#23696)

Falls back to tsconfig.json if one is not passed in

* feat: add support for generating angular component

* feat: skip default test generation

* feat: generate ct tests only if component was generated

* feat: add @cypress/schematic to schematicCollections

* feat: add documentation

* docs: document component generation

* add test

* fix generate from component with dir

* fix CI

* add variable to job defaults

* remove v13 support

Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
Co-authored-by: Ronnie Laugen <ronnie@rlaugen.no>
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: Jordan <jordan@jpdesigning.com>
Co-authored-by: Mark Noonan <mark@cypress.io>
Co-authored-by: astone123 <adams@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Blue F <blue@cypress.io>
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.

None yet

3 participants