-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vite-plugin-angular): honour user's test.pool choice (#1080)
- Loading branch information
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/vite-plugin-angular/src/lib/angular-vitest-plugin.spec.ts
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,33 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import { angularVitestPlugin } from './angular-vitest-plugin'; | ||
import { defineConfig, resolveConfig } from 'vite'; | ||
|
||
describe(angularVitestPlugin.name, () => { | ||
/* Setting the pool to vmThreads by default to avoid issues related to global conflicts when using JSDOM. | ||
* This also aligns with the default pool setting in Jest. | ||
* This is not ideal as vmThreads comes with its own set of issues, but it's the best option we have for now. | ||
* Cf. https://github.com/vitest-dev/vitest/issues/4685 | ||
* Cf. https://vitest.dev/config/#vmthreads */ | ||
it('should set pool to vmThreads', async () => { | ||
const config = await resolveConfig( | ||
defineConfig({ | ||
plugins: [angularVitestPlugin()], | ||
}), | ||
'serve' | ||
); | ||
expect(config.test?.pool).toBe('vmThreads'); | ||
}); | ||
|
||
it('should not override pool option if already set by user', async () => { | ||
const config = await resolveConfig( | ||
defineConfig({ | ||
plugins: [angularVitestPlugin()], | ||
test: { | ||
pool: 'threads', | ||
}, | ||
}), | ||
'serve' | ||
); | ||
expect(config.test?.pool).toBe('threads'); | ||
}); | ||
}); |
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