Test fails for `srcset` in `vite-imagetools`
zerodevx opened this issue · comments
Jason Lee commented
I'm getting a test failure on a new imagetools
setup:
FAIL src/__tests__/main.test.ts > vite-imagetools > srcset
AssertionError: expected '/assets/with-metadata-3d3699bf.png 60…' to be '/assets/with-metadata-404f605d.png 60…' // Object.is equality
❯ src/__tests__/main.test.ts:647:30
645| window.eval(files[0].code)
646|
647| expect(window.__IMAGE__).toBe('/assets/with-metadata-404f605d.png …
| ^
648| })
649|
- Expected "/assets/with-metadata-404f605d.png 600w"
+ Received "/assets/with-metadata-3d3699bf.png 600w"
Only this test fails; the others (across all packages) pass.
Seems like this line tests against what I guess is a randomly generated hash?
Edit: oh I see the hash may be a crypto hash... not sure why this test fails. 🤷
Ben McCann commented
Are you still getting errors locally if you try on the latest main
? I just checked and don't have any errors at the moment
Jason Lee commented
stderr | src/__tests__/main.test.ts > vite-imagetools > options > logging >
│ [plugin:imagetools] A warning
│ stderr | src/__tests__/main.test.ts > vite-imagetools > options > logging >
│ [imagetools] Could not load /Users/zero/local_dev/projects/imagetools/packag
│ stderr | src/__tests__/main.test.ts > vite-imagetools > non existent file
│ Could not resolve "./invalid.png?w=300" from "src/__tests__/__fixtures__/ind
│ file: /Users/zero/local_dev/projects/imagetools/packages/vite/src/__tests__/
│ ❯ src/__tests__/main.test.ts (30 tests | 1 failed) 1719ms
│ ❯ src/__tests__/main.test.ts > vite-imagetools > srcset
│ → expected '/assets/with-metadata-3d3699bf.png 60…' to be '/assets/with
│ ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
│ FAIL src/__tests__/main.test.ts > vite-imagetools > srcset
│ AssertionError: expected '/assets/with-metadata-3d3699bf.png 60…' to be '/as
│ ❯ src/__tests__/main.test.ts:647:30
│ 645| window.eval(files[0].code)
│ 646|
│ 647| expect(window.__IMAGE__).toBe('/assets/with-metadata-404f605d.p
│ | ^
│ 648| })
│ 649|
│ - Expected - 1
│ + Received + 1
│ - '/assets/with-metadata-404f605d.png 600w'
│ + '/assets/with-metadata-3d3699bf.png 600w'
│ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
│ Test Files 1 failed (1)
│ Tests 1 failed | 29 passed (30)
│ Start at 16:57:06
│ Duration 2.44s (transform 135ms, setup 0ms, collect 460ms, tests 1.72s,
└─ Failed in 2.7s at /Users/zero/local_dev/projects/imagetools/packages/vite
Still getting a test failure on the latest main
- but the linked PR has been merged, so closing this anyway. Thanks for your help!