-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vite): load the correct config file from @nx/vite:test executor (#…
…27514) This PR ensures that we pass Vite config file to the programmatic `startTest` API from Vitest. It fixes the issue with plugins not loading as well as other issues with the config file not being used. This mainly affects a custom `configFile` option being passed to the executor. The previous fix to additionally load in `plugins` via overrides is causing plugins to load twice when the Vite config file is picked up by Vitest (e.g. #27500). ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #27500, #22001
- Loading branch information
Showing
6 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { cleanupProject, newProject, runCLI, uniq } from '@nx/e2e/utils'; | ||
|
||
describe('Vue Plugin (legacy)', () => { | ||
let proj: string; | ||
|
||
beforeAll(() => { | ||
proj = newProject({ | ||
packages: ['@nx/vue'], | ||
unsetProjectNameAndRootFormat: false, | ||
}); | ||
}); | ||
|
||
afterAll(() => cleanupProject()); | ||
|
||
it('should serve application in dev mode', async () => { | ||
const app = uniq('app'); | ||
|
||
runCLI( | ||
`generate @nx/vue:app ${app} --unitTestRunner=vitest --e2eTestRunner=playwright`, | ||
{ env: { NX_ADD_PLUGINS: 'false' } } | ||
); | ||
let result = runCLI(`test ${app}`); | ||
expect(result).toContain(`Successfully ran target test for project ${app}`); | ||
|
||
result = runCLI(`build ${app}`); | ||
expect(result).toContain( | ||
`Successfully ran target build for project ${app}` | ||
); | ||
}, 200_000); | ||
|
||
it('should build library', async () => { | ||
const lib = uniq('lib'); | ||
|
||
runCLI( | ||
`generate @nx/vue:lib ${lib} --bundler=vite --unitTestRunner=vitest`, | ||
|
||
{ env: { NX_ADD_PLUGINS: 'false' } } | ||
); | ||
|
||
const result = runCLI(`build ${lib}`); | ||
expect(result).toContain( | ||
`Successfully ran target build for project ${lib}` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters