MCPcopy
hub / github.com/vitest-dev/vitest / fetch

Function fetch

packages/vitest/src/node/pools/rpc.ts:30–58  ·  view source on GitHub ↗
(
      url,
      importer,
      environmentName,
      options,
      otelCarrier,
    )

Source from the content-addressed store, hash-verified

28 project.vitest.state.metadata[project.name].dumpDir = project.config.dumpDir
29 return {
30 async fetch(
31 url,
32 importer,
33 environmentName,
34 options,
35 otelCarrier,
36 ) {
37 const environment = project.vite.environments[environmentName]
38 if (!environment) {
39 throw new Error(`The environment ${environmentName} was not defined in the Vite config.`)
40 }
41
42 const start = performance.now()
43
44 return await project._fetcher(url, importer, environment, cacheFs, options, otelCarrier).then((result) => {
45 const duration = performance.now() - start
46 project.vitest.state.transformTime += duration
47 const metadata = project.vitest.state.metadata[project.name]
48 if ('externalize' in result) {
49 metadata.externalized[url] = result.externalize
50 }
51 if ('tmp' in result) {
52 metadata.tmps[url] = result.tmp
53 }
54 metadata.duration[url] ??= []
55 metadata.duration[url].push(duration)
56 return result
57 })
58 },
59 async resolve(id, importer, environmentName) {
60 const environment = project.vite.environments[environmentName]
61 if (!environment) {

Callers 15

uploadFunction · 0.85
openInEditorFunction · 0.85
registerMetadataFunction · 0.85
createNetworkModuleMethod · 0.85
inspect.test.tsFile · 0.85
service-worker.jsFile · 0.85
basic.test.tsFile · 0.85
fetchSomethingFunction · 0.85
edge.test.tsFile · 0.85
oFunction · 0.85

Calls

no outgoing calls

Tested by 1

fetchSomethingFunction · 0.68