Skip to content

Latest commit

 

History

History

plugin-vitest

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@putout/plugin-vitest NPM version

A Vite-native testing framework. It's fast!

(c) vitest.dev

🐊Putout plugin helps to migrate to migrate to latest version of vitest.

Install

npm i @putout/plugin-vitest -D

Rules

Config

{
    "rules": {
        "vitest/v3-apply-options-as-second-argument": "on",
        "vitest/v3-apply-browser-instances": "on"
    },
    "plugins": ["vitest"]
}

v3-apply-options-as-second-argument

Vitest 3.0 prints a warning if you pass down an object as a third argument to test or describe functions. Vitest 4.0 will throw an error if the third argument is an object.

(c) vitest.dev

Checkout in 🐊Putout Editor.

❌ Example of incorrect code

test('validation works', () => {
    // ...
}, {
    retry: 3,
});

✅ Example of correct code

test('validation works', {retry: 3}, () => {
    // ...
});

v3-apply-browser-instances

Both browser.name and browser.providerOptions will be removed in Vitest 4. Instead of them, use the new browser.instances option.

(c) vitest.dev

Checkout in 🐊Putout Editor.

❌ Example of incorrect code

export default defineConfig({
    test: {
        browser: {
            name: 'chromium',
            providerOptions: {
                launch: {
                    devtools: true,
                },
            },
        },
    },
});

✅ Example of correct code

export default defineConfig({
    test: {
        browser: {
            instances: [{
                name: 'chromium',
                providerOptions: {
                    launch: {
                        devtools: true,
                    },
                },
            }],
        },
    },
});

License

MIT