| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,16 @@ export function printProps( | |||
| 23 | 23 | return keys | |
| 24 | 24 | .map((key) => { | |
| 25 | 25 | const value = props[key] | |
| 26 | + // hidden injected value that should not be printed | ||
| 27 | + if ( | ||
| 28 | + typeof value === 'string' | ||
| 29 | + && value[0] === '_' | ||
| 30 | + && value.startsWith('__vitest_') | ||
| 31 | + && value.match(/__vitest_\d+__/) | ||
| 32 | + ) { | ||
| 33 | + return '' | ||
| 34 | + } | ||
| 35 | + | ||
| 26 | 36 | let printed = printer(value, config, indentationNext, depth, refs) | |
| 27 | 37 | ||
| 28 | 38 | if (typeof value !== 'string') { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,3 +12,11 @@ test('file snapshot', async () => { | |||
| 12 | 12 | await expect('my snapshot content') | |
| 13 | 13 | .toMatchFileSnapshot('./__snapshots__/custom/my_snapshot') | |
| 14 | 14 | }) | |
| 15 | + | ||
| 16 | + test('vitest attribute is hidden', () => { | ||
| 17 | + const div = document.createElement('div') | ||
| 18 | + div.setAttribute('data-testid', '__vitest_1__') | ||
| 19 | + expect(div).toMatchInlineSnapshot(` | ||
| 20 | + <div /> | ||
| 21 | + `) | ||
| 22 | + }) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments