Use this template to create and run tests on your Svelte components.
$ git clone https://github.com/ErnaneJ/Test-base-model-for-Svelte-components.git
package.json
:$ npm install
$ npm run test
Configure in your project to test your Svelte components.
svelte-jester:
A Jest transformer for Svelte - compile your components before importing them into tests. jest
: JavaScript testing frameworkbabel-jest
: transformer for JavaScript code. @testing-library/svelte
: Svelte Test Library test components.babel/preset-env
: Smart preset that lets you use the latest JavaScript. Essential if using ECMAScript 6.@babel/core
: Babel.$ npm install --save-dev svelte-jester jest babel-jest @testing-library/svelte @babel/preset-env @babel/core
"jest": {
"bail": false,
"moduleFileExtensions": [
"js",
"svelte"
],
"transform": {
"^.+\\.js$": "babel-jest",
"^.+\\.svelte$": "svelte-jester"
},
"verbose": true
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
"test": "jest src"