mirror of
https://github.com/vitejs/vite.git
synced 2024-11-22 07:09:05 +00:00
242f550eb4
Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com> Co-authored-by: Dario Piotrowicz <dario.piotrowicz@gmail.com> Co-authored-by: Vladimir Sheremet <sleuths.slews0s@icloud.com> Co-authored-by: Arnaud Barré <arnaud.barre@carbometrix.com> Co-authored-by: Anthony Fu <github@antfu.me> Co-authored-by: Dominik G <dominik.goepel@gmx.de> Co-authored-by: Igor Minar <i@igor.dev> Co-authored-by: Viktor Lázár <lazarv1982@gmail.com> Co-authored-by: Joaquín Sánchez <userquin@gmail.com> Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Co-authored-by: bluwy <bjornlu.dev@gmail.com>
30 lines
769 B
JavaScript
30 lines
769 B
JavaScript
import { fileURLToPath } from 'node:url'
|
|
import assert from 'node:assert'
|
|
import { createServer, createServerModuleRunner } from 'vite'
|
|
|
|
// same test case as packages/vite/src/node/ssr/runtime/__tests__/server-source-maps.spec.ts
|
|
// implemented for e2e to catch build specific behavior
|
|
|
|
const server = await createServer({
|
|
configFile: false,
|
|
root: fileURLToPath(new URL('.', import.meta.url)),
|
|
server: {
|
|
middlewareMode: true,
|
|
},
|
|
})
|
|
|
|
const runner = await createServerModuleRunner(server.environments.ssr, {
|
|
sourcemapInterceptor: 'prepareStackTrace',
|
|
})
|
|
|
|
const mod = await runner.import('/src/has-error-deep.ts')
|
|
let error
|
|
try {
|
|
mod.main()
|
|
} catch (e) {
|
|
error = e
|
|
} finally {
|
|
await server.close()
|
|
}
|
|
assert.match(error?.stack, /has-error-deep.ts:6:3/)
|