Skip to content

Commit

Permalink
test: test noExternal
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed May 10, 2024
1 parent 5ca78d6 commit c3f8691
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/vite/src/node/ssr/__tests__/resolve.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { fileURLToPath } from 'node:url'
import { describe, expect, onTestFinished, test } from 'vitest'
import { createServer } from '../../server'
import type { InlineConfig } from '../../config'

describe('exports', () => {
async function testServer() {
async function testServer(config?: InlineConfig) {
const server = await createServer({
clearScreen: false,
configFile: false,
root: fileURLToPath(new URL('.', import.meta.url)),
...config,
})
await server.pluginContainer.buildStart({})
onTestFinished(async () => {
Expand Down Expand Up @@ -47,4 +49,14 @@ describe('exports', () => {
const mod = await server.ssrLoadModule('/fixtures/entry-mix-dep')
expect(mod.default).toEqual('import')
})

test('ssrLoadModule inline', async () => {
const server = await testServer({
ssr: {
noExternal: ['@vitejs/test-mix-dep'],
},
})
const mod = await server.ssrLoadModule('/fixtures/entry-mix-dep')
expect(mod.default).toEqual('import')
})
})

0 comments on commit c3f8691

Please sign in to comment.