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(nx-plugin): Replace vsc jest extension #118

Closed
wants to merge 2 commits into from

Conversation

luxaritas
Copy link
Member

Orta.vscode-jest is much more fully featured, including things like taking advantage of the "testing" panel and automatically running tests in test files and running them inline

@luxaritas luxaritas added this to the nx-plugin-v2.0.0 milestone Aug 12, 2022
@luxaritas luxaritas requested a review from tkaragianes August 12, 2022 14:26
@luxaritas luxaritas self-assigned this Aug 12, 2022
@luxaritas
Copy link
Member Author

Need to do some additional testing here to address usage in the monorepo environment - it's not actually working as I expected

@luxaritas luxaritas force-pushed the feat/orta-jest-plugin branch from 72005a9 to 37c6edc Compare August 12, 2022 15:30
@luxaritas
Copy link
Member Author

Couple of comments on this:

  • I'm using npm run instead of nx run-many for a couple reasons. The immediate issue is Could not resolve a module for a custom reporter jest-community/vscode-jest#621 (or more specifically, Using affected:test with multiple Jest reporters fails because of flags merging nrwl/nx#3450) seems to still be an issue, so jest crashes if trying to use it with this extension. The other is that what we would be asking is for all projects to be built, since builds are a dependency on tests. If using Nx cloud (see Consider enabling nx cloud #83) that may be reasonable since we'd typically start with cached builds by default. But as-is, maybe we don't want to require a full build of everything?
  • If we take that a step farther, even if we do run an initial build, this extension is running jest in watch mode - changes to source files won't be reflected in the test results until a rebuild is done (unless of course you're already running a build in watch mode for whatever you're working on, which is admittedly probably common for most of what we're doing ie webapps). We could theoretically setup nx-spawn to handle a "run-many" scenario to run all tests and also run all dependent builds in watch mode... but I'm not convinced if we really want that performance hit.
  • Regardless, using this new extension means we're always running tests for all projects in watch mode - with a large number of packages/expensive tests, this could mean a performance hit - that's why Nx didn't suggest this by default, per VSCode Jest Extensions nrwl/nx#3868.

I'd like to hear feedback about the tradeoffs here, and whether or not we should even make this change.

@luxaritas
Copy link
Member Author

After discussing this, we've opted not to make this change. This may be a handy extension people want to use (I probably will!), but having tests run in watch mode automatically is too heavy for us to recommend by default (on top of the potential confusion around needing to build).

@luxaritas luxaritas closed this Aug 12, 2022
@luxaritas luxaritas deleted the feat/orta-jest-plugin branch August 12, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant