Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 18 additions & 25 deletions playground/vue-lib/__tests__/vue-lib.spec.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
import path from 'node:path'
import type { Rollup } from 'vite'
import { build } from 'vite'
import * as vite from 'vite'
import { describe, expect, test } from 'vitest'

const isRolldownVite = 'rolldownVersion' in vite

describe('vue component library', () => {
// skip this test for now with rolldown-vite due to https://github.com/oxc-project/oxc/issues/10033
test.skipIf(isRolldownVite)(
'should output tree shakeable css module code',
async () => {
// Build lib
await build({
logLevel: 'silent',
configFile: path.resolve(__dirname, '../vite.config.lib.ts'),
})
// Build app
const { output } = (await build({
logLevel: 'silent',
configFile: path.resolve(__dirname, '../vite.config.consumer.ts'),
})) as Rollup.RollupOutput
const { code } = output.find(
(e) => e.type === 'chunk' && e.isEntry,
) as Rollup.OutputChunk
// Unused css module should be treeshaked
expect(code).toContain('styleA') // styleA is used by CompA
expect(code).not.toContain('styleB') // styleB is not used
},
)
test('should output tree shakeable css module code', async () => {
// Build lib
await build({
logLevel: 'silent',
configFile: path.resolve(__dirname, '../vite.config.lib.ts'),
})
// Build app
const { output } = (await build({
logLevel: 'silent',
configFile: path.resolve(__dirname, '../vite.config.consumer.ts'),
})) as Rollup.RollupOutput
const { code } = output.find(
(e) => e.type === 'chunk' && e.isEntry,
) as Rollup.OutputChunk
// Unused css module should be treeshaked
expect(code).toContain('styleA') // styleA is used by CompA
expect(code).not.toContain('styleB') // styleB is not used
})

test('should inject css when cssCodeSplit = true', async () => {
// Build lib
Expand Down
8 changes: 1 addition & 7 deletions vitest.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { resolve } from 'node:path'
import { defaultExclude, defineConfig } from 'vitest/config'
import * as vite from 'vite'
import { defineConfig } from 'vitest/config'

const timeout = process.env.CI ? 50000 : 30000

Expand All @@ -16,11 +15,6 @@ export default defineConfig({
},
test: {
include: ['./playground/**/*.spec.[tj]s'],
exclude: [
...defaultExclude,
// plugin-legacy is not supported with rolldown-vite
...('rolldownVersion' in vite ? ['./playground/vue-legacy/**/*'] : []),
],
setupFiles: ['./playground/vitestSetup.ts'],
globalSetup: ['./playground/vitestGlobalSetup.ts'],
testTimeout: timeout,
Expand Down
Loading