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(nx-plugin): move tests from 'tests' to 'src' directory #19866

Merged
merged 4 commits into from
Nov 3, 2023

Conversation

beeman
Copy link
Contributor

@beeman beeman commented Oct 26, 2023

Current Behavior

When creating a plugin my-plugin, the tests in the my-plugin-e2e project are generated in my-plugin-e2e/tests/my-plugin.spec.ts.

However, the file tsconfig.spec.json does not include the files in the tests directory but the src directory, as seen below:

{
  "extends": "./tsconfig.json",
  "compilerOptions": { "outDir": "../dist/out-tsc", "module": "commonjs", "types": [ "jest", "node" ] },
  "include": [ "jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts" ]
}

The issue with this is that you can't import code from other libraries in the -e2e project, for example an e2e-util lib.

This patch changes where these specs are generated and updates the unit test that verifies the location.

From looking at the nrwl/nx repo itself, it looks like this is the structure that's being used, the actual specs live in the src/ directory.

Expected Behavior

The code should live in a place where it's included so you can import from other libraries.

Related Issue(s)

Fixes #

  • I didn't create an issue but confirmed on Discord that this was indeed undesired behavior.

@beeman beeman requested a review from a team as a code owner October 26, 2023 01:16
@vercel
Copy link

vercel bot commented Oct 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Nov 3, 2023 1:02am

Copy link
Collaborator

@FrozenPandaz FrozenPandaz left a comment

Choose a reason for hiding this comment

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

I think it's better in src. Thank you for the contribution! 🎉

@FrozenPandaz FrozenPandaz merged commit 0f7363e into nrwl:master Nov 3, 2023
4 of 6 checks passed
FrozenPandaz pushed a commit that referenced this pull request Nov 3, 2023
Copy link

github-actions bot commented Nov 9, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2023
@beeman beeman deleted the beeman/plugin-e2e-src branch November 9, 2023 00:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants