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

feat: run all app e2e tests when configuring new sub apps #1168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MitchellCash
Copy link
Contributor

When a new SubApp is added to a project the project is now configured to run all E2E tests by default. Currently it only runs the main app E2E tests.

Closes #1167.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #1167

What is the new behavior?

It will now create a new jest-e2e.json file in the ./apps root directory containing references to each sub apps E2E test configs.

{
  "projects": [
    "apps/app-one/test/jest-e2e.json",
    "apps/app-two/test/jest-e2e.json",
    "apps/app-three/test/jest-e2e.json",
    "apps/app-four/test/jest-e2e.json"
  ]
}

And updating the the test:e2e to now run jest --config apps/jest-e2e.json

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@kamilmysliwiec this differs from the open issue slightly because as I was testing on my own monorepo with 3 sub apps, the package.json test:e2e script would come out rather long and not scalable:

"test:e2e": "jest --projects ./apps/my-app/test/jest-e2e.json ./apps/my-other-app/test/jest-e2e.json ./apps/my-different-app/test/jest-e2e.json"

So instead I opted for a dedicated jest-e2e.json that references all the different project configs.

Appreciate any and all feedback!

@MitchellCash
Copy link
Contributor Author

I should also add - why not just make the contents of ./apps/jest-e2e.json use regex to find all the spec files and remove the config from each app.

./apps/jest-e2e.json could look like this and do the same job with less Jest config files:

{
  "moduleFileExtensions": ["js", "json", "ts"],
  "rootDir": ".",
  "testEnvironment": "node",
  "testRegex": ".e2e-spec.ts$",
  "transform": {
    "^.+\\.(t|j)s$": "ts-jest"
  }
}

I decided against this because I am not sure how NestJS users modify their jest-e2e.json config per sub app. If you would prefer this approach please let me know.

When a new SubApp is added to a project the project is now configured to run all
E2E tests by default.

Closes nestjs#1167
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.

When converting project to a monorepo configure all E2E tests to be run
3 participants