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 support #231

Merged
merged 8 commits into from
Feb 18, 2024
Merged

feat: nx support #231

merged 8 commits into from
Feb 18, 2024

Conversation

ffMathy
Copy link
Collaborator

@ffMathy ffMathy commented Feb 17, 2024

Builds on top of #230, so that should probably be merged first.

I had some issues getting NX working, so this PR adds a new NX sample.

The issue I was having turned out to be that when Vite runs within the sample directory, it tries to traverse upwards in directories and then would catch the root repo's vite.config.ts file, which would have an exclude section that would exclude **/src/** and others.

Now the global vite config has been renamed to avoid it accidentally being picked up in the samples.

@ffMathy ffMathy marked this pull request as ready for review February 17, 2024 15:38
@ffMathy
Copy link
Collaborator Author

ffMathy commented Feb 18, 2024

@chriswheeldon-peakon
Copy link

chriswheeldon-peakon commented Feb 19, 2024

@ffMathy is it intended, with these changes to support nx, that the working directory when running a test is the containing package rather than the monorepo root or it is still required to e.g. use vscode workspaces to achieve that?

@ffMathy
Copy link
Collaborator Author

ffMathy commented Feb 19, 2024

You can use a vitest.workspace.ts file and it should work fine from the NX monorepo root.

But there are some known bugs right now that are being fixed in the next release in the coming days.

Also note that the current extension has been deprecated and there is a new link to the new extension.

@chriswheeldon-peakon
Copy link

chriswheeldon-peakon commented Feb 19, 2024

You can use a vitest.workspace.ts file and it should work fine from the NX monorepo root.

But there are some known bugs right now that are being fixed in the next release in the coming days.

Also note that the current extension has been deprecated and there is a new link to the new extension.

Thanks @ffMathy. I'm using v0.3.0 of https://marketplace.visualstudio.com/items?itemName=vitest.explorer which I think has this change in it. Using the new sample, monorepo-nx, I find that the working directory is the repository root during test execution, whereas running the test task with nx will change the working directory to each package's root. Is that inconsistency expected, and if so do you think that is something that this extension should address or should we look for workarounds?

@ffMathy
Copy link
Collaborator Author

ffMathy commented Feb 19, 2024

0.3.0 doesn't have the bugfixes that are incoming.

Hmmm I didn't know about the working directory thing. Perhaps I should make a fix for that and create another test for that scenario.

Before my change, NX tests wouldn't run at all. So at least there's progress.

Can you file an issue with the working directory problem?

@chriswheeldon-peakon
Copy link

0.3.0 doesn't have the bugfixes that are incoming.

Hmmm I didn't know about the working directory thing. Perhaps I should make a fix for that and create another test for that scenario.

Before my change, NX tests wouldn't run at all. So at least there's progress.

Can you file an issue with the working directory problem?

Will do! Thank you!

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.

3 participants