Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ernanej/test-base-model-for-svelte-components
Test base model for Svelt components and minified tutorial to apply tests on your project components.
https://github.com/ernanej/test-base-model-for-svelte-components
interface-t svelte test-automation
Last synced: 23 days ago
JSON representation
Test base model for Svelt components and minified tutorial to apply tests on your project components.
- Host: GitHub
- URL: https://github.com/ernanej/test-base-model-for-svelte-components
- Owner: ErnaneJ
- Created: 2021-06-03T15:13:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-03T15:16:35.000Z (over 3 years ago)
- Last Synced: 2024-10-24T21:58:57.619Z (2 months ago)
- Topics: interface-t, svelte, test-automation
- Language: JavaScript
- Homepage:
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Use this template
Use this template to create and run tests on your Svelte components.
### Clone this repository:
```git
$ git clone https://github.com/ErnaneJ/Test-base-model-for-Svelte-components.git
```
### Install the dependencies present in `package.json`:
```npm
$ npm install
```
### Run the tests:
```npm
$ npm run test
```# Configure in your project
Configure in your project to test your Svelte components.### Install the dependencies:
- `svelte-jester:` A Jest transformer for Svelte - compile your components before importing them into tests.
- `jest`: JavaScript testing framework
- `babel-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
$ npm install --save-dev svelte-jester jest babel-jest @testing-library/svelte @babel/preset-env @babel/core
```### Add the settings to your project's package.json
- ### Add this at the bottom
```json
"jest": {
"bail": false,
"moduleFileExtensions": [
"js",
"svelte"
],
"transform": {
"^.+\\.js$": "babel-jest",
"^.+\\.svelte$": "svelte-jester"
},
"verbose": true
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
```
- #### Add this to scripts:
```json
"test": "jest src"
```