bun-match-svg 0.0.7 → 0.0.9
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/cli.ts +1 -2
- package/index.ts +6 -6
- package/package.json +1 -1
- package/tsconfig.json +11 -1
package/cli.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { mkdir, writeFile } from "node:fs/promises"
|
|
|
4
4
|
import { spawn } from "node:child_process"
|
|
5
5
|
|
|
6
6
|
const EXAMPLE_TEST = `import { expect, test } from "bun:test"
|
|
7
|
-
import "bun-match-svg"
|
|
8
7
|
|
|
9
8
|
const testSvg = \`<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
|
|
10
9
|
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
|
|
@@ -13,7 +12,7 @@ const EXAMPLE_TEST = `import { expect, test } from "bun:test"
|
|
|
13
12
|
test("svg snapshot example", async () => {
|
|
14
13
|
// First run will create the snapshot
|
|
15
14
|
// Subsequent runs will compare against the saved snapshot
|
|
16
|
-
await expect(testSvg).toMatchSvgSnapshot(import.meta.path
|
|
15
|
+
await expect(testSvg).toMatchSvgSnapshot(import.meta.path)
|
|
17
16
|
})
|
|
18
17
|
`
|
|
19
18
|
|
package/index.ts
CHANGED
|
@@ -25,7 +25,7 @@ async function toMatchSvgSnapshot(
|
|
|
25
25
|
const updateSnapshot =
|
|
26
26
|
process.argv.includes("--update-snapshots") ||
|
|
27
27
|
process.argv.includes("-u") ||
|
|
28
|
-
Boolean(process.env
|
|
28
|
+
Boolean(process.env["BUN_UPDATE_SNAPSHOTS"])
|
|
29
29
|
|
|
30
30
|
if (!fs.existsSync(filePath) || updateSnapshot) {
|
|
31
31
|
console.log("Writing snapshot to", filePath)
|
|
@@ -38,7 +38,7 @@ async function toMatchSvgSnapshot(
|
|
|
38
38
|
|
|
39
39
|
const existingSnapshot = fs.readFileSync(filePath, "utf-8")
|
|
40
40
|
|
|
41
|
-
const result = await looksSame(
|
|
41
|
+
const result: any = await looksSame(
|
|
42
42
|
Buffer.from(received),
|
|
43
43
|
Buffer.from(existingSnapshot),
|
|
44
44
|
{
|
|
@@ -75,8 +75,8 @@ async function toMatchMultipleSvgSnapshots(
|
|
|
75
75
|
testPathOriginal: string,
|
|
76
76
|
svgNames: string[],
|
|
77
77
|
): Promise<MatcherResult> {
|
|
78
|
-
const passed = []
|
|
79
|
-
const failed = []
|
|
78
|
+
const passed: any[] = []
|
|
79
|
+
const failed: any[] = []
|
|
80
80
|
for (let index = 0; index < svgNames.length; index++) {
|
|
81
81
|
const svgName = svgNames[index]
|
|
82
82
|
const received = await receivedMaybePromise
|
|
@@ -94,7 +94,7 @@ async function toMatchMultipleSvgSnapshots(
|
|
|
94
94
|
const updateSnapshot =
|
|
95
95
|
process.argv.includes("--update-snapshots") ||
|
|
96
96
|
process.argv.includes("-u") ||
|
|
97
|
-
Boolean(process.env
|
|
97
|
+
Boolean(process.env["BUN_UPDATE_SNAPSHOTS"])
|
|
98
98
|
|
|
99
99
|
if (!fs.existsSync(filePath) || updateSnapshot) {
|
|
100
100
|
console.log("Writing snapshot to", filePath)
|
|
@@ -108,7 +108,7 @@ async function toMatchMultipleSvgSnapshots(
|
|
|
108
108
|
|
|
109
109
|
const existingSnapshot = fs.readFileSync(filePath, "utf-8")
|
|
110
110
|
|
|
111
|
-
const result = await looksSame(
|
|
111
|
+
const result: any = await looksSame(
|
|
112
112
|
Buffer.from(received[index] as any),
|
|
113
113
|
Buffer.from(existingSnapshot),
|
|
114
114
|
{
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -13,6 +13,16 @@
|
|
|
13
13
|
"allowImportingTsExtensions": true,
|
|
14
14
|
"verbatimModuleSyntax": true,
|
|
15
15
|
"noEmit": true,
|
|
16
|
+
"noImplicitAny": true,
|
|
17
|
+
"strictNullChecks": true,
|
|
18
|
+
"strictFunctionTypes": true,
|
|
19
|
+
"strictBindCallApply": true,
|
|
20
|
+
"strictPropertyInitialization": true,
|
|
21
|
+
"noImplicitThis": true,
|
|
22
|
+
"useUnknownInCatchVariables": true,
|
|
23
|
+
"alwaysStrict": true,
|
|
24
|
+
"exactOptionalPropertyTypes": false,
|
|
25
|
+
"noImplicitReturns": true,
|
|
16
26
|
|
|
17
27
|
// Best practices
|
|
18
28
|
"strict": true,
|
|
@@ -22,6 +32,6 @@
|
|
|
22
32
|
// Some stricter flags (disabled by default)
|
|
23
33
|
"noUnusedLocals": false,
|
|
24
34
|
"noUnusedParameters": false,
|
|
25
|
-
"noPropertyAccessFromIndexSignature":
|
|
35
|
+
"noPropertyAccessFromIndexSignature": true
|
|
26
36
|
}
|
|
27
37
|
}
|