https://github.com/silvestrevivo/svelte-testing-library-meetup
Examples shown during the first AMS sveltejs meetup
https://github.com/silvestrevivo/svelte-testing-library-meetup
meetup svelte svelte-testing-library svelte3
Last synced: 9 months ago
JSON representation
Examples shown during the first AMS sveltejs meetup
- Host: GitHub
- URL: https://github.com/silvestrevivo/svelte-testing-library-meetup
- Owner: silvestrevivo
- Created: 2019-11-15T08:45:08.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T00:55:03.000Z (almost 3 years ago)
- Last Synced: 2025-01-25T14:23:17.489Z (11 months ago)
- Topics: meetup, svelte, svelte-testing-library, svelte3
- Language: HTML
- Size: 1.04 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# svelte-testing-library-meetup
To run it:
```bash
cd svelte-testing-library-meetup
npm install
npm run dev
```
For testing:
```bash
npm run test
npm run test:watch
npm run test:coverage
```
## Setup
```bash
npm install @testing-library/svelte
npm install --save-dev jest
npm install --save-dev @testing-library/jest-dom
npm install svelte-jest
```
We add this scripts to the **package.json**
```javascript
{
"scripts": {
"test": "jest src",
"test:watch": "npm run test -- --watch",
"test:coverage": "npm run test -- --coverage"
}
}
```
We add the next script to the **jest.config.js**
```javascript
module.exports = {
transform: {
"^.+\\.js$": "babel-jest",
"^.+\\.svelte$": "svelte-jest"
},
moduleFileExtensions: ["js", "json", "svelte"],
coverageReporters: ["html"],
bail: false,
verbose: false,
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"]
};
```
To run babel
```bash
npm install babel-jest
npm install @babel/preset-env
```
And we add in the **.babelrc** file
```javascript
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
```