Comments (5)
We record the promise, so it's not required.
from vitest.
In that case the docs could be updated since they say "you need to use await": https://vitest.dev/api/expect.html#tomatchfilesnapshot
And if it's not required then perhaps it could just be synchronous to avoid the confusion?
from vitest.
It does return a Promise, so I don't know what else to tell you. It cannot be sync because to read a file in the browser we need to make an async request. In node.js it could technically be sync, but then the API would differ which is undesirable.
from vitest.
We could probably just clarify the docs about the difference between awaiting and not awaiting it
from vitest.
If it's not awaited, then the next line will be executed even if the snapshot fail which might not be expected behaviour but it at least correctly fails the test.
from vitest.
Related Issues (20)
- Mocking cyclic dependencies with `importOriginal` doesn't work in the browser
- docs: oder instead of order
- Vitest does not work when running from any CLI (Cannot find module @rollup) HOT 2
- vitest runner defaultSuite always empty HOT 1
- Ability to import source scripts in IFrames HOT 2
- Not possible to use stringContaining with toHaveBeenCalledWith HOT 1
- vitest 1.6.0 and axios tests fails with error `DataCloneError: function transformRequest` HOT 8
- String exports aren't resolved on wildcard imports HOT 1
- Vitest should install correct ui/browser package versions via CLI HOT 1
- coverage-istanbul does not work with workspaces and SvelteKit HOT 4
- Is it possible to add snapshots in type testing? HOT 2
- Async context is not passed into tests from fixtures HOT 2
- Typecheck not performed if there are no test-d files
- `onTestFinished` should run after each repeat not after all the repeats are done
- vitest 2.0 beta.9 toMatchInlineSnapshot not work as expect
- docs: links to missing examples in README
- Browser Mode: Electron support
- No console logs/debugs/errors in tests or component HOT 4
- [CI=true] toMatchFileSnapshot always mismatched if empty file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vitest.