vitest-offline
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

vitest-offline

Simple addon to your vitest, that will break tests if any of them make a network request.

Install

With npm:

npm i -D vitest-offline

With pnpm:

pnpm add -D vitest-offline

With yarn:

yarn add vitest-offline --dev

Use

In your vitest setup file add following code:

// e.g. src/setupTests.ts

import { setupNetworkInterceptor } from "vitest-offline";

setupNetworkInterceptor();

Import to your Vite config file:

// vitest.config.mts or vite.config.mts

export default defineConfig({
	test: {
		...
    // make sure it is correct path to your setupTests file
		setupFiles: "./src/setupTests.ts",
	},
});

Readme

Keywords

Package Sidebar

Install

npm i vitest-offline

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

14.2 kB

Total Files

7

Last publish

Collaborators

  • krzychu