(method: 'run' | 'collect', state: WorkerGlobalState, traces: Traces)
| 132 | |
| 133 | /** @experimental */ |
| 134 | export async function runBaseTests(method: 'run' | 'collect', state: WorkerGlobalState, traces: Traces): Promise<void> { |
| 135 | const { ctx } = state |
| 136 | state.environment = _currentEnvironment |
| 137 | state.durations.environment = _environmentTime |
| 138 | // state has new context, but we want to reuse existing ones |
| 139 | state.evaluatedModules = evaluatedModules |
| 140 | state.moduleExecutionInfo = moduleExecutionInfo |
| 141 | |
| 142 | provideWorkerState(globalThis, state) |
| 143 | |
| 144 | if (ctx.invalidates) { |
| 145 | ctx.invalidates.forEach((filepath) => { |
| 146 | const modules = state.evaluatedModules.fileToModulesMap.get(filepath) || [] |
| 147 | modules.forEach((module) => { |
| 148 | state.evaluatedModules.invalidateModule(module) |
| 149 | }) |
| 150 | }) |
| 151 | } |
| 152 | ctx.files.forEach((i) => { |
| 153 | const filepath = i.filepath |
| 154 | const modules = state.evaluatedModules.fileToModulesMap.get(filepath) || [] |
| 155 | modules.forEach((module) => { |
| 156 | state.evaluatedModules.invalidateModule(module) |
| 157 | }) |
| 158 | }) |
| 159 | |
| 160 | const moduleRunner = await startModuleRunner({ |
| 161 | state, |
| 162 | evaluatedModules: state.evaluatedModules, |
| 163 | spyModule, |
| 164 | createImportMeta: createNodeImportMeta, |
| 165 | traces, |
| 166 | }) |
| 167 | |
| 168 | emitModuleRunner(moduleRunner as any) |
| 169 | |
| 170 | await run( |
| 171 | method, |
| 172 | ctx.files, |
| 173 | ctx.config, |
| 174 | moduleRunner, |
| 175 | _currentEnvironment, |
| 176 | traces, |
| 177 | ) |
| 178 | } |
nothing calls this directly
no test coverage detected