Skip to content

Commit

Permalink
chore: update script test-build-without-plugin-commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Jul 7, 2022
1 parent cb05946 commit e625faa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -21,7 +21,7 @@
"test": "run-s test-unit test-serve test-build",
"test-serve": "vitest run -c vitest.config.e2e.ts",
"test-build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts",
"test-build-legacy-cjs": "cross-env VITE_TEST_LEGACY_CJS_PLUGIN=1 pnpm test-build",
"test-build-without-plugin-commonjs": "cross-env VITE_TEST_WITHOUT_PLUGIN_COMMONJS=1 pnpm test-build",
"test-unit": "vitest run",
"test-docs": "pnpm run docs-build",
"debug-serve": "cross-env VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/config.ts
Expand Up @@ -563,7 +563,7 @@ export async function resolveConfig(

const optimizeDeps = config.optimizeDeps || {}

if (process.env.VITE_TEST_DISABLING_CJS_PLUGIN) {
if (process.env.VITE_TEST_WITHOUT_PLUGIN_COMMONJS) {
config.build ??= {}
config.build.commonjsOptions = { include: [] }
config.optimizeDeps ??= {}
Expand Down
13 changes: 5 additions & 8 deletions playground/optimize-deps/__tests__/optimize-deps.spec.ts
Expand Up @@ -105,14 +105,11 @@ test('vue + vuex', async () => {

// When we use the Rollup CommonJS plugin instead of esbuild prebundling,
// the esbuild plugins won't apply to dependencies
test.skipIf(isBuild && process.env.VITE_TEST_LEGACY_CJS_PLUGIN)(
'esbuild-plugin',
async () => {
expect(await page.textContent('.esbuild-plugin')).toMatch(
`Hello from an esbuild plugin`
)
}
)
test('esbuild-plugin', async () => {
expect(await page.textContent('.esbuild-plugin')).toMatch(
`Hello from an esbuild plugin`
)
})

test('import from hidden dir', async () => {
expect(await page.textContent('.hidden-dir')).toBe('hello!')
Expand Down

0 comments on commit e625faa

Please sign in to comment.