Skip to content

set up the jest environment in a svelte project without a configuration

License

Notifications You must be signed in to change notification settings

medhy35/svelte-jest

Repository files navigation

Svelte-jest

Unit testing Svelte projet in Jest

Build Status install size

Install

Install Svelte.

npx degit sveltejs/template my-svelte-project
cd my-svelte-project

Install Jest.

npm install --save-dev jest
or 
yarn add --dev jest

Configuration

After installation configure babel to support ES2015 modules

Step 1 :

Add your test environment to .babelrc in the root of your project:

/// <reference types="babel" />
{
    "env":{
        "test":{
            "plugins":["transform-es2015-modules-commonjs"]
        }
    }
}

Step 2 :

npm install --save-dev babel-plugin-transform-es2015-modules-commonjs

And that's it. Jest will enable compilation from ES modules to CommonJS automatically, without having to inform additional options to your jest property inside package.json

About

set up the jest environment in a svelte project without a configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published