Skip to content

Commit 953a4db

Browse files
authored
chore(release): promote 5.2.0 to stable
2 parents 326fb58 + 2fb7423 commit 953a4db

31 files changed

+580
-427
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ scripts/*
33
.prettierignore
44
.github/workflows/*
55
*.md
6+
types

.eslintrc.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ module.exports = {
2525
},
2626
rules: {
2727
'no-undef-init': 'off',
28+
'prefer-const': 'off',
29+
'svelte/no-unused-svelte-ignore': 'off',
2830
},
2931
},
3032
{
@@ -49,5 +51,6 @@ module.exports = {
4951
ecmaVersion: 2022,
5052
sourceType: 'module',
5153
},
54+
globals: { $state: 'readonly', $props: 'readonly' },
5255
ignorePatterns: ['!/.*'],
5356
}

.github/workflows/release.yml

+38-18
Original file line numberDiff line numberDiff line change
@@ -59,43 +59,63 @@ jobs:
5959
run: npm run test:${{ matrix.test-runner }}
6060

6161
- name: ▶️ Run type-checks
62-
if: ${{ matrix.node == '20' && matrix.svelte == '4' && matrix.test-runner == 'vitest:jsdom' }}
62+
# NOTE: `SvelteComponent` is not generic in Svelte v3, so type-checking will not pass
63+
if: ${{ matrix.node == '20' && matrix.svelte != '3' && matrix.test-runner == 'vitest:jsdom' }}
6364
run: npm run types
6465

6566
- name: ⬆️ Upload coverage report
6667
uses: codecov/codecov-action@v3
6768

68-
release:
69-
needs: main
69+
build:
7070
runs-on: ubuntu-latest
71-
if: ${{ github.repository == 'testing-library/svelte-testing-library' &&
72-
contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha',
73-
github.ref) && github.event_name == 'push' }}
7471
steps:
7572
- name: ⬇️ Checkout repo
7673
uses: actions/checkout@v4
7774

7875
- name: ⎔ Setup node
7976
uses: actions/setup-node@v4
8077
with:
81-
node-version: 16
78+
node-version: 20
8279

8380
- name: 📥 Download deps
8481
run: npm install --no-package-lock
8582

83+
- name: 🏗️ Build types
84+
run: npm run build
85+
86+
- name: ⬆️ Upload types build
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: types
90+
path: types
91+
92+
release:
93+
needs: [main, build]
94+
runs-on: ubuntu-latest
95+
if: ${{ github.repository == 'testing-library/svelte-testing-library' &&
96+
contains('refs/heads/main,refs/heads/next', github.ref) &&
97+
github.event_name == 'push' }}
98+
steps:
99+
- name: ⬇️ Checkout repo
100+
uses: actions/checkout@v4
101+
102+
- name: ⎔ Setup node
103+
uses: actions/setup-node@v4
104+
with:
105+
node-version: 20
106+
107+
- name: 📥 Downloads types build
108+
uses: actions/download-artifact@v4
109+
with:
110+
name: types
111+
path: types
112+
86113
- name: 🚀 Release
87-
uses: cycjimmy/semantic-release-action@v2
114+
uses: cycjimmy/semantic-release-action@v4
88115
with:
89-
semantic_version: 17
90-
branches: |
91-
[
92-
'+([0-9])?(.{+([0-9]),x}).x',
93-
'main',
94-
'next',
95-
'next-major',
96-
{name: 'beta', prerelease: true},
97-
{name: 'alpha', prerelease: true}
98-
]
116+
semantic_version: 24
117+
extra_plugins: |
118+
conventional-changelog-conventionalcommits@8
99119
env:
100120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101121
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ dist
99
yarn-error.log
1010
package-lock.json
1111
yarn.lock
12+
13+
# generated typing output
14+
types

CONTRIBUTING.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,23 @@
99

1010
## Release
1111

12-
The module is released automatically from the `main` branch using [semantic-release-action][]. Version bumps and change logs are generated from the commit messages.
12+
The module is released automatically from the `main` and `next` branches using [semantic-release-action][]. Version bumps and change logs are generated from the commit messages.
1313

1414
[semantic-release-action]: https://github.com/cycjimmy/semantic-release-action
1515

16+
### Preview release
17+
18+
If you would like to preview the release from a given branch, and...
19+
20+
- You have push access to the repository
21+
- The branch exists in GitHub
22+
23+
...you can preview the next release version and changelog using:
24+
25+
```shell
26+
npm run preview-release
27+
```
28+
1629
## Development setup
1730

1831
After cloning the repository, install the project's dependencies and run the `validate` script to run all checks and tests to verify your setup.

README.md

+65-74
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@
1212

1313
<p>Simple and complete Svelte testing utilities that encourage good testing practices.</p>
1414

15-
[**Read The Docs**](https://testing-library.com/docs/svelte-testing-library/intro) |
16-
[Edit the docs](https://github.com/testing-library/testing-library-docs)
15+
[**Read The Docs**][stl-docs] | [Edit the docs][stl-docs-repo]
1716

1817
<!-- prettier-ignore-start -->
1918
[![Build Status][build-badge]][build]
2019
[![Code Coverage][coverage-badge]][coverage]
21-
[![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends]
20+
[![version][version-badge]][package]
21+
[![downloads][downloads-badge]][downloads]
2222
[![MIT License][license-badge]][license]
2323

24-
[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-)
25-
[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc]
24+
[![All Contributors][contributors-badge]][contributors]
25+
[![PRs Welcome][prs-badge]][prs]
26+
[![Code of Conduct][coc-badge]][coc]
2627
[![Discord][discord-badge]][discord]
2728

2829
[![Watch on GitHub][github-watch-badge]][github-watch]
@@ -33,6 +34,33 @@
3334

3435
<hr />
3536

37+
[stl-docs]: https://testing-library.com/docs/svelte-testing-library/intro
38+
[stl-docs-repo]: https://github.com/testing-library/testing-library-docs
39+
[build-badge]: https://img.shields.io/github/actions/workflow/status/testing-library/svelte-testing-library/release.yml?style=flat-square
40+
[build]: https://github.com/testing-library/svelte-testing-library/actions
41+
[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/svelte-testing-library.svg?style=flat-square
42+
[coverage]: https://codecov.io/github/testing-library/svelte-testing-library
43+
[version-badge]: https://img.shields.io/npm/v/@testing-library/svelte.svg?style=flat-square
44+
[package]: https://www.npmjs.com/package/@testing-library/svelte
45+
[downloads-badge]: https://img.shields.io/npm/dm/@testing-library/svelte.svg?style=flat-square
46+
[downloads]: http://www.npmtrends.com/@testing-library/svelte
47+
[license-badge]: https://img.shields.io/github/license/testing-library/svelte-testing-library?color=b&style=flat-square
48+
[license]: https://github.com/testing-library/svelte-testing-library/blob/main/LICENSE
49+
[contributors-badge]: https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square
50+
[contributors]: #contributors
51+
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
52+
[prs]: http://makeapullrequest.com
53+
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
54+
[coc]: https://github.com/testing-library/svelte-testing-library/blob/main/CODE_OF_CONDUCT.md
55+
[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
56+
[discord]: https://discord.gg/testing-library
57+
[github-watch-badge]: https://img.shields.io/github/watchers/testing-library/svelte-testing-library.svg?style=social
58+
[github-watch]: https://github.com/testing-library/svelte-testing-library/watchers
59+
[github-star-badge]: https://img.shields.io/github/stars/testing-library/svelte-testing-library.svg?style=social
60+
[github-star]: https://github.com/testing-library/svelte-testing-library/stargazers
61+
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20svelte-testing-library%20by%20%40@TestingLib%20https%3A%2F%2Fgithub.com%2Ftesting-library%2Fsvelte-testing-library%20%F0%9F%91%8D
62+
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/svelte-testing-library.svg?style=social
63+
3664
## Table of Contents
3765

3866
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
@@ -41,48 +69,57 @@
4169
- [The Problem](#the-problem)
4270
- [This Solution](#this-solution)
4371
- [Installation](#installation)
72+
- [Setup](#setup)
4473
- [Docs](#docs)
4574
- [Issues](#issues)
4675
- [🐛 Bugs](#-bugs)
4776
- [💡 Feature Requests](#-feature-requests)
4877
- [❓ Questions](#-questions)
4978
- [Contributors](#contributors)
50-
- [LICENSE](#license)
5179

5280
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
5381

5482
## The Problem
5583

56-
You want to write tests for your Svelte components so that they avoid including implementation
57-
details, and are maintainable in the long run.
84+
You want to write maintainable tests for your [Svelte][svelte] components.
85+
86+
[svelte]: https://svelte.dev/
5887

5988
## This Solution
6089

61-
The `svelte-testing-library` is a very lightweight solution for testing Svelte
62-
components. It provides light utility functions on top of `svelte` and
63-
`dom-testing-library`, in a way that encourages better testing practices. Its
64-
primary guiding principle is:
90+
`@testing-library/svelte` is a lightweight library for testing Svelte
91+
components. It provides functions on top of `svelte` and
92+
`@testing-library/dom` so you can mount Svelte components and query their
93+
rendered output in the DOM. Its primary guiding principle is:
6594

6695
> [The more your tests resemble the way your software is used, the more
6796
> confidence they can give you.][guiding-principle]
6897
98+
[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
99+
69100
## Installation
70101

71102
This module is distributed via [npm][npm] which is bundled with [node][node] and
72103
should be installed as one of your project's `devDependencies`:
73104

74-
```
105+
```shell
75106
npm install --save-dev @testing-library/svelte
76107
```
77108

78-
This library has `peerDependencies` listings for `svelte >= 3`.
109+
This library supports `svelte` versions `3`, `4`, and `5`.
110+
111+
You may also be interested in installing `@testing-library/jest-dom` so you can
112+
use [the custom jest matchers][jest-dom].
79113

80-
You may also be interested in installing `@testing-library/jest-dom` so you can use
81-
[the custom jest matchers](https://github.com/testing-library/jest-dom).
114+
[npm]: https://www.npmjs.com/
115+
[node]: https://nodejs.org
116+
[jest-dom]: https://github.com/testing-library/jest-dom
82117

83118
## Setup
84119

85-
We recommend using `@testing-library/svelte` with [Vitest][] as your test runner. To get started, add the `svelteTesting` plugin to your Vite or Vitest config.
120+
We recommend using `@testing-library/svelte` with [Vitest][] as your test
121+
runner. To get started, add the `svelteTesting` plugin to your Vite or Vitest
122+
config.
86123

87124
```diff
88125
// vite.config.js
@@ -97,49 +134,40 @@ We recommend using `@testing-library/svelte` with [Vitest][] as your test runner
97134
});
98135
```
99136

100-
See the [setup docs][] for more detailed setup instructions, including for other test runners like Jest.
137+
See the [setup docs][] for more detailed setup instructions, including for other
138+
test runners like Jest.
101139

102140
[vitest]: https://vitest.dev/
103141
[setup docs]: https://testing-library.com/docs/svelte-testing-library/setup
104142

105-
### Svelte 5 support
106-
107-
If you are riding the bleeding edge of Svelte 5, you'll need to either
108-
import from `@testing-library/svelte/svelte5` instead of `@testing-library/svelte`, or add an alias to your `vite.config.js`:
109-
110-
```js
111-
export default defineConfig({
112-
plugins: [svelte(), svelteTesting()],
113-
test: {
114-
alias: {
115-
'@testing-library/svelte': '@testing-library/svelte/svelte5',
116-
},
117-
},
118-
})
119-
```
120-
121143
## Docs
122144

123-
See the [**docs**](https://testing-library.com/docs/svelte-testing-library/intro) over at the Testing Library website.
145+
See the [**docs**][stl-docs] over at the Testing Library website.
124146

125147
## Issues
126148

127149
_Looking to contribute? Look for the [Good First Issue][good-first-issue]
128150
label._
129151

152+
[good-first-issue]: https://github.com/testing-library/svelte-testing-library/issues?utf8=✓&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A"good+first+issue"+
153+
130154
### 🐛 Bugs
131155

132156
Please file an issue for bugs, missing documentation, or unexpected behavior.
133157

134158
[**See Bugs**][bugs]
135159

160+
[bugs]: https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc
161+
136162
### 💡 Feature Requests
137163

138164
Please file an issue to suggest new features. Vote on feature requests by adding
139165
a 👍. This helps maintainers prioritize what to work on.
140166

141167
[**See Feature Requests**][requests]
142168

169+
[requests]: https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3Aenhancement+is%3Aopen
170+
143171
### ❓ Questions
144172

145173
For questions related to using the library, please visit a support community
@@ -148,6 +176,8 @@ instead of filing an issue on GitHub.
148176
- [Discord][discord]
149177
- [Stack Overflow][stackoverflow]
150178

179+
[stackoverflow]: https://stackoverflow.com/questions/tagged/svelte-testing-library
180+
151181
## Contributors
152182

153183
Thanks goes to these people ([emoji key][emojis]):
@@ -189,44 +219,5 @@ Thanks goes to these people ([emoji key][emojis]):
189219
This project follows the [all-contributors][all-contributors] specification.
190220
Contributions of any kind welcome!
191221

192-
## LICENSE
193-
194-
[MIT](LICENSE)
195-
196-
<!-- prettier-ignore-start -->
197-
198-
[npm]: https://www.npmjs.com/
199-
[node]: https://nodejs.org
200-
[build-badge]: https://img.shields.io/github/actions/workflow/status/testing-library/svelte-testing-library/release.yml?style=flat-square
201-
[build]: https://github.com/testing-library/svelte-testing-library/actions
202-
[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/svelte-testing-library.svg?style=flat-square
203-
[coverage]: https://codecov.io/github/testing-library/svelte-testing-library
204-
[version-badge]: https://img.shields.io/npm/v/@testing-library/svelte.svg?style=flat-square
205-
[package]: https://www.npmjs.com/package/@testing-library/svelte
206-
[downloads-badge]: https://img.shields.io/npm/dm/@testing-library/svelte.svg?style=flat-square
207-
[npmtrends]: http://www.npmtrends.com/@testing-library/svelte
208-
[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
209-
[discord]: https://discord.gg/testing-library
210-
[license-badge]: https://img.shields.io/github/license/testing-library/svelte-testing-library?color=b&style=flat-square
211-
[license]: https://github.com/testing-library/svelte-testing-library/blob/main/LICENSE
212-
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
213-
[prs]: http://makeapullrequest.com
214-
[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
215-
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
216-
[coc]: https://github.com/testing-library/svelte-testing-library/blob/main/CODE_OF_CONDUCT.md
217-
[github-watch-badge]: https://img.shields.io/github/watchers/testing-library/svelte-testing-library.svg?style=social
218-
[github-watch]: https://github.com/testing-library/svelte-testing-library/watchers
219-
[github-star-badge]: https://img.shields.io/github/stars/testing-library/svelte-testing-library.svg?style=social
220-
[github-star]: https://github.com/testing-library/svelte-testing-library/stargazers
221-
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20svelte-testing-library%20by%20%40@TestingLib%20https%3A%2F%2Fgithub.com%2Ftesting-library%2Fsvelte-testing-library%20%F0%9F%91%8D
222-
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/svelte-testing-library.svg?style=social
223222
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
224223
[all-contributors]: https://github.com/all-contributors/all-contributors
225-
[set-immediate]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate
226-
[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
227-
[bugs]: https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc
228-
[requests]: https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3Aenhancement+is%3Aopen
229-
[good-first-issue]: https://github.com/testing-library/svelte-testing-library/issues?utf8=✓&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A"good+first+issue"+
230-
[stackoverflow]: https://stackoverflow.com/questions/tagged/svelte-testing-library
231-
232-
<!-- prettier-ignore-end -->

0 commit comments

Comments
 (0)