Skip to content
Closed
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
9 changes: 1 addition & 8 deletions packages/coverage-v8/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ type RawCoverage = Profiler.TakePreciseCoverageReturnType
// TODO: vite-node should export this
const WRAPPER_LENGTH = 185

// Note that this needs to match the line ending as well
const VITE_EXPORTS_LINE_PATTERN
= /Object\.defineProperty\(__vite_ssr_exports__.*\n/g
const DECORATOR_METADATA_PATTERN
= /_ts_metadata\("design:paramtypes", \[[^\]]*\]\),*/g
const FILE_PROTOCOL = 'file://'
Expand Down Expand Up @@ -391,15 +388,11 @@ function excludeGeneratedCode(
return map
}

if (
!source.match(VITE_EXPORTS_LINE_PATTERN)
&& !source.match(DECORATOR_METADATA_PATTERN)
) {
if (!source.match(DECORATOR_METADATA_PATTERN)) {
return map
}

const trimmed = new MagicString(source)
trimmed.replaceAll(VITE_EXPORTS_LINE_PATTERN, '\n')
trimmed.replaceAll(DECORATOR_METADATA_PATTERN, match =>
'\n'.repeat(match.split('\n').length - 1))

Expand Down