@vitest/snapshot
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -313,3 +313,3 @@ import { plugins, format } from 'pretty-format'; | ||
function escapeBacktickString(str) { | ||
return str.replace(/`|\\|\${/g, "\\$&"); | ||
return str.replace(/`|\\|\$\{/g, "\\$&"); | ||
} | ||
@@ -342,3 +342,3 @@ function printBacktickString(str) { | ||
var _a, _b; | ||
const matchObject = /^( +)}\s+$/m.exec(expected || ""); | ||
const matchObject = /^( +)\}\s+$/m.exec(expected || ""); | ||
const objectIndent = (_a = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a.length; | ||
@@ -353,3 +353,3 @@ if (objectIndent) | ||
if (startIndent) { | ||
expectedTrimmed = expectedTrimmed == null ? void 0 : expectedTrimmed.replace(new RegExp(`^${" ".repeat(startIndent)}`, "gm"), "").replace(/ +}$/, "}"); | ||
expectedTrimmed = expectedTrimmed == null ? void 0 : expectedTrimmed.replace(new RegExp(`^${" ".repeat(startIndent)}`, "gm"), "").replace(/ +\}$/, "}"); | ||
} | ||
@@ -951,4 +951,4 @@ return expectedTrimmed; | ||
const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m; | ||
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/; | ||
const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m; | ||
const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/; | ||
const stackIgnorePatterns = [ | ||
@@ -993,3 +993,3 @@ "node:internal", | ||
return null; | ||
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/; | ||
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(@)/; | ||
const matches = line.match(functionNameRegex); | ||
@@ -1087,3 +1087,3 @@ const functionName = matches && matches[1] ? matches[1] : void 0; | ||
} | ||
const startObjectRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\S\s]*\*\/\s*|\/\/.*\s+)*\s*({)/m; | ||
const startObjectRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\s\S]*\*\/\s*|\/\/.*(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))*\{/; | ||
function replaceObjectSnap(code, s, index, newSnap) { | ||
@@ -1130,8 +1130,8 @@ let _code = code.slice(index); | ||
if (isOneline) | ||
return `${quote}${lines.join("\n").replace(/`/g, "\\`").replace(/\${/g, "\\${")}${quote}`; | ||
return `${quote}${lines.join("\n").replace(/`/g, "\\`").replace(/\$\{/g, "\\${")}${quote}`; | ||
return `${quote} | ||
${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`").replace(/\${/g, "\\${")} | ||
${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`").replace(/\$\{/g, "\\${")} | ||
${indent}${quote}`; | ||
} | ||
const startRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\S\s]*\*\/\s*|\/\/.*\s+)*\s*[\w_$]*(['"`\)])/m; | ||
const startRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\s\S]*\*\/\s*|\/\/.*(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))*[\w$]*(['"`)])/; | ||
function replaceInlineSnap(code, s, index, newSnap) { | ||
@@ -1138,0 +1138,0 @@ const codeStartingAtIndex = code.slice(index); |
{ | ||
"name": "@vitest/snapshot", | ||
"type": "module", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"description": "Vitest snapshot manager", | ||
@@ -48,3 +48,3 @@ "license": "MIT", | ||
"natural-compare": "^1.4.0", | ||
"@vitest/utils": "2.0.0-beta.2" | ||
"@vitest/utils": "2.0.0-beta.3" | ||
}, | ||
@@ -51,0 +51,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67029