bun-match-svg 0.0.12 → 0.0.14
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/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ async function toMatchSvgSnapshot(
|
|
|
14
14
|
const testPath = testPathOriginal.replace(/\.test\.tsx?$/, "")
|
|
15
15
|
const snapshotDir = path.join(path.dirname(testPath), "__snapshots__")
|
|
16
16
|
const snapshotName = svgName
|
|
17
|
-
? `${svgName}.snap.svg`
|
|
17
|
+
? `${path.basename(testPath)}-${svgName}.snap.svg`
|
|
18
18
|
: `${path.basename(testPath)}.snap.svg`
|
|
19
19
|
const filePath = path.join(snapshotDir, snapshotName)
|
|
20
20
|
|
|
@@ -101,7 +101,7 @@ async function toMatchMultipleSvgSnapshots(
|
|
|
101
101
|
const testPath = testPathOriginal.replace(/\.test\.tsx?$/, "")
|
|
102
102
|
const snapshotDir = path.join(path.dirname(testPath), "__snapshots__")
|
|
103
103
|
const snapshotName = svgName
|
|
104
|
-
? `${svgName}.snap.svg`
|
|
104
|
+
? `${path.basename(testPath)}-${svgName}.snap.svg`
|
|
105
105
|
: `${path.basename(testPath)}.snap.svg`
|
|
106
106
|
const filePath = path.join(snapshotDir, snapshotName)
|
|
107
107
|
|
package/package.json
CHANGED
|
@@ -25,9 +25,10 @@ const testSvgs = [
|
|
|
25
25
|
const svgNames: string[] = []
|
|
26
26
|
for (let i = 0; i < testSvgs.length; i++) svgNames.push(`test${i + 1}`)
|
|
27
27
|
|
|
28
|
+
const testPathBase = path.basename(import.meta.path.replace(/\.test\.tsx?$/, ""))
|
|
28
29
|
const snapshotDir = path.join(__dirname, "__snapshots__")
|
|
29
30
|
const snapshotPaths = svgNames.map((svgName) =>
|
|
30
|
-
path.join(snapshotDir, `${svgName}.snap.svg`),
|
|
31
|
+
path.join(snapshotDir, `${testPathBase}-${svgName}.snap.svg`),
|
|
31
32
|
)
|
|
32
33
|
|
|
33
34
|
beforeAll(() => {
|
|
@@ -7,9 +7,13 @@ const testSvg = `<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg
|
|
|
7
7
|
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
|
|
8
8
|
</svg>`
|
|
9
9
|
|
|
10
|
+
const testPathBase = path.basename(import.meta.path.replace(/\.test\.tsx?$/, ""))
|
|
10
11
|
const snapshotDir = path.join(__dirname, "__snapshots__")
|
|
11
|
-
const snapshotPath = path.join(snapshotDir,
|
|
12
|
-
const metadataSnapshotPath = path.join(
|
|
12
|
+
const snapshotPath = path.join(snapshotDir, `${testPathBase}-test.snap.svg`)
|
|
13
|
+
const metadataSnapshotPath = path.join(
|
|
14
|
+
snapshotDir,
|
|
15
|
+
`${testPathBase}-metadata.snap.svg`,
|
|
16
|
+
)
|
|
13
17
|
|
|
14
18
|
beforeAll(() => {
|
|
15
19
|
if (!fs.existsSync(snapshotDir)) {
|