Skip to content

Commit 3326cc9

Browse files
authored
fix: collect the duration of external imports (#9097)
1 parent ed8a2eb commit 3326cc9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/vitest/src/runtime/moduleRunner/moduleEvaluator.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export class VitestModuleEvaluator implements ModuleEvaluator {
102102

103103
const file = this.convertIdToImportUrl(id)
104104

105+
const finishModuleExecutionInfo = this.debug.startCalculateModuleExecutionInfo(file, 0)
105106
const namespace = await this._otel.$(
106107
'vitest.module.external',
107108
{
@@ -110,7 +111,9 @@ export class VitestModuleEvaluator implements ModuleEvaluator {
110111
() => this.vm
111112
? this.vm.externalModulesExecutor.import(file)
112113
: import(file),
113-
)
114+
).finally(() => {
115+
finishModuleExecutionInfo()
116+
})
114117

115118
if (!this.shouldInterop(file, namespace)) {
116119
return namespace

0 commit comments

Comments
 (0)