[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

feat: source-map support, thanks @Akryum

Anthony Fu (Dec 10, 2021, 1:53 PM +0800) 7a70ffac cd06620b

+28 -4
+1
package.json
··· 86 86 "@types/node": "^16.11.12", 87 87 "@types/sade": "^1.7.3", 88 88 "@types/sinon": "^10.0.6", 89 + "@types/source-map-support": "^0.5.4", 89 90 "bumpp": "^7.1.1", 90 91 "eslint": "^8.4.1", 91 92 "esno": "^0.12.1",
+8
pnpm-lock.yaml
··· 16 16 '@types/sade': ^1.7.3 17 17 '@types/sinon': ^10.0.6 18 18 '@types/sinon-chai': ^3.2.6 19 + '@types/source-map-support': ^0.5.4 19 20 bumpp: ^7.1.1 20 21 c8: ^7.10.0 21 22 chai: ^4.3.4 ··· 82 83 '@types/node': 16.11.12 83 84 '@types/sade': 1.7.3 84 85 '@types/sinon': 10.0.6 86 + '@types/source-map-support': 0.5.4 85 87 bumpp: 7.1.1 86 88 eslint: 8.4.1 87 89 esno: 0.12.1_typescript@4.5.2 ··· 1139 1141 resolution: {integrity: sha512-6EF+wzMWvBNeGrfP3Nx60hhx+FfwSg1JJBLAAP/IdIUq0EYkqCYf70VT3PhuhPX9eLD+Dp+lNdpb/ZeHG8Yezg==} 1140 1142 dependencies: 1141 1143 '@sinonjs/fake-timers': 7.1.2 1144 + 1145 + /@types/source-map-support/0.5.4: 1146 + resolution: {integrity: sha512-9zGujX1sOPg32XLyfgEB/0G9ZnrjthL/Iv1ZfuAjj8LEilHZEpQSQs1scpRXPhHzGYgWiLz9ldF1cI8JhL+yMw==} 1147 + dependencies: 1148 + source-map: 0.6.1 1149 + dev: true 1142 1150 1143 1151 /@types/stack-utils/2.0.0: 1144 1152 resolution: {integrity: sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==}
-4
bin/vitest.mjs
··· 3 3 import { fileURLToPath } from 'url' 4 4 import { resolve } from 'path' 5 5 6 - // TODO: enable source map when public 7 - // import { install } from 'source-map-support' 8 - // install({ environment: 'node', hookRequire: true }) 9 - 10 6 const argv = process.argv.slice(2) 11 7 const filename = fileURLToPath(import.meta.url) 12 8 const entry = resolve(filename, '../../dist/node/cli.js')
+17
src/node/node.ts
··· 1 1 import { ViteDevServer } from 'vite' 2 + import { install } from 'source-map-support' 2 3 import { ResolvedConfig } from '../types' 3 4 import { ExecuteOptions, executeInViteNode, ModuleCache } from './execute' 4 5 import { transformRequest } from './transform' ··· 12 13 external: config.depsExternal, 13 14 moduleCache, 14 15 } 16 + 17 + install({ 18 + environment: 'node', 19 + hookRequire: true, 20 + handleUncaughtExceptions: true, 21 + retrieveSourceMap: (id: string) => { 22 + const map = moduleCache.get(id)?.transformResult?.map 23 + if (map) { 24 + return { 25 + url: id, 26 + map: map as any, 27 + } 28 + } 29 + return null 30 + }, 31 + }) 15 32 16 33 try { 17 34 await executeInViteNode(executeOptions)
+2
test/core/src/submodule.ts
··· 1 1 export const two = 1 + 1 2 + 3 + throw new Error('error')