Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@testing-library/svelte

Package Overview
Dependencies
Maintainers
12
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testing-library/svelte - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

CHANGELOG.md

161

package.json
{
"name": "@testing-library/svelte",
"version": "2.0.0",
"version": "3.0.0",
"description": "Simple and complete Svelte testing utilities that encourage good testing practices.",
"main": "dist/index.js",
"types": "types/index.d.ts",
"license": "MIT",
"homepage": "https://github.com/testing-library/svelte-testing-library#readme",
"repository": {

@@ -10,53 +13,121 @@ "type": "git",

},
"devDependencies": {
"babel-jest": "^24.7.1",
"deasync": "^0.1.14",
"esm": "^3.2.22",
"jest": "^24.7.1",
"jest-dom": "^3.1.2",
"jest-transform-svelte": "^1.0.0",
"kcd-scripts": "^1.4.0",
"npm-run-all": "^4.1.5",
"rollup": "^1.10.1",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-livereload": "^1.0.0",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-terser": "^4.0.4",
"sirv-cli": "^0.4.0",
"svelte": "^3.0.0"
"bugs": {
"url": "https://github.com/testing-library/svelte-testing-library/issues"
},
"engines": {
"node": ">= 8"
},
"keywords": [
"testing",
"svelte",
"ui",
"dom",
"jsdom",
"unit",
"integration",
"functional",
"end-to-end",
"e2e"
],
"files": [
"dist",
"dont-cleanup-after-each.js",
"pure.js",
"types/index.d.ts"
],
"scripts": {
"toc": "doctoc README.md",
"lint": "eslint src --fix",
"clean": "rimraf dist",
"build": "npm run clean && babel src --out-dir dist --ignore '**/__tests__/**'",
"test": "jest src",
"test:watch": "npm run test -- --watch",
"test:update": "npm run test -- --updateSnapshot --coverage",
"setup": "npm install && npm run validate",
"validate": "npm run clean && npm-run-all lint test build",
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate"
},
"peerDependencies": {
"svelte": "3.x"
},
"scripts": {
"lint": "kcd-scripts lint",
"validate": "kcd-scripts validate",
"build": "kcd-scripts build",
"build:example": "rollup -c",
"autobuild:example": "rollup -c -w",
"dev": "run-p start:dev autobuild",
"start": "sirv public",
"start:dev": "sirv public --dev",
"test": "kcd-scripts test --no-watch --config=jest.config.js"
},
"dependencies": {
"@babel/runtime": "^7.4.3",
"@testing-library/dom": "^5.0.1",
"core-js": "^3.0.1"
"@testing-library/dom": "^7.0.3"
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js",
"rules": {
"react/prop-types": "off",
"import/no-unassigned-import": "off",
"import/named": "off"
"devDependencies": {
"@babel/cli": "^7.6.2",
"@babel/core": "^7.6.2",
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
"@babel/preset-env": "^7.6.2",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@testing-library/jest-dom": "^5.0.2",
"@types/jest": "^25.1.0",
"all-contributors-cli": "^6.9.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.1.0",
"doctoc": "^1.4.0",
"eslint": "^6.2.2",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-simple-import-sort": "^5.0.0",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-svelte3": "^2.7.3",
"husky": "^4.0.9",
"jest": "^25.1.0",
"lint-staged": "^10.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"svelte": "^3.0.0",
"svelte-jester": "^1.0.3"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"eslintIgnore": [
"node_modules",
"coverage",
"dist",
"public"
]
}
"lint-staged": {
"README.md": [
"yarn toc",
"prettier --parser markdown --write",
"git add"
],
".all-contributorsrc": [
"yarn contributors:generate",
"git add"
],
"**/*.js": [
"yarn lint",
"yarn test",
"git add"
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"jest": {
"testPathIgnorePatterns": [
"src/__tests__/fixtures"
],
"collectCoverageFrom": [
"src/*.js"
],
"setupFilesAfterEnv": [
"@testing-library/jest-dom/extend-expect"
],
"transform": {
"^.+\\.js$": "babel-jest",
"^.+\\.svelte$": "svelte-jester",
"^.+\\.html$": "svelte-jester"
},
"moduleFileExtensions": [
"js",
"svelte"
]
}
}
<div align="center">
<h1>svelte-testing-library</h1>
<h1>Svelte Testing Library</h1>

@@ -16,12 +16,5 @@ <a href="https://www.emojione.com/emoji/1f410">

<br />
[**Read The Docs**](https://testing-library.com/svelte) |
[**Read The Docs**](https://testing-library.com/docs/svelte-testing-library/intro) |
[Edit the docs](https://github.com/alexkrolick/testing-library-docs)
<br />
</div>
<hr />
<!-- prettier-ignore-start -->

@@ -33,3 +26,3 @@ [![Build Status][build-badge]][build]

[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-)
[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc]

@@ -41,15 +34,7 @@ [![Join the community on Spectrum][spectrum-badge]][spectrum]

[![Tweet][twitter-badge]][twitter]
<!-- prettier-ignore-end -->
<div align="center">
<a href="https://testingjavascript.com">
<img
width="500"
alt="TestingJavaScript.com Learn the smart, efficient way to test any JavaScript application."
src="https://raw.githubusercontent.com/testing-library/react-testing-library/master/other/testingjavascript.jpg"
/>
</a>
</div>
<hr />
## Table of Contents

@@ -60,10 +45,6 @@

- [The problem](#the-problem)
- [This solution](#this-solution)
- [Example](#example)
- [The Problem](#the-problem)
- [This Solution](#this-solution)
- [Installation](#installation)
- [Examples](#examples)
- [Other Solutions](#other-solutions)
- [Guiding Principles](#guiding-principles)
- [Contributors](#contributors)
- [Docs](#docs)

@@ -74,2 +55,3 @@ - [Issues](#issues)

- [❓ Questions](#-questions)
- [Contributors](#contributors)
- [LICENSE](#license)

@@ -79,13 +61,8 @@

## The problem
## The Problem
You want to write maintainable tests for your Svelte components. As a part of
this goal, you want your tests to avoid including implementation details of your
components and rather focus on making your tests give you the confidence for
which they are intended. As part of this, you want your testbase to be
maintainable in the long run so refactors of your components (changes to
implementation but not functionality) don't break your tests and slow you and
your team down.
You want to write tests for your Svelte components so that they avoid including implementation
details, and are maintainable in the long run.
## This solution
## This Solution

@@ -100,44 +77,2 @@ The `svelte-testing-library` is a very lightweight solution for testing Svelte

## Example
App.svelte
```html
<script>
export let name
</script>
<style>
h1 {
color: purple;
}
</style>
<h1>Hello {name}!</h1>
```
App.spec.js
```javascript
import App from '../src/App.svelte'
import {render} from '@testing-library/svelte'
describe('App', () => {
test('should render greeting', () => {
const {getByText} = render(App, {props: {name: 'world'}})
expect(getByText('Hello world!'))
})
test('should change button text after click', async () => {
const {getByText} = render(App, {props: {name: 'world'}})
fireEvent.click(getByText('Button Text'))
const button = await waitForElement(() => getByText('Button Clicked'))
expect(button).toBeInTheDocument()
})
})
```
## Installation

@@ -149,55 +84,13 @@

```
npm install --save-dev svelte-testing-library
npm install --save-dev @testing-library/svelte
```
This library has `peerDependencies` listings for `svelte`.
This library has `peerDependencies` listings for `svelte >= 3`.
You may also be interested in installing `jest-dom` so you can use
[the custom jest matchers](https://github.com/gnapse/jest-dom#readme).
You may also be interested in installing `@testing-library/jest-dom` so you can use
[the custom jest matchers](https://github.com/testing-library/jest-dom).
> [**Docs**](https://testing-library.com/docs/svelte-testing-library/intro)
## Guiding Principles
> [The more your tests resemble the way your software is used, the more
> confidence they can give you.][guiding-principle]
We try to only expose methods and utilities that encourage you to write tests
that closely resemble how your svelte components are used.
Utilities are included in this project based on the following guiding
principles:
1. If it relates to rendering components, it deals with DOM nodes rather than
component instances, nor should it encourage dealing with component
instances.
2. It should be generally useful for testing individual Svelte components or
full Svelte applications.
3. Utility implementations and APIs should be simple and flexible.
At the end of the day, what we want is for this library to be pretty
light-weight, simple, and understandable.
## Contributors
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<table><tr><td align="center"><a href="https://github.com/benmonro"><img src="https://avatars3.githubusercontent.com/u/399236?v=4" width="100px;" alt="Ben Monro"/><br /><sub><b>Ben Monro</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Tests">⚠️</a> <a href="#ideas-benmonro" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Documentation">📖</a></td><td align="center"><a href="https://twitter.com/EmilTholin"><img src="https://avatars0.githubusercontent.com/u/11573167?v=4" width="100px;" alt="Emil Tholin"/><br /><sub><b>Emil Tholin</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Tests">⚠️</a> <a href="#ideas-EmilTholin" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://medium.com/@oieduardorabelo"><img src="https://avatars1.githubusercontent.com/u/829902?v=4" width="100px;" alt="Eduardo Rabelo"/><br /><sub><b>Eduardo Rabelo</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Code">💻</a></td><td align="center"><a href="http://timdeschryver.dev"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4" width="100px;" alt="Tim Deschryver"/><br /><sub><b>Tim Deschryver</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=timdeschryver" title="Documentation">📖</a></td><td align="center"><a href="http://www.ematipico.com"><img src="https://avatars3.githubusercontent.com/u/602478?v=4" width="100px;" alt="Emanuele"/><br /><sub><b>Emanuele</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Documentation">📖</a></td></tr></table>
<!-- ALL-CONTRIBUTORS-LIST:END -->
Thanks goes to these people ([emoji key][emojis]):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors][all-contributors] specification.
Contributions of any kind welcome!
## Docs
[**Read The Docs**](https://testing-library.com/docs/svelte-testing-library/intro) |
[Edit the docs](https://github.com/alexkrolick/testing-library-docs)
See the [**docs**](https://testing-library.com/docs/svelte-testing-library/intro) over at the Testing Library website.

@@ -230,10 +123,35 @@ ## Issues

## Contributors
Thanks goes to these people ([emoji key][emojis]):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/benmonro"><img src="https://avatars3.githubusercontent.com/u/399236?v=4" width="100px;" alt="Ben Monro"/><br /><sub><b>Ben Monro</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Tests">⚠️</a> <a href="#ideas-benmonro" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Documentation">📖</a></td>
<td align="center"><a href="https://twitter.com/EmilTholin"><img src="https://avatars0.githubusercontent.com/u/11573167?v=4" width="100px;" alt="Emil Tholin"/><br /><sub><b>Emil Tholin</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Tests">⚠️</a> <a href="#ideas-EmilTholin" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://medium.com/@oieduardorabelo"><img src="https://avatars1.githubusercontent.com/u/829902?v=4" width="100px;" alt="Eduardo Rabelo"/><br /><sub><b>Eduardo Rabelo</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Documentation">📖</a> <a href="#example-oieduardorabelo" title="Examples">💡</a></td>
<td align="center"><a href="http://timdeschryver.dev"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4" width="100px;" alt="Tim Deschryver"/><br /><sub><b>Tim Deschryver</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=timdeschryver" title="Documentation">📖</a></td>
<td align="center"><a href="http://www.ematipico.com"><img src="https://avatars3.githubusercontent.com/u/602478?v=4" width="100px;" alt="Emanuele"/><br /><sub><b>Emanuele</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/pngwn"><img src="https://avatars1.githubusercontent.com/u/12937446?v=4" width="100px;" alt="pngwn"/><br /><sub><b>pngwn</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=pngwn" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=pngwn" title="Tests">⚠️</a></td>
<td align="center"><a href="https://twitter.com/sebsilbermann"><img src="https://avatars3.githubusercontent.com/u/12292047?v=4" width="100px;" alt="Sebastian Silbermann"/><br /><sub><b>Sebastian Silbermann</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=eps1lon" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/mihar-22"><img src="https://avatars3.githubusercontent.com/u/14304599?s=460&v=4" width="100px;" alt="Rahim Alwer"/><br /><sub><b>Rahim Alwer</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Documentation">📖</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Tests">⚠️</a></td>
</tr>
</table>
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors][all-contributors] specification.
Contributions of any kind welcome!
## LICENSE
MIT
[MIT](LICENSE)
<!--
Links:
-->
<!-- prettier-ignore-start -->

@@ -253,3 +171,3 @@

[spectrum]: https://spectrum.chat/testing-library
[license-badge]: https://img.shields.io/npm/l/svelte-testing-library.svg?style=flat-square
[license-badge]: https://img.shields.io/github/license/testing-library/svelte-testing-library?color=b
[license]: https://github.com/testing-library/svelte-testing-library/blob/master/LICENSE

@@ -277,1 +195,2 @@ [prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square

<!-- prettier-ignore-end -->
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc