Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
vitest-preview
Advanced tools
Readme
Debug your Vitest tests. Effortlessly. 🧪🖼⚡️
Try Vitest Preview Online. No downloads needed!
When writing tests, we usually have to debug by reading the cryptic HTML output on the terminal. Sometimes, they are too complicated to visualize the UI in our heads. vitest-preview
previews your Vitest tests right in a browser, then you can see your actual UI visually. You can write tests and watch rendered output changes accordingly. Vitest Preview lets you concentrate on tests in the "real world" rather than deciphering HTML code.
vitest-preview
is built on top of Vite, it's blazing fast and easy to use.
vitest-preview
is a younger sibling of jest-preview
with the same idea and to solve the same problem. If you are writing tests using Jest, give it a try.
debug()
is executed.npm install --save-dev vitest-preview
# Or
yarn add -D vitest-preview
pnpm add -D vitest-preview
You need to configure vitest
to process CSS by:
// vite.config.js
export default defineConfig({
test: {
+ css: true,
},
});
You might want to import your CSS global files in setupFiles
:
// vite.config.js
export default defineConfig({
test: {
+ setupFiles: './src/test/setup.ts',
},
});
// src/test/setup.ts
+import './global.css';
+import '@your-design-system/css/dist/index.min.css';
+import 'bootstrap/dist/css/bootstrap.min.css';
vitest-preview
has a CLI that opens Vitest Preview Dashboard where you can preview your tests' UI. You can update your package.json
to add a script for more convenience:
"scripts": {
"vitest-preview": "vitest-preview"
},
Update your .gitignore
// .gitignore
+.vitest-preview
Put debug()
wherever you want to see the UI in your tests.
+import { debug } from 'vitest-preview';
describe('App', () => {
it('should work as expected', () => {
render(<App />);
+ debug();
});
});
Open the Vitest Preview Dashboard by running the CLI command (updated in Configuration):
npm run vitest-preview
# Or
yarn vitest-preview
pnpm vitest-preview
Then execute your tests that contain debug()
. You will see the UI of your tests at http://localhost:5006.
Please see the contribution guide at CONTRIBUTING.md.
Yes, it is. It's Jest Preview.
MIT
If you like the project, please consider supporting it by giving a ⭐️ to encourage the author.
FAQs
Visual Debugging Experience for Vitest 🧪🖼⚡️
The npm package vitest-preview receives a total of 20,533 weekly downloads. As such, vitest-preview popularity was classified as popular.
We found that vitest-preview demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.