@powerlines/plugin-open-telemetry 0.1.123 → 0.1.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +0 -14
- package/dist/components/trace-builtin.cjs +3 -10
- package/dist/components/trace-builtin.mjs +2 -4
- package/dist/components/trace-builtin.mjs.map +1 -1
- package/dist/helpers/automd-generator.cjs +0 -8
- package/dist/helpers/automd-generator.mjs +1 -3
- package/dist/helpers/automd-generator.mjs.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +8 -63
- package/dist/_virtual/_rolldown/runtime.mjs +0 -18
- package/dist/components/trace-builtin.test.cjs +0 -16
- package/dist/components/trace-builtin.test.d.cts +0 -1
- package/dist/components/trace-builtin.test.d.mts +0 -1
- package/dist/components/trace-builtin.test.mjs +0 -18
- package/dist/components/trace-builtin.test.mjs.map +0 -1
- package/dist/helpers/automd-generator.test.cjs +0 -16
- package/dist/helpers/automd-generator.test.d.cts +0 -1
- package/dist/helpers/automd-generator.test.d.mts +0 -1
- package/dist/helpers/automd-generator.test.mjs +0 -18
- package/dist/helpers/automd-generator.test.mjs.map +0 -1
- package/dist/index.test.cjs +0 -30
- package/dist/index.test.d.cts +0 -1
- package/dist/index.test.d.mts +0 -1
- package/dist/index.test.mjs +0 -32
- package/dist/index.test.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -78
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -78
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.cjs +0 -1487
- package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.mjs +0 -1473
- package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.cjs +0 -889
- package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.mjs +0 -888
- package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.cjs +0 -1614
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.mjs +0 -1594
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/index.cjs +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/index.mjs +0 -3
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/utils.cjs +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/utils.mjs +0 -3
- package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.cjs +0 -923
- package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.mjs +0 -922
- package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.cjs +0 -391
- package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.mjs +0 -386
- package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.cjs +0 -82
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +0 -82
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.cjs +0 -1358
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.mjs +0 -1357
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.cjs +0 -561
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.mjs +0 -559
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.cjs +0 -37
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.mjs +0 -38
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.cjs +0 -197
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.mjs +0 -181
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.cjs +0 -29
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.mjs +0 -27
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.cjs +0 -77
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.mjs +0 -77
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.cjs +0 -374
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.mjs +0 -374
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.cjs +0 -38
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.mjs +0 -37
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.mjs.map +0 -1
- package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.cjs +0 -2978
- package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs +0 -2973
- package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -939
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -940
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs.map +0 -1
- package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.cjs +0 -87
- package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.mjs +0 -87
- package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.cjs +0 -6
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +0 -6
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.cjs +0 -54
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs +0 -52
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.cjs +0 -2696
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs +0 -2697
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.cjs +0 -47
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs +0 -45
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../../../../node_modules/.pnpm/@vitest+snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.js"],"sourcesContent":["import { parseErrorStacktrace } from '@vitest/utils/source-map';\nimport { isObject, getCallLastIndex } from '@vitest/utils/helpers';\nimport { positionToOffset, offsetToLineNumber, lineSplitRE } from '@vitest/utils/offset';\nimport { plugins, format } from '@vitest/pretty-format';\n\nfunction getDefaultExportFromCjs(x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, \"default\") ? x[\"default\"] : x;\n}\n\nvar naturalCompare$1 = {exports: {}};\n\nvar hasRequiredNaturalCompare;\n\nfunction requireNaturalCompare () {\n\tif (hasRequiredNaturalCompare) return naturalCompare$1.exports;\n\thasRequiredNaturalCompare = 1;\n\t/*\n\t * @version 1.4.0\n\t * @date 2015-10-26\n\t * @stability 3 - Stable\n\t * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)\n\t * @license MIT License\n\t */\n\n\n\tvar naturalCompare = function(a, b) {\n\t\tvar i, codeA\n\t\t, codeB = 1\n\t\t, posA = 0\n\t\t, posB = 0\n\t\t, alphabet = String.alphabet;\n\n\t\tfunction getCode(str, pos, code) {\n\t\t\tif (code) {\n\t\t\t\tfor (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i;\n\t\t\t\treturn +str.slice(pos - 1, i)\n\t\t\t}\n\t\t\tcode = alphabet && alphabet.indexOf(str.charAt(pos));\n\t\t\treturn code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code\n\t\t\t\t: code < 46 ? 65 // -\n\t\t\t\t: code < 48 ? code - 1\n\t\t\t\t: code < 58 ? code + 18 // 0-9\n\t\t\t\t: code < 65 ? code - 11\n\t\t\t\t: code < 91 ? code + 11 // A-Z\n\t\t\t\t: code < 97 ? code - 37\n\t\t\t\t: code < 123 ? code + 5 // a-z\n\t\t\t\t: code - 63\n\t\t}\n\n\n\t\tif ((a+=\"\") != (b+=\"\")) for (;codeB;) {\n\t\t\tcodeA = getCode(a, posA++);\n\t\t\tcodeB = getCode(b, posB++);\n\n\t\t\tif (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {\n\t\t\t\tcodeA = getCode(a, posA, posA);\n\t\t\t\tcodeB = getCode(b, posB, posA = i);\n\t\t\t\tposB = i;\n\t\t\t}\n\n\t\t\tif (codeA != codeB) return (codeA < codeB) ? -1 : 1\n\t\t}\n\t\treturn 0\n\t};\n\n\ttry {\n\t\tnaturalCompare$1.exports = naturalCompare;\n\t} catch (e) {\n\t\tString.naturalCompare = naturalCompare;\n\t}\n\treturn naturalCompare$1.exports;\n}\n\nvar naturalCompareExports = requireNaturalCompare();\nvar naturalCompare = /*@__PURE__*/getDefaultExportFromCjs(naturalCompareExports);\n\nconst serialize$1 = (val, config, indentation, depth, refs, printer) => {\n\t// Serialize a non-default name, even if config.printFunctionName is false.\n\tconst name = val.getMockName();\n\tconst nameString = name === \"vi.fn()\" ? \"\" : ` ${name}`;\n\tlet callsString = \"\";\n\tif (val.mock.calls.length !== 0) {\n\t\tconst indentationNext = indentation + config.indent;\n\t\tcallsString = ` {${config.spacingOuter}${indentationNext}\"calls\": ${printer(val.mock.calls, config, indentationNext, depth, refs)}${config.min ? \", \" : \",\"}${config.spacingOuter}${indentationNext}\"results\": ${printer(val.mock.results, config, indentationNext, depth, refs)}${config.min ? \"\" : \",\"}${config.spacingOuter}${indentation}}`;\n\t}\n\treturn `[MockFunction${nameString}]${callsString}`;\n};\nconst test = (val) => val && !!val._isMockFunction;\nconst plugin = {\n\tserialize: serialize$1,\n\ttest\n};\n\nconst { DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent, AsymmetricMatcher } = plugins;\nlet PLUGINS = [\n\tReactTestComponent,\n\tReactElement,\n\tDOMElement,\n\tDOMCollection,\n\tImmutable,\n\tAsymmetricMatcher,\n\tplugin\n];\nfunction addSerializer(plugin) {\n\tPLUGINS = [plugin].concat(PLUGINS);\n}\nfunction getSerializers() {\n\treturn PLUGINS;\n}\n\n// TODO: rewrite and clean up\nfunction testNameToKey(testName, count) {\n\treturn `${testName} ${count}`;\n}\nfunction keyToTestName(key) {\n\tif (!/ \\d+$/.test(key)) {\n\t\tthrow new Error(\"Snapshot keys must end with a number.\");\n\t}\n\treturn key.replace(/ \\d+$/, \"\");\n}\nfunction getSnapshotData(content, options) {\n\tconst update = options.updateSnapshot;\n\tconst data = Object.create(null);\n\tlet snapshotContents = \"\";\n\tlet dirty = false;\n\tif (content != null) {\n\t\ttry {\n\t\t\tsnapshotContents = content;\n\t\t\t// eslint-disable-next-line no-new-func\n\t\t\tconst populate = new Function(\"exports\", snapshotContents);\n\t\t\tpopulate(data);\n\t\t} catch {}\n\t}\n\t// const validationResult = validateSnapshotVersion(snapshotContents)\n\tconst isInvalid = snapshotContents;\n\t// if (update === 'none' && isInvalid)\n\t// throw validationResult\n\tif ((update === \"all\" || update === \"new\") && isInvalid) {\n\t\tdirty = true;\n\t}\n\treturn {\n\t\tdata,\n\t\tdirty\n\t};\n}\n// Add extra line breaks at beginning and end of multiline snapshot\n// to make the content easier to read.\nfunction addExtraLineBreaks(string) {\n\treturn string.includes(\"\\n\") ? `\\n${string}\\n` : string;\n}\n// Remove extra line breaks at beginning and end of multiline snapshot.\n// Instead of trim, which can remove additional newlines or spaces\n// at beginning or end of the content from a custom serializer.\nfunction removeExtraLineBreaks(string) {\n\treturn string.length > 2 && string[0] === \"\\n\" && string.endsWith(\"\\n\") ? string.slice(1, -1) : string;\n}\n// export const removeLinesBeforeExternalMatcherTrap = (stack: string): string => {\n// const lines = stack.split('\\n')\n// for (let i = 0; i < lines.length; i += 1) {\n// // It's a function name specified in `packages/expect/src/index.ts`\n// // for external custom matchers.\n// if (lines[i].includes('__EXTERNAL_MATCHER_TRAP__'))\n// return lines.slice(i + 1).join('\\n')\n// }\n// return stack\n// }\nconst escapeRegex = true;\nconst printFunctionName = false;\nfunction serialize(val, indent = 2, formatOverrides = {}) {\n\treturn normalizeNewlines(format(val, {\n\t\tescapeRegex,\n\t\tindent,\n\t\tplugins: getSerializers(),\n\t\tprintFunctionName,\n\t\t...formatOverrides\n\t}));\n}\nfunction escapeBacktickString(str) {\n\treturn str.replace(/`|\\\\|\\$\\{/g, \"\\\\$&\");\n}\nfunction printBacktickString(str) {\n\treturn `\\`${escapeBacktickString(str)}\\``;\n}\nfunction normalizeNewlines(string) {\n\treturn string.replace(/\\r\\n|\\r/g, \"\\n\");\n}\nasync function saveSnapshotFile(environment, snapshotData, snapshotPath) {\n\tconst snapshots = Object.keys(snapshotData).sort(naturalCompare).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`);\n\tconst content = `${environment.getHeader()}\\n\\n${snapshots.join(\"\\n\\n\")}\\n`;\n\tconst oldContent = await environment.readSnapshotFile(snapshotPath);\n\tconst skipWriting = oldContent != null && oldContent === content;\n\tif (skipWriting) {\n\t\treturn;\n\t}\n\tawait environment.saveSnapshotFile(snapshotPath, content);\n}\nfunction deepMergeArray(target = [], source = []) {\n\tconst mergedOutput = Array.from(target);\n\tsource.forEach((sourceElement, index) => {\n\t\tconst targetElement = mergedOutput[index];\n\t\tif (Array.isArray(target[index])) {\n\t\t\tmergedOutput[index] = deepMergeArray(target[index], sourceElement);\n\t\t} else if (isObject(targetElement)) {\n\t\t\tmergedOutput[index] = deepMergeSnapshot(target[index], sourceElement);\n\t\t} else {\n\t\t\t// Source does not exist in target or target is primitive and cannot be deep merged\n\t\t\tmergedOutput[index] = sourceElement;\n\t\t}\n\t});\n\treturn mergedOutput;\n}\n/**\n* Deep merge, but considers asymmetric matchers. Unlike base util's deep merge,\n* will merge any object-like instance.\n* Compatible with Jest's snapshot matcher. Should not be used outside of snapshot.\n*\n* @example\n* ```ts\n* toMatchSnapshot({\n* name: expect.stringContaining('text')\n* })\n* ```\n*/\nfunction deepMergeSnapshot(target, source) {\n\tif (isObject(target) && isObject(source)) {\n\t\tconst mergedOutput = { ...target };\n\t\tObject.keys(source).forEach((key) => {\n\t\t\tif (isObject(source[key]) && !source[key].$$typeof) {\n\t\t\t\tif (!(key in target)) {\n\t\t\t\t\tObject.assign(mergedOutput, { [key]: source[key] });\n\t\t\t\t} else {\n\t\t\t\t\tmergedOutput[key] = deepMergeSnapshot(target[key], source[key]);\n\t\t\t\t}\n\t\t\t} else if (Array.isArray(source[key])) {\n\t\t\t\tmergedOutput[key] = deepMergeArray(target[key], source[key]);\n\t\t\t} else {\n\t\t\t\tObject.assign(mergedOutput, { [key]: source[key] });\n\t\t\t}\n\t\t});\n\t\treturn mergedOutput;\n\t} else if (Array.isArray(target) && Array.isArray(source)) {\n\t\treturn deepMergeArray(target, source);\n\t}\n\treturn target;\n}\nclass DefaultMap extends Map {\n\tconstructor(defaultFn, entries) {\n\t\tsuper(entries);\n\t\tthis.defaultFn = defaultFn;\n\t}\n\tget(key) {\n\t\tif (!this.has(key)) {\n\t\t\tthis.set(key, this.defaultFn(key));\n\t\t}\n\t\treturn super.get(key);\n\t}\n}\nclass CounterMap extends DefaultMap {\n\tconstructor() {\n\t\tsuper(() => 0);\n\t}\n\t// compat for jest-image-snapshot https://github.com/vitest-dev/vitest/issues/7322\n\t// `valueOf` and `Snapshot.added` setter allows\n\t// snapshotState.added = snapshotState.added + 1\n\t// to function as\n\t// snapshotState.added.total_ = snapshotState.added.total() + 1\n\t_total;\n\tvalueOf() {\n\t\treturn this._total = this.total();\n\t}\n\tincrement(key) {\n\t\tif (typeof this._total !== \"undefined\") {\n\t\t\tthis._total++;\n\t\t}\n\t\tthis.set(key, this.get(key) + 1);\n\t}\n\ttotal() {\n\t\tif (typeof this._total !== \"undefined\") {\n\t\t\treturn this._total;\n\t\t}\n\t\tlet total = 0;\n\t\tfor (const x of this.values()) {\n\t\t\ttotal += x;\n\t\t}\n\t\treturn total;\n\t}\n}\n/* @__NO_SIDE_EFFECTS__ */\nfunction memo(fn) {\n\tconst cache = new Map();\n\treturn (arg) => {\n\t\tif (!cache.has(arg)) {\n\t\t\tcache.set(arg, fn(arg));\n\t\t}\n\t\treturn cache.get(arg);\n\t};\n}\n\nasync function saveInlineSnapshots(environment, snapshots) {\n\tconst MagicString = (await import('magic-string')).default;\n\tconst files = new Set(snapshots.map((i) => i.file));\n\tawait Promise.all(Array.from(files).map(async (file) => {\n\t\tconst snaps = snapshots.filter((i) => i.file === file);\n\t\tconst code = await environment.readSnapshotFile(file);\n\t\tif (code == null) {\n\t\t\tthrow new Error(`cannot read ${file} when saving inline snapshot`);\n\t\t}\n\t\tconst s = new MagicString(code);\n\t\tfor (const snap of snaps) {\n\t\t\tconst index = positionToOffset(code, snap.line, snap.column);\n\t\t\treplaceInlineSnap(code, s, index, snap.snapshot, snap.assertionName);\n\t\t}\n\t\tconst transformed = s.toString();\n\t\tif (transformed !== code) {\n\t\t\tawait environment.saveSnapshotFile(file, transformed);\n\t\t}\n\t}));\n}\nconst defaultStartObjectRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\\s*\\(\\s*(?:\\/\\*[\\s\\S]*\\*\\/\\s*|\\/\\/.*(?:[\\n\\r\\u2028\\u2029]\\s*|[\\t\\v\\f \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF]))*\\{/;\nfunction escapeRegExp(s) {\n\treturn s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\nconst buildStartObjectRegex = memo((assertionName) => {\n\tconst replaced = defaultStartObjectRegex.source.replace(\"toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot\", escapeRegExp(assertionName));\n\treturn new RegExp(replaced);\n});\nfunction replaceObjectSnap(code, s, index, newSnap, assertionName) {\n\tlet _code = code.slice(index);\n\tconst regex = assertionName ? buildStartObjectRegex(assertionName) : defaultStartObjectRegex;\n\tconst startMatch = regex.exec(_code);\n\tif (!startMatch) {\n\t\treturn false;\n\t}\n\t_code = _code.slice(startMatch.index);\n\tlet callEnd = getCallLastIndex(_code);\n\tif (callEnd === null) {\n\t\treturn false;\n\t}\n\tcallEnd += index + startMatch.index;\n\tconst shapeStart = index + startMatch.index + startMatch[0].length;\n\tconst shapeEnd = getObjectShapeEndIndex(code, shapeStart);\n\tconst snap = `, ${prepareSnapString(newSnap, code, index)}`;\n\tif (shapeEnd === callEnd) {\n\t\t// toMatchInlineSnapshot({ foo: expect.any(String) })\n\t\ts.appendLeft(callEnd, snap);\n\t} else {\n\t\t// toMatchInlineSnapshot({ foo: expect.any(String) }, ``)\n\t\ts.overwrite(shapeEnd, callEnd, snap);\n\t}\n\treturn true;\n}\nfunction getObjectShapeEndIndex(code, index) {\n\tlet startBraces = 1;\n\tlet endBraces = 0;\n\twhile (startBraces !== endBraces && index < code.length) {\n\t\tconst s = code[index++];\n\t\tif (s === \"{\") {\n\t\t\tstartBraces++;\n\t\t} else if (s === \"}\") {\n\t\t\tendBraces++;\n\t\t}\n\t}\n\treturn index;\n}\nfunction prepareSnapString(snap, source, index) {\n\tconst lineNumber = offsetToLineNumber(source, index);\n\tconst line = source.split(lineSplitRE)[lineNumber - 1];\n\tconst indent = line.match(/^\\s*/)[0] || \"\";\n\tconst indentNext = indent.includes(\"\t\") ? `${indent}\\t` : `${indent} `;\n\tconst lines = snap.trim().replace(/\\\\/g, \"\\\\\\\\\").split(/\\n/g);\n\tconst isOneline = lines.length <= 1;\n\tconst quote = \"`\";\n\tif (isOneline) {\n\t\treturn `${quote}${lines.join(\"\\n\").replace(/`/g, \"\\\\`\").replace(/\\$\\{/g, \"\\\\${\")}${quote}`;\n\t}\n\treturn `${quote}\\n${lines.map((i) => i ? indentNext + i : \"\").join(\"\\n\").replace(/`/g, \"\\\\`\").replace(/\\$\\{/g, \"\\\\${\")}\\n${indent}${quote}`;\n}\nconst defaultMethodNames = [\"toMatchInlineSnapshot\", \"toThrowErrorMatchingInlineSnapshot\"];\n// on webkit, the line number is at the end of the method, not at the start\nfunction getCodeStartingAtIndex(code, index, methodNames) {\n\tfor (const name of methodNames) {\n\t\tconst adjusted = index - name.length;\n\t\tif (adjusted >= 0 && code.slice(adjusted, index) === name) {\n\t\t\treturn {\n\t\t\t\tcode: code.slice(adjusted),\n\t\t\t\tindex: adjusted\n\t\t\t};\n\t\t}\n\t}\n\treturn {\n\t\tcode: code.slice(index),\n\t\tindex\n\t};\n}\nconst defaultStartRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\\s*\\(\\s*(?:\\/\\*[\\s\\S]*\\*\\/\\s*|\\/\\/.*(?:[\\n\\r\\u2028\\u2029]\\s*|[\\t\\v\\f \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF]))*[\\w$]*(['\"`)])/;\nconst buildStartRegex = memo((assertionName) => {\n\tconst replaced = defaultStartRegex.source.replace(\"toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot\", escapeRegExp(assertionName));\n\treturn new RegExp(replaced);\n});\nfunction replaceInlineSnap(code, s, currentIndex, newSnap, assertionName) {\n\tconst methodNames = assertionName ? [assertionName] : defaultMethodNames;\n\tconst { code: codeStartingAtIndex, index } = getCodeStartingAtIndex(code, currentIndex, methodNames);\n\tconst startRegex = assertionName ? buildStartRegex(assertionName) : defaultStartRegex;\n\tconst startMatch = startRegex.exec(codeStartingAtIndex);\n\tconst keywordRegex = assertionName ? new RegExp(escapeRegExp(assertionName)) : /toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot/;\n\tconst firstKeywordMatch = keywordRegex.exec(codeStartingAtIndex);\n\tif (!startMatch || startMatch.index !== firstKeywordMatch?.index) {\n\t\treturn replaceObjectSnap(code, s, index, newSnap, assertionName);\n\t}\n\tconst quote = startMatch[1];\n\tconst startIndex = index + startMatch.index + startMatch[0].length;\n\tconst snapString = prepareSnapString(newSnap, code, index);\n\tif (quote === \")\") {\n\t\ts.appendRight(startIndex - 1, snapString);\n\t\treturn true;\n\t}\n\tconst quoteEndRE = new RegExp(`(?:^|[^\\\\\\\\])${quote}`);\n\tconst endMatch = quoteEndRE.exec(code.slice(startIndex));\n\tif (!endMatch) {\n\t\treturn false;\n\t}\n\tconst endIndex = startIndex + endMatch.index + endMatch[0].length;\n\ts.overwrite(startIndex - 1, endIndex, snapString);\n\treturn true;\n}\nconst INDENTATION_REGEX = /^([^\\S\\n]*)\\S/m;\nfunction stripSnapshotIndentation(inlineSnapshot) {\n\t// Find indentation if exists.\n\tconst match = inlineSnapshot.match(INDENTATION_REGEX);\n\tif (!match || !match[1]) {\n\t\t// No indentation.\n\t\treturn inlineSnapshot;\n\t}\n\tconst indentation = match[1];\n\tconst lines = inlineSnapshot.split(/\\n/g);\n\tif (lines.length <= 2) {\n\t\t// Must be at least 3 lines.\n\t\treturn inlineSnapshot;\n\t}\n\tif (lines[0].trim() !== \"\" || lines.at(-1)?.trim() !== \"\") {\n\t\t// If not blank first and last lines, abort.\n\t\treturn inlineSnapshot;\n\t}\n\tfor (let i = 1; i < lines.length - 1; i++) {\n\t\tif (lines[i] !== \"\") {\n\t\t\tif (lines[i].indexOf(indentation) !== 0) {\n\t\t\t\t// All lines except first and last should either be blank or have the same\n\t\t\t\t// indent as the first line (or more). If this isn't the case we don't\n\t\t\t\t// want to touch the snapshot at all.\n\t\t\t\treturn inlineSnapshot;\n\t\t\t}\n\t\t\tlines[i] = lines[i].substring(indentation.length);\n\t\t}\n\t}\n\t// Last line is a special case because it won't have the same indent as others\n\t// but may still have been given some indent to line up.\n\tlines[lines.length - 1] = \"\";\n\t// Return inline snapshot, now at indent 0.\n\tinlineSnapshot = lines.join(\"\\n\");\n\treturn inlineSnapshot;\n}\n\nasync function saveRawSnapshots(environment, snapshots) {\n\tawait Promise.all(snapshots.map(async (snap) => {\n\t\tif (!snap.readonly) {\n\t\t\tawait environment.saveSnapshotFile(snap.file, snap.snapshot);\n\t\t}\n\t}));\n}\n\nfunction isSameStackPosition(x, y) {\n\treturn x.file === y.file && x.column === y.column && x.line === y.line;\n}\nclass SnapshotState {\n\t_counters = new CounterMap();\n\t_dirty;\n\t_updateSnapshot;\n\t_snapshotData;\n\t_initialData;\n\t_inlineSnapshots;\n\t_inlineSnapshotStacks;\n\t_testIdToKeys = new DefaultMap(() => []);\n\t_rawSnapshots;\n\t_uncheckedKeys;\n\t_snapshotFormat;\n\t_environment;\n\t_fileExists;\n\texpand;\n\t// getter/setter for jest-image-snapshot compat\n\t// https://github.com/vitest-dev/vitest/issues/7322\n\t_added = new CounterMap();\n\t_matched = new CounterMap();\n\t_unmatched = new CounterMap();\n\t_updated = new CounterMap();\n\tget added() {\n\t\treturn this._added;\n\t}\n\tset added(value) {\n\t\tthis._added._total = value;\n\t}\n\tget matched() {\n\t\treturn this._matched;\n\t}\n\tset matched(value) {\n\t\tthis._matched._total = value;\n\t}\n\tget unmatched() {\n\t\treturn this._unmatched;\n\t}\n\tset unmatched(value) {\n\t\tthis._unmatched._total = value;\n\t}\n\tget updated() {\n\t\treturn this._updated;\n\t}\n\tset updated(value) {\n\t\tthis._updated._total = value;\n\t}\n\tconstructor(testFilePath, snapshotPath, snapshotContent, options) {\n\t\tthis.testFilePath = testFilePath;\n\t\tthis.snapshotPath = snapshotPath;\n\t\tconst { data, dirty } = getSnapshotData(snapshotContent, options);\n\t\tthis._fileExists = snapshotContent != null;\n\t\tthis._initialData = { ...data };\n\t\tthis._snapshotData = { ...data };\n\t\tthis._dirty = dirty;\n\t\tthis._inlineSnapshots = [];\n\t\tthis._inlineSnapshotStacks = [];\n\t\tthis._rawSnapshots = [];\n\t\tthis._uncheckedKeys = new Set(Object.keys(this._snapshotData));\n\t\tthis.expand = options.expand || false;\n\t\tthis._updateSnapshot = options.updateSnapshot;\n\t\tthis._snapshotFormat = {\n\t\t\tprintBasicPrototype: false,\n\t\t\tescapeString: false,\n\t\t\tmaxOutputLength: 2 ** 27,\n\t\t\t...options.snapshotFormat\n\t\t};\n\t\tthis._environment = options.snapshotEnvironment;\n\t}\n\tstatic async create(testFilePath, options) {\n\t\tconst snapshotPath = await options.snapshotEnvironment.resolvePath(testFilePath);\n\t\tconst content = await options.snapshotEnvironment.readSnapshotFile(snapshotPath);\n\t\treturn new SnapshotState(testFilePath, snapshotPath, content, options);\n\t}\n\tget snapshotUpdateState() {\n\t\treturn this._updateSnapshot;\n\t}\n\tget environment() {\n\t\treturn this._environment;\n\t}\n\tmarkSnapshotsAsCheckedForTest(testName) {\n\t\tthis._uncheckedKeys.forEach((uncheckedKey) => {\n\t\t\t// skip snapshots with following keys\n\t\t\t// testName n\n\t\t\t// testName > xxx n (this is for toMatchSnapshot(\"xxx\") API)\n\t\t\tif (/ \\d+$| > /.test(uncheckedKey.slice(testName.length))) {\n\t\t\t\tthis._uncheckedKeys.delete(uncheckedKey);\n\t\t\t}\n\t\t});\n\t}\n\tclearTest(testId) {\n\t\t// clear inline\n\t\tthis._inlineSnapshots = this._inlineSnapshots.filter((s) => s.testId !== testId);\n\t\tthis._inlineSnapshotStacks = this._inlineSnapshotStacks.filter((s) => s.testId !== testId);\n\t\t// clear file\n\t\tfor (const key of this._testIdToKeys.get(testId)) {\n\t\t\tconst name = keyToTestName(key);\n\t\t\tconst count = this._counters.get(name);\n\t\t\tif (count > 0) {\n\t\t\t\tif (key in this._snapshotData || key in this._initialData) {\n\t\t\t\t\tthis._snapshotData[key] = this._initialData[key];\n\t\t\t\t}\n\t\t\t\tthis._counters.set(name, count - 1);\n\t\t\t}\n\t\t}\n\t\tthis._testIdToKeys.delete(testId);\n\t\t// clear stats\n\t\tthis.added.delete(testId);\n\t\tthis.updated.delete(testId);\n\t\tthis.matched.delete(testId);\n\t\tthis.unmatched.delete(testId);\n\t}\n\t_inferInlineSnapshotStack(stacks) {\n\t\t// if called inside resolves/rejects, stacktrace is different\n\t\tconst promiseIndex = stacks.findIndex((i) => i.method.match(/__VITEST_(RESOLVES|REJECTS)__/));\n\t\tif (promiseIndex !== -1) {\n\t\t\treturn stacks[promiseIndex + 3];\n\t\t}\n\t\t// support poll + inline snapshot\n\t\tconst pollChainIndex = stacks.findIndex((i) => i.method.match(/__VITEST_POLL_CHAIN__/));\n\t\tif (pollChainIndex !== -1) {\n\t\t\treturn stacks[pollChainIndex + 1];\n\t\t}\n\t\t// inline snapshot function can be named __INLINE_SNAPSHOT_OFFSET_<n>__\n\t\t// to specify a custom stack offset\n\t\tfor (let i = 0; i < stacks.length; i++) {\n\t\t\tconst match = stacks[i].method.match(/__INLINE_SNAPSHOT_OFFSET_(\\d+)__/);\n\t\t\tif (match) {\n\t\t\t\treturn stacks[i + Number(match[1])] ?? null;\n\t\t\t}\n\t\t}\n\t\t// custom matcher registered via expect.extend() — the wrapper function\n\t\t// in jest-extend.ts is named __VITEST_EXTEND_ASSERTION__\n\t\tconst customMatcherIndex = stacks.findIndex((i) => i.method.includes(\"__VITEST_EXTEND_ASSERTION__\"));\n\t\tif (customMatcherIndex !== -1) {\n\t\t\treturn stacks[customMatcherIndex + 3] ?? null;\n\t\t}\n\t\t// inline snapshot function is called __INLINE_SNAPSHOT__\n\t\t// in integrations/snapshot/chai.ts\n\t\tconst stackIndex = stacks.findIndex((i) => i.method.includes(\"__INLINE_SNAPSHOT__\"));\n\t\treturn stackIndex !== -1 ? stacks[stackIndex + 2] : null;\n\t}\n\t_addSnapshot(key, receivedSerialized, options) {\n\t\tthis._dirty = true;\n\t\tif (options.stack) {\n\t\t\tthis._inlineSnapshots.push({\n\t\t\t\t...options.stack,\n\t\t\t\tsnapshot: receivedSerialized,\n\t\t\t\ttestId: options.testId,\n\t\t\t\tassertionName: options.assertionName\n\t\t\t});\n\t\t} else if (options.rawSnapshot) {\n\t\t\tthis._rawSnapshots.push({\n\t\t\t\t...options.rawSnapshot,\n\t\t\t\tsnapshot: receivedSerialized\n\t\t\t});\n\t\t} else {\n\t\t\tthis._snapshotData[key] = receivedSerialized;\n\t\t}\n\t}\n\t_resolveKey(testId, testName, key) {\n\t\tthis._counters.increment(testName);\n\t\tconst count = this._counters.get(testName);\n\t\tif (!key) {\n\t\t\tkey = testNameToKey(testName, count);\n\t\t}\n\t\tthis._testIdToKeys.get(testId).push(key);\n\t\treturn {\n\t\t\tkey,\n\t\t\tcount\n\t\t};\n\t}\n\t_resolveInlineStack(options) {\n\t\tconst { testId, snapshot, assertionName, error } = options;\n\t\tconst stacks = parseErrorStacktrace(error, { ignoreStackEntries: [] });\n\t\tconst _stack = this._inferInlineSnapshotStack(stacks);\n\t\tif (!_stack) {\n\t\t\tconst message = stacks.map((s) => ` ${s.file}:${s.line}:${s.column}${s.method ? ` (${s.method})` : \"\"}`).join(\"\\n\");\n\t\t\tthrow new Error(`@vitest/snapshot: Couldn't infer stack frame for inline snapshot.\\n${message}`);\n\t\t}\n\t\tconst stack = this.environment.processStackTrace?.(_stack) || _stack;\n\t\t// removing 1 column, because source map points to the wrong\n\t\t// location for js files, but `column-1` points to the same in both js/ts\n\t\t// https://github.com/vitejs/vite/issues/8657\n\t\tstack.column--;\n\t\t// reject multiple inline snapshots at the same location if snapshot is different\n\t\tconst snapshotsWithSameStack = this._inlineSnapshotStacks.filter((s) => isSameStackPosition(s, stack));\n\t\tif (snapshotsWithSameStack.length > 0) {\n\t\t\t// ensure only one snapshot will be written at the same location\n\t\t\tthis._inlineSnapshots = this._inlineSnapshots.filter((s) => !isSameStackPosition(s, stack));\n\t\t\tconst differentSnapshot = snapshotsWithSameStack.find((s) => s.snapshot !== snapshot);\n\t\t\tif (differentSnapshot) {\n\t\t\t\tthrow Object.assign(new Error(`${assertionName} with different snapshots cannot be called at the same location`), {\n\t\t\t\t\tactual: snapshot,\n\t\t\t\t\texpected: differentSnapshot.snapshot\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis._inlineSnapshotStacks.push({\n\t\t\t...stack,\n\t\t\ttestId,\n\t\t\tsnapshot\n\t\t});\n\t\treturn stack;\n\t}\n\t_reconcile(opts) {\n\t\t// These are the conditions on when to write snapshots:\n\t\t// * There's no snapshot file in a non-CI environment.\n\t\t// * There is a snapshot file and we decided to update the snapshot.\n\t\t// * There is a snapshot file, but it doesn't have this snapshot.\n\t\t// These are the conditions on when not to write snapshots:\n\t\t// * The update flag is set to 'none'.\n\t\t// * There's no snapshot file or a file without this snapshot on a CI environment.\n\t\tif (opts.hasSnapshot && this._updateSnapshot === \"all\" || (!opts.hasSnapshot || !opts.snapshotIsPersisted) && (this._updateSnapshot === \"new\" || this._updateSnapshot === \"all\")) {\n\t\t\tif (this._updateSnapshot === \"all\") {\n\t\t\t\tif (!opts.pass) {\n\t\t\t\t\tif (opts.hasSnapshot) {\n\t\t\t\t\t\tthis.updated.increment(opts.testId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.added.increment(opts.testId);\n\t\t\t\t\t}\n\t\t\t\t\tthis._addSnapshot(opts.key, opts.addValue, {\n\t\t\t\t\t\tstack: opts.stack,\n\t\t\t\t\t\ttestId: opts.testId,\n\t\t\t\t\t\trawSnapshot: opts.rawSnapshot,\n\t\t\t\t\t\tassertionName: opts.assertionName\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.matched.increment(opts.testId);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._addSnapshot(opts.key, opts.addValue, {\n\t\t\t\t\tstack: opts.stack,\n\t\t\t\t\ttestId: opts.testId,\n\t\t\t\t\trawSnapshot: opts.rawSnapshot,\n\t\t\t\t\tassertionName: opts.assertionName\n\t\t\t\t});\n\t\t\t\tthis.added.increment(opts.testId);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tactual: \"\",\n\t\t\t\tcount: opts.count,\n\t\t\t\texpected: \"\",\n\t\t\t\tkey: opts.key,\n\t\t\t\tpass: true\n\t\t\t};\n\t\t} else {\n\t\t\tif (!opts.pass) {\n\t\t\t\tthis.unmatched.increment(opts.testId);\n\t\t\t\treturn {\n\t\t\t\t\tactual: opts.actualDisplay,\n\t\t\t\t\tcount: opts.count,\n\t\t\t\t\texpected: opts.expectedDisplay,\n\t\t\t\t\tkey: opts.key,\n\t\t\t\t\tpass: false\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tthis.matched.increment(opts.testId);\n\t\t\t\treturn {\n\t\t\t\t\tactual: \"\",\n\t\t\t\t\tcount: opts.count,\n\t\t\t\t\texpected: \"\",\n\t\t\t\t\tkey: opts.key,\n\t\t\t\t\tpass: true\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\tasync save() {\n\t\tconst hasExternalSnapshots = Object.keys(this._snapshotData).length;\n\t\tconst hasInlineSnapshots = this._inlineSnapshots.length;\n\t\tconst hasRawSnapshots = this._rawSnapshots.length;\n\t\tconst isEmpty = !hasExternalSnapshots && !hasInlineSnapshots && !hasRawSnapshots;\n\t\tconst status = {\n\t\t\tdeleted: false,\n\t\t\tsaved: false\n\t\t};\n\t\tif ((this._dirty || this._uncheckedKeys.size) && !isEmpty) {\n\t\t\tif (hasExternalSnapshots) {\n\t\t\t\tawait saveSnapshotFile(this._environment, this._snapshotData, this.snapshotPath);\n\t\t\t\tthis._fileExists = true;\n\t\t\t}\n\t\t\tif (hasInlineSnapshots) {\n\t\t\t\tawait saveInlineSnapshots(this._environment, this._inlineSnapshots);\n\t\t\t}\n\t\t\tif (hasRawSnapshots) {\n\t\t\t\tawait saveRawSnapshots(this._environment, this._rawSnapshots);\n\t\t\t}\n\t\t\tstatus.saved = true;\n\t\t} else if (!hasExternalSnapshots && this._fileExists) {\n\t\t\tif (this._updateSnapshot === \"all\") {\n\t\t\t\tawait this._environment.removeSnapshotFile(this.snapshotPath);\n\t\t\t\tthis._fileExists = false;\n\t\t\t}\n\t\t\tstatus.deleted = true;\n\t\t}\n\t\treturn status;\n\t}\n\tgetUncheckedCount() {\n\t\treturn this._uncheckedKeys.size || 0;\n\t}\n\tgetUncheckedKeys() {\n\t\treturn Array.from(this._uncheckedKeys);\n\t}\n\tremoveUncheckedKeys() {\n\t\tif (this._updateSnapshot === \"all\" && this._uncheckedKeys.size) {\n\t\t\tthis._dirty = true;\n\t\t\tthis._uncheckedKeys.forEach((key) => delete this._snapshotData[key]);\n\t\t\tthis._uncheckedKeys.clear();\n\t\t}\n\t}\n\tprobeExpectedSnapshot(options) {\n\t\tconst count = this._counters.get(options.testName) + 1;\n\t\tconst key = testNameToKey(options.testName, count);\n\t\treturn {\n\t\t\tkey,\n\t\t\tcount,\n\t\t\tdata: options?.isInline ? options.inlineSnapshot : this._snapshotData[key],\n\t\t\tmarkAsChecked: () => {\n\t\t\t\tthis._counters.increment(options.testName);\n\t\t\t\tthis._testIdToKeys.get(options.testId).push(key);\n\t\t\t\tthis._uncheckedKeys.delete(key);\n\t\t\t}\n\t\t};\n\t}\n\tmatch({ testId, testName, received, key, inlineSnapshot, isInline, error, rawSnapshot, assertionName }) {\n\t\tconst resolved = this._resolveKey(testId, testName, key);\n\t\tkey = resolved.key;\n\t\tconst count = resolved.count;\n\t\t// Do not mark the snapshot as \"checked\" if the snapshot is inline and\n\t\t// there's an external snapshot. This way the external snapshot can be\n\t\t// removed with `--updateSnapshot`.\n\t\tif (!(isInline && this._snapshotData[key] !== undefined)) {\n\t\t\tthis._uncheckedKeys.delete(key);\n\t\t}\n\t\tlet receivedSerialized = rawSnapshot && typeof received === \"string\" ? received : serialize(received, undefined, this._snapshotFormat);\n\t\tif (!rawSnapshot) {\n\t\t\treceivedSerialized = addExtraLineBreaks(receivedSerialized);\n\t\t}\n\t\tif (rawSnapshot) {\n\t\t\t// normalize EOL when snapshot contains CRLF but received is LF\n\t\t\tif (rawSnapshot.content && rawSnapshot.content.match(/\\r\\n/) && !receivedSerialized.match(/\\r\\n/)) {\n\t\t\t\trawSnapshot.content = normalizeNewlines(rawSnapshot.content);\n\t\t\t}\n\t\t}\n\t\tconst expected = isInline ? inlineSnapshot : rawSnapshot ? rawSnapshot.content : this._snapshotData[key];\n\t\tconst expectedTrimmed = rawSnapshot ? expected : expected?.trim();\n\t\tconst pass = expectedTrimmed === (rawSnapshot ? receivedSerialized : receivedSerialized.trim());\n\t\tconst hasSnapshot = expected !== undefined;\n\t\tconst snapshotIsPersisted = isInline || this._fileExists || rawSnapshot && rawSnapshot.content != null;\n\t\tif (pass && !isInline && !rawSnapshot) {\n\t\t\t// When the file is re-saved (because other snapshots changed), the JS\n\t\t\t// round-trip can lose proper escaping. Refresh in-memory data with the\n\t\t\t// freshly serialized string so the file is written correctly.\n\t\t\t// _reconcile does not write _snapshotData on pass, so this is the only\n\t\t\t// place it gets refreshed. Domain snapshots skip this because the stored\n\t\t\t// value may contain match patterns that differ from the received output.\n\t\t\tthis._snapshotData[key] = receivedSerialized;\n\t\t}\n\t\tconst stack = isInline ? this._resolveInlineStack({\n\t\t\ttestId,\n\t\t\tsnapshot: receivedSerialized,\n\t\t\tassertionName: assertionName || \"toMatchInlineSnapshot\",\n\t\t\terror: error || new Error(\"snapshot\")\n\t\t}) : undefined;\n\t\treturn this._reconcile({\n\t\t\ttestId,\n\t\t\tkey,\n\t\t\tcount,\n\t\t\tpass,\n\t\t\thasSnapshot,\n\t\t\tsnapshotIsPersisted: !!snapshotIsPersisted,\n\t\t\taddValue: receivedSerialized,\n\t\t\tactualDisplay: rawSnapshot ? receivedSerialized : removeExtraLineBreaks(receivedSerialized),\n\t\t\texpectedDisplay: expectedTrimmed !== undefined ? rawSnapshot ? expectedTrimmed : removeExtraLineBreaks(expectedTrimmed) : undefined,\n\t\t\tstack,\n\t\t\trawSnapshot,\n\t\t\tassertionName\n\t\t});\n\t}\n\tprocessDomainSnapshot({ testId, received, expectedSnapshot, matchResult, isInline, error, assertionName }) {\n\t\tconst stack = isInline ? this._resolveInlineStack({\n\t\t\ttestId,\n\t\t\tsnapshot: received,\n\t\t\tassertionName,\n\t\t\terror: error || new Error(\"STACK_TRACE_ERROR\")\n\t\t}) : undefined;\n\t\tconst actualResolved = matchResult?.resolved ?? received;\n\t\tconst expectedResolved = matchResult?.expected ?? expectedSnapshot.data;\n\t\treturn this._reconcile({\n\t\t\ttestId,\n\t\t\tkey: expectedSnapshot.key,\n\t\t\tcount: expectedSnapshot.count,\n\t\t\tpass: matchResult?.pass ?? false,\n\t\t\thasSnapshot: !!expectedSnapshot.data,\n\t\t\tsnapshotIsPersisted: isInline ? true : this._fileExists,\n\t\t\taddValue: actualResolved,\n\t\t\tactualDisplay: removeExtraLineBreaks(actualResolved),\n\t\t\texpectedDisplay: expectedResolved !== undefined ? removeExtraLineBreaks(expectedResolved) : undefined,\n\t\t\tstack,\n\t\t\tassertionName\n\t\t});\n\t}\n\tasync pack() {\n\t\tconst snapshot = {\n\t\t\tfilepath: this.testFilePath,\n\t\t\tadded: 0,\n\t\t\tfileDeleted: false,\n\t\t\tmatched: 0,\n\t\t\tunchecked: 0,\n\t\t\tuncheckedKeys: [],\n\t\t\tunmatched: 0,\n\t\t\tupdated: 0\n\t\t};\n\t\tconst uncheckedCount = this.getUncheckedCount();\n\t\tconst uncheckedKeys = this.getUncheckedKeys();\n\t\tif (uncheckedCount) {\n\t\t\tthis.removeUncheckedKeys();\n\t\t}\n\t\tconst status = await this.save();\n\t\tsnapshot.fileDeleted = status.deleted;\n\t\tsnapshot.added = this.added.total();\n\t\tsnapshot.matched = this.matched.total();\n\t\tsnapshot.unmatched = this.unmatched.total();\n\t\tsnapshot.updated = this.updated.total();\n\t\tsnapshot.unchecked = !status.deleted ? uncheckedCount : 0;\n\t\tsnapshot.uncheckedKeys = Array.from(uncheckedKeys);\n\t\treturn snapshot;\n\t}\n}\n\nfunction createMismatchError(message, expand, actual, expected) {\n\tconst error = new Error(message);\n\tObject.defineProperty(error, \"actual\", {\n\t\tvalue: actual,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t\twritable: true\n\t});\n\tObject.defineProperty(error, \"expected\", {\n\t\tvalue: expected,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t\twritable: true\n\t});\n\tObject.defineProperty(error, \"diffOptions\", { value: { expand } });\n\treturn error;\n}\nclass SnapshotClient {\n\tsnapshotStateMap = new Map();\n\tconstructor(options = {}) {\n\t\tthis.options = options;\n\t}\n\tasync setup(filepath, options) {\n\t\tif (this.snapshotStateMap.has(filepath)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.snapshotStateMap.set(filepath, await SnapshotState.create(filepath, options));\n\t}\n\tasync finish(filepath) {\n\t\tconst state = this.getSnapshotState(filepath);\n\t\tconst result = await state.pack();\n\t\tthis.snapshotStateMap.delete(filepath);\n\t\treturn result;\n\t}\n\tskipTest(filepath, testName) {\n\t\tconst state = this.getSnapshotState(filepath);\n\t\tstate.markSnapshotsAsCheckedForTest(testName);\n\t}\n\tclearTest(filepath, testId) {\n\t\tconst state = this.getSnapshotState(filepath);\n\t\tstate.clearTest(testId);\n\t}\n\tgetSnapshotState(filepath) {\n\t\tconst state = this.snapshotStateMap.get(filepath);\n\t\tif (!state) {\n\t\t\tthrow new Error(`The snapshot state for '${filepath}' is not found. Did you call 'SnapshotClient.setup()'?`);\n\t\t}\n\t\treturn state;\n\t}\n\tmatch(options) {\n\t\tconst { filepath, name, testId = name, message, isInline = false, properties, inlineSnapshot, error, errorMessage, rawSnapshot, assertionName } = options;\n\t\tlet { received } = options;\n\t\tif (!filepath) {\n\t\t\tthrow new Error(\"Snapshot cannot be used outside of test\");\n\t\t}\n\t\tconst snapshotState = this.getSnapshotState(filepath);\n\t\tconst testName = [name, ...message ? [message] : []].join(\" > \");\n\t\t// Probe first so we can mark as checked even on early return\n\t\tconst expectedSnapshot = snapshotState.probeExpectedSnapshot({\n\t\t\ttestName,\n\t\t\ttestId,\n\t\t\tisInline,\n\t\t\tinlineSnapshot\n\t\t});\n\t\tif (typeof properties === \"object\") {\n\t\t\tif (typeof received !== \"object\" || !received) {\n\t\t\t\texpectedSnapshot.markAsChecked();\n\t\t\t\tthrow new Error(\"Received value must be an object when the matcher has properties\");\n\t\t\t}\n\t\t\tlet propertiesPass;\n\t\t\ttry {\n\t\t\t\tpropertiesPass = this.options.isEqual?.(received, properties) ?? false;\n\t\t\t} catch (err) {\n\t\t\t\texpectedSnapshot.markAsChecked();\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tif (!propertiesPass) {\n\t\t\t\texpectedSnapshot.markAsChecked();\n\t\t\t\treturn {\n\t\t\t\t\tpass: false,\n\t\t\t\t\tmessage: () => errorMessage || \"Snapshot properties mismatched\",\n\t\t\t\t\tactual: received,\n\t\t\t\t\texpected: properties\n\t\t\t\t};\n\t\t\t}\n\t\t\treceived = deepMergeSnapshot(received, properties);\n\t\t}\n\t\tconst { actual, expected, key, pass } = snapshotState.match({\n\t\t\ttestId,\n\t\t\ttestName,\n\t\t\treceived,\n\t\t\tisInline,\n\t\t\terror,\n\t\t\tinlineSnapshot,\n\t\t\trawSnapshot,\n\t\t\tassertionName\n\t\t});\n\t\treturn {\n\t\t\tpass,\n\t\t\tmessage: () => `Snapshot \\`${key || \"unknown\"}\\` mismatched`,\n\t\t\tactual: rawSnapshot ? actual : actual?.trim(),\n\t\t\texpected: rawSnapshot ? expected : expected?.trim()\n\t\t};\n\t}\n\tassert(options) {\n\t\tconst result = this.match(options);\n\t\tif (!result.pass) {\n\t\t\tconst snapshotState = this.getSnapshotState(options.filepath);\n\t\t\tthrow createMismatchError(result.message(), snapshotState.expand, result.actual, result.expected);\n\t\t}\n\t}\n\tmatchDomain(options) {\n\t\tconst { received, filepath, name, testId = name, message, adapter, isInline = false, inlineSnapshot, error } = options;\n\t\tif (!filepath) {\n\t\t\tthrow new Error(\"Snapshot cannot be used outside of test\");\n\t\t}\n\t\tconst captured = adapter.capture(received);\n\t\tconst rendered = adapter.render(captured);\n\t\tconst snapshotState = this.getSnapshotState(filepath);\n\t\tconst testName = [name, ...message ? [message] : []].join(\" > \");\n\t\tconst expectedSnapshot = snapshotState.probeExpectedSnapshot({\n\t\t\ttestName,\n\t\t\ttestId,\n\t\t\tisInline,\n\t\t\tinlineSnapshot\n\t\t});\n\t\texpectedSnapshot.markAsChecked();\n\t\tconst matchResult = expectedSnapshot.data ? adapter.match(captured, adapter.parseExpected(expectedSnapshot.data)) : undefined;\n\t\tconst { actual, expected, key, pass } = snapshotState.processDomainSnapshot({\n\t\t\ttestId,\n\t\t\treceived: rendered,\n\t\t\texpectedSnapshot,\n\t\t\tmatchResult,\n\t\t\tisInline,\n\t\t\terror,\n\t\t\tassertionName: options.assertionName\n\t\t});\n\t\treturn {\n\t\t\tpass,\n\t\t\tmessage: () => `Snapshot \\`${key}\\` mismatched`,\n\t\t\tactual: actual?.trim(),\n\t\t\texpected: expected?.trim()\n\t\t};\n\t}\n\tasync pollMatchDomain(options) {\n\t\tconst { poll, filepath, name, testId = name, message, adapter, isInline = false, inlineSnapshot, error, timeout = 1e3, interval = 50 } = options;\n\t\tif (!filepath) {\n\t\t\tthrow new Error(\"Snapshot cannot be used outside of test\");\n\t\t}\n\t\tconst snapshotState = this.getSnapshotState(filepath);\n\t\tconst testName = [name, ...message ? [message] : []].join(\" > \");\n\t\tconst expectedSnapshot = snapshotState.probeExpectedSnapshot({\n\t\t\ttestName,\n\t\t\ttestId,\n\t\t\tisInline,\n\t\t\tinlineSnapshot\n\t\t});\n\t\tconst reference = expectedSnapshot.data && snapshotState.snapshotUpdateState !== \"all\" ? adapter.parseExpected(expectedSnapshot.data) : undefined;\n\t\tconst timedOut = timeout > 0 ? new Promise((r) => setTimeout(r, timeout)) : undefined;\n\t\tconst stableResult = await getStableSnapshot({\n\t\t\tadapter,\n\t\t\tpoll,\n\t\t\tinterval,\n\t\t\ttimedOut,\n\t\t\tmatch: reference ? (captured) => adapter.match(captured, reference).pass : undefined\n\t\t});\n\t\texpectedSnapshot.markAsChecked();\n\t\tif (!stableResult?.rendered) {\n\t\t\t// the original caller `expect.poll` later manipulates error via `throwWithCause`,\n\t\t\t// so here we can directly throw `lastPollError` if exists.\n\t\t\tif (stableResult?.lastPollError) {\n\t\t\t\tthrow stableResult.lastPollError;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => `poll() did not produce a stable snapshot within the timeout`\n\t\t\t};\n\t\t}\n\t\t// TODO: should `all` mode ignore parse error?\n\t\t// Sielently hiding the error and creating snaphsot full scratch isn't good either.\n\t\t// Users can fix or purge the broken snapshot manually and that decision affects how domain snapshot gets updated.\n\t\tconst matchResult = expectedSnapshot.data ? adapter.match(stableResult.captured, adapter.parseExpected(expectedSnapshot.data)) : undefined;\n\t\tconst { actual, expected, key, pass } = snapshotState.processDomainSnapshot({\n\t\t\ttestId,\n\t\t\treceived: stableResult.rendered,\n\t\t\texpectedSnapshot,\n\t\t\tmatchResult,\n\t\t\tisInline,\n\t\t\terror,\n\t\t\tassertionName: options.assertionName\n\t\t});\n\t\treturn {\n\t\t\tpass,\n\t\t\tmessage: () => `Snapshot \\`${key}\\` mismatched`,\n\t\t\tactual: actual?.trim(),\n\t\t\texpected: expected?.trim()\n\t\t};\n\t}\n\tasync assertRaw(options) {\n\t\tif (!options.rawSnapshot) {\n\t\t\tthrow new Error(\"Raw snapshot is required\");\n\t\t}\n\t\tconst { filepath, rawSnapshot } = options;\n\t\tif (rawSnapshot.content == null) {\n\t\t\tif (!filepath) {\n\t\t\t\tthrow new Error(\"Snapshot cannot be used outside of test\");\n\t\t\t}\n\t\t\tconst snapshotState = this.getSnapshotState(filepath);\n\t\t\t// save the filepath, so it don't lose even if the await make it out-of-context\n\t\t\toptions.filepath ||= filepath;\n\t\t\t// resolve and read the raw snapshot file\n\t\t\trawSnapshot.file = await snapshotState.environment.resolveRawPath(filepath, rawSnapshot.file);\n\t\t\trawSnapshot.content = await snapshotState.environment.readSnapshotFile(rawSnapshot.file) ?? undefined;\n\t\t}\n\t\treturn this.assert(options);\n\t}\n\tclear() {\n\t\tthis.snapshotStateMap.clear();\n\t}\n}\n/**\n* Polls repeatedly until the value reaches a stable state.\n*\n* Compares consecutive rendered outputs from the current session —\n* when two consecutive polls produce the same rendered string,\n* the value is considered stable.\n*\n* Every `await` (poll call, interval delay) races against `timedOut`\n* so that hanging polls and delays are interrupted.\n*/\nasync function getStableSnapshot({ adapter, poll, interval, timedOut, match }) {\n\tlet lastRendered;\n\tlet lastPollError;\n\tlet lastStable;\n\twhile (true) {\n\t\ttry {\n\t\t\tconst pollResult = await raceWith(Promise.resolve(poll()), timedOut);\n\t\t\tif (!pollResult.ok) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tconst captured = adapter.capture(pollResult.value);\n\t\t\tconst rendered = adapter.render(captured);\n\t\t\tif (lastRendered !== undefined && rendered === lastRendered) {\n\t\t\t\tlastStable = {\n\t\t\t\t\tcaptured,\n\t\t\t\t\trendered\n\t\t\t\t};\n\t\t\t\tif (!match || match(captured)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlastRendered = rendered;\n\t\t\t\tlastStable = undefined;\n\t\t\t}\n\t\t} catch (pollError) {\n\t\t\t// poll() threw — reset stability baseline and retry\n\t\t\tlastRendered = undefined;\n\t\t\tlastStable = undefined;\n\t\t\tlastPollError = pollError;\n\t\t}\n\t\tconst delayed = await raceWith(new Promise((r) => setTimeout(r, interval)), timedOut);\n\t\tif (!delayed.ok) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn {\n\t\t...lastStable,\n\t\tlastPollError\n\t};\n}\n/** Type-safe `Promise.race` — tells you which promise won. */\nfunction raceWith(promise, other) {\n\tconst left = promise.then((value) => ({\n\t\tok: true,\n\t\tvalue\n\t}));\n\tif (!other) {\n\t\treturn left;\n\t}\n\treturn Promise.race([left, other.then((value) => ({\n\t\tok: false,\n\t\tvalue\n\t}))]);\n}\n\nexport { SnapshotClient, SnapshotState, addSerializer, getSerializers, stripSnapshotIndentation };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;CAKA,OAAS,KAAA,EAAA,cAAA,OAA2B,UAAA,eAAA,KAAA,GAAA,SAAA,IAAA,EAAA,aAAA;AACpC;AACA,IAAA,mBAAA,cAEA;;AAEA,SAAI,wBAAyB;;CAE7B,4BAA8B;;;;;;;;CAS5B,IAAC,iBAAA,SAAA,GAAA,GAAA;gBAGE,QAAA,GACC,OAAG,GACL,OAAQ,GACR,WAAO,OAAA;EACP,SAAO,QAAA,KAAA,KAAA,MAAA;GACP,IAAA,MAAW;;IAEb,OAAS,CAAA,IAAQ,MAAK,MAAK,GAAM,CAAA;GAC7B;GACF,OAAS,YAAY,SAAQ,QAAS,IAAI,OAAO,GAAE,CAAA;GACnD,OAAQ,OAAI,KAAS,OAAO,MAAA,OAAA,IAAA,WAAA,GAAA,K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A,cAAA,iBAAA,IAAA,IAAA;EAElD,MAAM,eAAS,MAAA,kBAAkC;GAC5C;GACA;GACA;GACC,UALL,UAAA,IAAA,IAAA,SAAA,MAAA,WAAA,GAAA,OAAA,CAAA,IAAA;GAMK,OAAA,aAAA,aAAA,QAAA,MAAA,UAAA,SAAA,EAAA,OAAA;EACH,CAAA;EACA,iBAAkB,cAAE;EACnB,IAAA,CAAK,cAAA,UAAA;GAGN,IAAM,cAAW,eACb,MAAA,aAAiB;GAEnB,OAAQ;IACR,MAAA;IACA,eAAA;GACC;EACF;EAIA,MAAA,cAAa,iBAAS,OAAA,QAAA,MAAA,aAAA,UAAA,QAAA,cAAA,iBAAA,IAAA,CAAA,IAAA;EACvB,MAAA,EACC,QACE,UACH,KACA,SACA,cAAgB,sBAAS;GAC1B;GACA,UAAc,aAAQ;GAClB;GACH;GACD;GACD;GACA,eAAO,QAAA;EACJ,CAAC;EACH,OAAA;GACA;GACF,eAAA,cAAA,IAAA;GACI,QAAU,QAAQ,KAAK;GAC3B,UAAS,UAAiB,KAAC;EAC1B;CACC;CACA,MAAA,UAAA,SAAA;EACE,IAAA,CAAA,QAAA,aACE,MAAM,IAAC,MAAA,0BAAA;EAEZ,MAAA,EACA,UACK,gBACJ;EACE,IAAE,YAAA,WAAA,MAAA;GACN,IAAA,CAAA"}
|
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region ../../../node_modules/.pnpm/@vitest+spy@4.1.7/node_modules/@vitest/spy/dist/index.js
|
|
3
|
-
function isMockFunction(fn) {
|
|
4
|
-
return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction === true;
|
|
5
|
-
}
|
|
6
|
-
const MOCK_RESTORE = /* @__PURE__ */ new Set();
|
|
7
|
-
const REGISTERED_MOCKS = /* @__PURE__ */ new Set();
|
|
8
|
-
const MOCK_CONFIGS = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
function createMockInstance(options = {}) {
|
|
10
|
-
const { originalImplementation, restore, mockImplementation, resetToMockImplementation, resetToMockName } = options;
|
|
11
|
-
if (restore) MOCK_RESTORE.add(restore);
|
|
12
|
-
const config = getDefaultConfig(originalImplementation);
|
|
13
|
-
const state = getDefaultState();
|
|
14
|
-
const mock = createMock({
|
|
15
|
-
config,
|
|
16
|
-
state,
|
|
17
|
-
...options
|
|
18
|
-
});
|
|
19
|
-
const mockLength = (mockImplementation || originalImplementation)?.length ?? 0;
|
|
20
|
-
Object.defineProperty(mock, "length", {
|
|
21
|
-
writable: true,
|
|
22
|
-
enumerable: false,
|
|
23
|
-
value: mockLength,
|
|
24
|
-
configurable: true
|
|
25
|
-
});
|
|
26
|
-
if (resetToMockName) config.mockName = mock.name || "vi.fn()";
|
|
27
|
-
MOCK_CONFIGS.set(mock, config);
|
|
28
|
-
REGISTERED_MOCKS.add(mock);
|
|
29
|
-
mock._isMockFunction = true;
|
|
30
|
-
mock.getMockImplementation = () => {
|
|
31
|
-
return config.onceMockImplementations[0] || config.mockImplementation;
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(mock, "mock", {
|
|
34
|
-
configurable: false,
|
|
35
|
-
enumerable: true,
|
|
36
|
-
writable: false,
|
|
37
|
-
value: state
|
|
38
|
-
});
|
|
39
|
-
mock.mockImplementation = function mockImplementation(implementation) {
|
|
40
|
-
config.mockImplementation = implementation;
|
|
41
|
-
return mock;
|
|
42
|
-
};
|
|
43
|
-
mock.mockImplementationOnce = function mockImplementationOnce(implementation) {
|
|
44
|
-
config.onceMockImplementations.push(implementation);
|
|
45
|
-
return mock;
|
|
46
|
-
};
|
|
47
|
-
mock.withImplementation = function withImplementation(implementation, callback) {
|
|
48
|
-
const previousImplementation = config.mockImplementation;
|
|
49
|
-
const previousOnceImplementations = config.onceMockImplementations;
|
|
50
|
-
const reset = () => {
|
|
51
|
-
config.mockImplementation = previousImplementation;
|
|
52
|
-
config.onceMockImplementations = previousOnceImplementations;
|
|
53
|
-
};
|
|
54
|
-
config.mockImplementation = implementation;
|
|
55
|
-
config.onceMockImplementations = [];
|
|
56
|
-
const returnValue = callback();
|
|
57
|
-
if (typeof returnValue === "object" && typeof returnValue?.then === "function") return returnValue.then(() => {
|
|
58
|
-
reset();
|
|
59
|
-
return mock;
|
|
60
|
-
});
|
|
61
|
-
else reset();
|
|
62
|
-
return mock;
|
|
63
|
-
};
|
|
64
|
-
mock.mockReturnThis = function mockReturnThis() {
|
|
65
|
-
return mock.mockImplementation(function() {
|
|
66
|
-
return this;
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
mock.mockReturnValue = function mockReturnValue(value) {
|
|
70
|
-
return mock.mockImplementation(function() {
|
|
71
|
-
if (new.target) throwConstructorError("mockReturnValue");
|
|
72
|
-
return value;
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
mock.mockReturnValueOnce = function mockReturnValueOnce(value) {
|
|
76
|
-
return mock.mockImplementationOnce(function() {
|
|
77
|
-
if (new.target) throwConstructorError("mockReturnValueOnce");
|
|
78
|
-
return value;
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
mock.mockThrow = function mockThrow(value) {
|
|
82
|
-
return mock.mockImplementation(function() {
|
|
83
|
-
throw value;
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
mock.mockThrowOnce = function mockThrowOnce(value) {
|
|
87
|
-
return mock.mockImplementationOnce(function() {
|
|
88
|
-
throw value;
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
mock.mockResolvedValue = function mockResolvedValue(value) {
|
|
92
|
-
return mock.mockImplementation(function() {
|
|
93
|
-
if (new.target) throwConstructorError("mockResolvedValue");
|
|
94
|
-
return Promise.resolve(value);
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
mock.mockResolvedValueOnce = function mockResolvedValueOnce(value) {
|
|
98
|
-
return mock.mockImplementationOnce(function() {
|
|
99
|
-
if (new.target) throwConstructorError("mockResolvedValueOnce");
|
|
100
|
-
return Promise.resolve(value);
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
mock.mockRejectedValue = function mockRejectedValue(value) {
|
|
104
|
-
return mock.mockImplementation(function() {
|
|
105
|
-
if (new.target) throwConstructorError("mockRejectedValue");
|
|
106
|
-
return Promise.reject(value);
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
mock.mockRejectedValueOnce = function mockRejectedValueOnce(value) {
|
|
110
|
-
return mock.mockImplementationOnce(function() {
|
|
111
|
-
if (new.target) throwConstructorError("mockRejectedValueOnce");
|
|
112
|
-
return Promise.reject(value);
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
mock.mockClear = function mockClear() {
|
|
116
|
-
state.calls = [];
|
|
117
|
-
state.contexts = [];
|
|
118
|
-
state.instances = [];
|
|
119
|
-
state.invocationCallOrder = [];
|
|
120
|
-
state.results = [];
|
|
121
|
-
state.settledResults = [];
|
|
122
|
-
return mock;
|
|
123
|
-
};
|
|
124
|
-
mock.mockReset = function mockReset() {
|
|
125
|
-
mock.mockClear();
|
|
126
|
-
config.mockImplementation = resetToMockImplementation ? mockImplementation : void 0;
|
|
127
|
-
config.mockName = resetToMockName ? mock.name || "vi.fn()" : "vi.fn()";
|
|
128
|
-
config.onceMockImplementations = [];
|
|
129
|
-
return mock;
|
|
130
|
-
};
|
|
131
|
-
mock.mockRestore = function mockRestore() {
|
|
132
|
-
mock.mockReset();
|
|
133
|
-
return restore?.();
|
|
134
|
-
};
|
|
135
|
-
mock.mockName = function mockName(name) {
|
|
136
|
-
if (typeof name === "string") config.mockName = name;
|
|
137
|
-
return mock;
|
|
138
|
-
};
|
|
139
|
-
mock.getMockName = function getMockName() {
|
|
140
|
-
return config.mockName || "vi.fn()";
|
|
141
|
-
};
|
|
142
|
-
if (Symbol.dispose) mock[Symbol.dispose] = () => mock.mockRestore();
|
|
143
|
-
if (mockImplementation) mock.mockImplementation(mockImplementation);
|
|
144
|
-
return mock;
|
|
145
|
-
}
|
|
146
|
-
function fn(originalImplementation) {
|
|
147
|
-
if (originalImplementation != null && isMockFunction(originalImplementation)) return originalImplementation;
|
|
148
|
-
return createMockInstance({
|
|
149
|
-
mockImplementation: originalImplementation,
|
|
150
|
-
resetToMockImplementation: true
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function spyOn(object, key, accessor) {
|
|
154
|
-
assert(object != null, "The vi.spyOn() function could not find an object to spy upon. The first argument must be defined.");
|
|
155
|
-
assert(typeof object === "object" || typeof object === "function", "Vitest cannot spy on a primitive value.");
|
|
156
|
-
const [originalDescriptorObject, originalDescriptor] = getDescriptor(object, key) || [];
|
|
157
|
-
assert(originalDescriptor || key in object, `The property "${String(key)}" is not defined on the ${typeof object}.`);
|
|
158
|
-
let accessType = accessor || "value";
|
|
159
|
-
let ssr = false;
|
|
160
|
-
if (accessType === "value" && originalDescriptor && originalDescriptor.value == null && originalDescriptor.get) {
|
|
161
|
-
accessType = "get";
|
|
162
|
-
ssr = true;
|
|
163
|
-
}
|
|
164
|
-
let original;
|
|
165
|
-
if (originalDescriptor) {
|
|
166
|
-
original = originalDescriptor[accessType];
|
|
167
|
-
if (original == null && accessType === "value") original = object[key];
|
|
168
|
-
} else if (accessType !== "value") original = () => object[key];
|
|
169
|
-
else original = object[key];
|
|
170
|
-
const originalImplementation = ssr && original ? original() : original;
|
|
171
|
-
const originalType = typeof originalImplementation;
|
|
172
|
-
assert(originalType === "function" || accessType !== "value" && original == null, `vi.spyOn() can only spy on a function. Received ${originalType}.`);
|
|
173
|
-
if (isMockFunction(originalImplementation)) return originalImplementation;
|
|
174
|
-
const reassign = (cb) => {
|
|
175
|
-
const { value, ...desc } = originalDescriptor || {
|
|
176
|
-
configurable: true,
|
|
177
|
-
writable: true
|
|
178
|
-
};
|
|
179
|
-
if (accessType !== "value") delete desc.writable;
|
|
180
|
-
desc[accessType] = cb;
|
|
181
|
-
Object.defineProperty(object, key, desc);
|
|
182
|
-
};
|
|
183
|
-
const restore = () => {
|
|
184
|
-
if (originalDescriptorObject !== object) Reflect.deleteProperty(object, key);
|
|
185
|
-
else if (originalDescriptor && !original) Object.defineProperty(object, key, originalDescriptor);
|
|
186
|
-
else reassign(original);
|
|
187
|
-
};
|
|
188
|
-
const mock = createMockInstance({
|
|
189
|
-
restore,
|
|
190
|
-
originalImplementation,
|
|
191
|
-
resetToMockName: true
|
|
192
|
-
});
|
|
193
|
-
try {
|
|
194
|
-
reassign(ssr ? () => mock : mock);
|
|
195
|
-
} catch (error) {
|
|
196
|
-
if (error instanceof TypeError && Symbol.toStringTag && object[Symbol.toStringTag] === "Module" && (error.message.includes("Cannot redefine property") || error.message.includes("Cannot replace module namespace") || error.message.includes("can't redefine non-configurable property"))) throw new TypeError(`Cannot spy on export "${String(key)}". Module namespace is not configurable in ESM. See: https://vitest.dev/guide/browser/#limitations`, { cause: error });
|
|
197
|
-
throw error;
|
|
198
|
-
}
|
|
199
|
-
return mock;
|
|
200
|
-
}
|
|
201
|
-
function getDescriptor(obj, method) {
|
|
202
|
-
const objDescriptor = Object.getOwnPropertyDescriptor(obj, method);
|
|
203
|
-
if (objDescriptor) return [obj, objDescriptor];
|
|
204
|
-
let currentProto = Object.getPrototypeOf(obj);
|
|
205
|
-
while (currentProto !== null) {
|
|
206
|
-
const descriptor = Object.getOwnPropertyDescriptor(currentProto, method);
|
|
207
|
-
if (descriptor) return [currentProto, descriptor];
|
|
208
|
-
currentProto = Object.getPrototypeOf(currentProto);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
function assert(condition, message) {
|
|
212
|
-
if (!condition) throw new Error(message);
|
|
213
|
-
}
|
|
214
|
-
let invocationCallCounter = 1;
|
|
215
|
-
function createMock({ state, config, name: mockName, prototypeState, prototypeConfig, keepMembersImplementation, mockImplementation, prototypeMembers = [] }) {
|
|
216
|
-
const original = config.mockOriginal;
|
|
217
|
-
const pseudoOriginal = mockImplementation;
|
|
218
|
-
const name = mockName || original?.name || "Mock";
|
|
219
|
-
const namedObject = { [name]: function(...args) {
|
|
220
|
-
registerCalls(args, state, prototypeState);
|
|
221
|
-
registerInvocationOrder(invocationCallCounter++, state, prototypeState);
|
|
222
|
-
const result = {
|
|
223
|
-
type: "incomplete",
|
|
224
|
-
value: void 0
|
|
225
|
-
};
|
|
226
|
-
const settledResult = {
|
|
227
|
-
type: "incomplete",
|
|
228
|
-
value: void 0
|
|
229
|
-
};
|
|
230
|
-
registerResult(result, state, prototypeState);
|
|
231
|
-
registerSettledResult(settledResult, state, prototypeState);
|
|
232
|
-
const context = new.target ? void 0 : this;
|
|
233
|
-
const [instanceIndex, instancePrototypeIndex] = registerInstance(context, state, prototypeState);
|
|
234
|
-
const [contextIndex, contextPrototypeIndex] = registerContext(context, state, prototypeState);
|
|
235
|
-
const implementation = config.onceMockImplementations.shift() || config.mockImplementation || prototypeConfig?.onceMockImplementations.shift() || prototypeConfig?.mockImplementation || original || function() {};
|
|
236
|
-
let returnValue;
|
|
237
|
-
let thrownValue;
|
|
238
|
-
let didThrow = false;
|
|
239
|
-
try {
|
|
240
|
-
if (new.target) {
|
|
241
|
-
returnValue = Reflect.construct(implementation, args, new.target);
|
|
242
|
-
for (const prop of prototypeMembers) {
|
|
243
|
-
const prototypeMock = returnValue[prop];
|
|
244
|
-
if (prototypeMock !== mock.prototype[prop]) continue;
|
|
245
|
-
const isMock = isMockFunction(prototypeMock);
|
|
246
|
-
const prototypeState = isMock ? prototypeMock.mock : void 0;
|
|
247
|
-
const prototypeConfig = isMock ? MOCK_CONFIGS.get(prototypeMock) : void 0;
|
|
248
|
-
returnValue[prop] = createMockInstance({
|
|
249
|
-
originalImplementation: keepMembersImplementation ? prototypeConfig?.mockOriginal : void 0,
|
|
250
|
-
prototypeState,
|
|
251
|
-
prototypeConfig,
|
|
252
|
-
keepMembersImplementation
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
} else returnValue = implementation.apply(this, args);
|
|
256
|
-
} catch (error) {
|
|
257
|
-
thrownValue = error;
|
|
258
|
-
didThrow = true;
|
|
259
|
-
if (error instanceof TypeError && error.message.includes("is not a constructor")) console.warn(`[vitest] The ${namedObject[name].getMockName()} mock did not use 'function' or 'class' in its implementation, see https://vitest.dev/api/vi#vi-spyon for examples.`);
|
|
260
|
-
throw error;
|
|
261
|
-
} finally {
|
|
262
|
-
if (didThrow) {
|
|
263
|
-
result.type = "throw";
|
|
264
|
-
result.value = thrownValue;
|
|
265
|
-
settledResult.type = "rejected";
|
|
266
|
-
settledResult.value = thrownValue;
|
|
267
|
-
} else {
|
|
268
|
-
result.type = "return";
|
|
269
|
-
result.value = returnValue;
|
|
270
|
-
if (new.target) {
|
|
271
|
-
state.contexts[contextIndex - 1] = returnValue;
|
|
272
|
-
state.instances[instanceIndex - 1] = returnValue;
|
|
273
|
-
if (contextPrototypeIndex != null && prototypeState) prototypeState.contexts[contextPrototypeIndex - 1] = returnValue;
|
|
274
|
-
if (instancePrototypeIndex != null && prototypeState) prototypeState.instances[instancePrototypeIndex - 1] = returnValue;
|
|
275
|
-
}
|
|
276
|
-
if (returnValue instanceof Promise) returnValue.then((settledValue) => {
|
|
277
|
-
settledResult.type = "fulfilled";
|
|
278
|
-
settledResult.value = settledValue;
|
|
279
|
-
}, (rejectedValue) => {
|
|
280
|
-
settledResult.type = "rejected";
|
|
281
|
-
settledResult.value = rejectedValue;
|
|
282
|
-
});
|
|
283
|
-
else {
|
|
284
|
-
settledResult.type = "fulfilled";
|
|
285
|
-
settledResult.value = returnValue;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return returnValue;
|
|
290
|
-
} };
|
|
291
|
-
const mock = namedObject[name];
|
|
292
|
-
const copyPropertiesFrom = original || pseudoOriginal;
|
|
293
|
-
if (copyPropertiesFrom) copyOriginalStaticProperties(mock, copyPropertiesFrom);
|
|
294
|
-
return mock;
|
|
295
|
-
}
|
|
296
|
-
function registerCalls(args, state, prototypeState) {
|
|
297
|
-
state.calls.push(args);
|
|
298
|
-
prototypeState?.calls.push(args);
|
|
299
|
-
}
|
|
300
|
-
function registerInvocationOrder(order, state, prototypeState) {
|
|
301
|
-
state.invocationCallOrder.push(order);
|
|
302
|
-
prototypeState?.invocationCallOrder.push(order);
|
|
303
|
-
}
|
|
304
|
-
function registerResult(result, state, prototypeState) {
|
|
305
|
-
state.results.push(result);
|
|
306
|
-
prototypeState?.results.push(result);
|
|
307
|
-
}
|
|
308
|
-
function registerSettledResult(result, state, prototypeState) {
|
|
309
|
-
state.settledResults.push(result);
|
|
310
|
-
prototypeState?.settledResults.push(result);
|
|
311
|
-
}
|
|
312
|
-
function registerInstance(instance, state, prototypeState) {
|
|
313
|
-
return [state.instances.push(instance), prototypeState?.instances.push(instance)];
|
|
314
|
-
}
|
|
315
|
-
function registerContext(context, state, prototypeState) {
|
|
316
|
-
return [state.contexts.push(context), prototypeState?.contexts.push(context)];
|
|
317
|
-
}
|
|
318
|
-
function copyOriginalStaticProperties(mock, original) {
|
|
319
|
-
const { properties, descriptors } = getAllProperties(original);
|
|
320
|
-
for (const key of properties) {
|
|
321
|
-
const descriptor = descriptors[key];
|
|
322
|
-
if (getDescriptor(mock, key)) continue;
|
|
323
|
-
Object.defineProperty(mock, key, descriptor);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
const ignoreProperties = new Set([
|
|
327
|
-
"length",
|
|
328
|
-
"name",
|
|
329
|
-
"prototype",
|
|
330
|
-
Symbol.for("nodejs.util.promisify.custom")
|
|
331
|
-
]);
|
|
332
|
-
function getAllProperties(original) {
|
|
333
|
-
const properties = /* @__PURE__ */ new Set();
|
|
334
|
-
const descriptors = {};
|
|
335
|
-
while (original && original !== Object.prototype && original !== Function.prototype) {
|
|
336
|
-
const ownProperties = [...Object.getOwnPropertyNames(original), ...Object.getOwnPropertySymbols(original)];
|
|
337
|
-
for (const prop of ownProperties) {
|
|
338
|
-
if (descriptors[prop] || ignoreProperties.has(prop)) continue;
|
|
339
|
-
properties.add(prop);
|
|
340
|
-
descriptors[prop] = Object.getOwnPropertyDescriptor(original, prop);
|
|
341
|
-
}
|
|
342
|
-
original = Object.getPrototypeOf(original);
|
|
343
|
-
}
|
|
344
|
-
return {
|
|
345
|
-
properties,
|
|
346
|
-
descriptors
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
function getDefaultConfig(original) {
|
|
350
|
-
return {
|
|
351
|
-
mockImplementation: void 0,
|
|
352
|
-
mockOriginal: original,
|
|
353
|
-
mockName: "vi.fn()",
|
|
354
|
-
onceMockImplementations: []
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
function getDefaultState() {
|
|
358
|
-
const state = {
|
|
359
|
-
calls: [],
|
|
360
|
-
contexts: [],
|
|
361
|
-
instances: [],
|
|
362
|
-
invocationCallOrder: [],
|
|
363
|
-
settledResults: [],
|
|
364
|
-
results: [],
|
|
365
|
-
get lastCall() {
|
|
366
|
-
return state.calls.at(-1);
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
return state;
|
|
370
|
-
}
|
|
371
|
-
function restoreAllMocks() {
|
|
372
|
-
for (const restore of MOCK_RESTORE) restore();
|
|
373
|
-
MOCK_RESTORE.clear();
|
|
374
|
-
}
|
|
375
|
-
function clearAllMocks() {
|
|
376
|
-
REGISTERED_MOCKS.forEach((mock) => mock.mockClear());
|
|
377
|
-
}
|
|
378
|
-
function resetAllMocks() {
|
|
379
|
-
REGISTERED_MOCKS.forEach((mock) => mock.mockReset());
|
|
380
|
-
}
|
|
381
|
-
function throwConstructorError(shorthand) {
|
|
382
|
-
throw new TypeError(`Cannot use \`${shorthand}\` when called with \`new\`. Use \`mockImplementation\` with a \`class\` keyword instead. See https://vitest.dev/api/mock#class-support for more information.`);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
//#endregion
|
|
386
|
-
exports.clearAllMocks = clearAllMocks;
|
|
387
|
-
exports.fn = fn;
|
|
388
|
-
exports.isMockFunction = isMockFunction;
|
|
389
|
-
exports.resetAllMocks = resetAllMocks;
|
|
390
|
-
exports.restoreAllMocks = restoreAllMocks;
|
|
391
|
-
exports.spyOn = spyOn;
|