Skip to content

Commit 7247eec

Browse files
authored
Merge branch 'master' into allow-all-elements
2 parents 30cf4bf + 51d9893 commit 7247eec

File tree

7 files changed

+107
-51
lines changed

7 files changed

+107
-51
lines changed

.all-contributorsrc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,20 @@
9292
"doc",
9393
"test"
9494
]
95+
},
96+
{
97+
"login": "MirrorBytes",
98+
"name": "Bob",
99+
"avatar_url": "https://avatars3.githubusercontent.com/u/22119469?v=4",
100+
"profile": "https://github.com/MirrorBytes",
101+
"contributions": [
102+
"bug",
103+
"code"
104+
]
95105
}
96106
],
97107
"contributorsPerLine": 7,
98108
"repoHost": "https://github.com",
99-
"commitConvention": "none"
109+
"commitConvention": "none",
110+
"skipCi": true
100111
}

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
],
1616
rules: {
1717
'max-len': ['warn', { code: 100 }],
18-
'simple-import-sort/sort': 'error',
18+
'simple-import-sort/imports': 'error',
1919
'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 2, maxEOF: 0 }]
2020
},
2121
overrides: [

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
test:
9+
# ignore all-contributors PRs
10+
if: ${{ !contains(github.head_ref, 'all-contributors') }}
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node: [10.x, 12.x]
17+
18+
steps:
19+
- name: Cancel previous runs
20+
uses: styfle/[email protected]
21+
with:
22+
access_token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- uses: actions/checkout@v2
25+
26+
- name: Setup nodejs
27+
uses: actions/setup-node@v2-beta
28+
with:
29+
node-version: ${{ matrix.node }}
30+
- name: Install Deps
31+
run: npm install
32+
- name: Validate package
33+
run: npm run validate
34+
35+
release:
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Cancel previous runs
40+
uses: styfle/[email protected]
41+
with:
42+
access_token: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- uses: actions/checkout@v2
45+
46+
- name: Setup nodejs
47+
uses: actions/setup-node@v2-beta
48+
with:
49+
node-version: 12.x
50+
- name: Install Deps
51+
run: npm install
52+
- name: Update tests, coverage, and release
53+
run: npm run test:update && npx codecov && npx semantic-release
54+
env:
55+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,17 @@ Thanks goes to these people ([emoji key][emojis]):
121121
<!-- markdownlint-disable -->
122122
<table>
123123
<tr>
124-
<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>
125-
<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>
126-
<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>
127-
<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>
128-
<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>
129-
<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>
130-
<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>
124+
<td align="center"><a href="https://github.com/benmonro"><img src="https://avatars3.githubusercontent.com/u/399236?v=4" width="100px;" alt=""/><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>
125+
<td align="center"><a href="https://twitter.com/EmilTholin"><img src="https://avatars0.githubusercontent.com/u/11573167?v=4" width="100px;" alt=""/><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>
126+
<td align="center"><a href="https://medium.com/@oieduardorabelo"><img src="https://avatars1.githubusercontent.com/u/829902?v=4" width="100px;" alt=""/><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>
127+
<td align="center"><a href="http://timdeschryver.dev"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4" width="100px;" alt=""/><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>
128+
<td align="center"><a href="http://www.ematipico.com"><img src="https://avatars3.githubusercontent.com/u/602478?v=4" width="100px;" alt=""/><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>
129+
<td align="center"><a href="https://github.com/pngwn"><img src="https://avatars1.githubusercontent.com/u/12937446?v=4" width="100px;" alt=""/><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>
130+
<td align="center"><a href="https://twitter.com/sebsilbermann"><img src="https://avatars3.githubusercontent.com/u/12292047?v=4" width="100px;" alt=""/><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>
131131
</tr>
132132
<tr>
133-
<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>
133+
<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=""/><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>
134+
<td align="center"><a href="https://github.com/MirrorBytes"><img src="https://avatars3.githubusercontent.com/u/22119469?v=4" width="100px;" alt=""/><br /><sub><b>Bob</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/issues?q=author%3AMirrorBytes" title="Bug reports">🐛</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=MirrorBytes" title="Code">💻</a></td>
134135
</tr>
135136
</table>
136137

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,14 @@
6565
"all-contributors-cli": "^6.9.0",
6666
"babel-eslint": "^10.0.3",
6767
"babel-jest": "^26.0.1",
68-
"doctoc": "^1.4.0",
68+
"doctoc": "^2.0.0",
6969
"eslint": "^7.2.0",
7070
"eslint-config-standard": "^16.0.0",
7171
"eslint-plugin-import": "^2.18.2",
7272
"eslint-plugin-node": "^11.0.0",
7373
"eslint-plugin-promise": "^4.2.1",
74-
"eslint-plugin-simple-import-sort": "^6.0.0",
75-
"eslint-plugin-standard": "^4.0.1",
76-
"eslint-plugin-svelte3": "^2.7.3",
74+
"eslint-plugin-simple-import-sort": "^7.0.0",
75+
"eslint-plugin-svelte3": "^3.0.0",
7776
"husky": "^4.0.9",
7877
"jest": "^26.0.1",
7978
"lint-staged": "^10.0.0",

src/pure.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,35 @@ const render = (
1515
target = target || container.appendChild(document.createElement('div'))
1616

1717
const ComponentConstructor = Component.default || Component
18-
const isProps = !Object.keys(options).some(option => svleteComponentOptions.includes(option))
19-
20-
// Check if any props and Svelte options were accidentally mixed.
21-
if (!isProps) {
22-
const unrecognizedOptions = Object
23-
.keys(options)
24-
.filter(option => !svleteComponentOptions.includes(option))
25-
26-
if (unrecognizedOptions.length > 0) {
27-
throw Error(`
28-
Unknown options were found [${unrecognizedOptions}]. This might happen if you've mixed
29-
passing in props with Svelte options into the render function. Valid Svelte options
30-
are [${svleteComponentOptions}]. You can either change the prop names, or pass in your
31-
props for that component via the \`props\` option.\n\n
32-
Eg: const { /** Results **/ } = render(MyComponent, { props: { /** props here **/ } })\n\n
33-
`)
18+
19+
const checkProps = (options) => {
20+
const isProps = !Object.keys(options).some(option => svleteComponentOptions.includes(option))
21+
22+
// Check if any props and Svelte options were accidentally mixed.
23+
if (!isProps) {
24+
const unrecognizedOptions = Object
25+
.keys(options)
26+
.filter(option => !svleteComponentOptions.includes(option))
27+
28+
if (unrecognizedOptions.length > 0) {
29+
throw Error(`
30+
Unknown options were found [${unrecognizedOptions}]. This might happen if you've mixed
31+
passing in props with Svelte options into the render function. Valid Svelte options
32+
are [${svleteComponentOptions}]. You can either change the prop names, or pass in your
33+
props for that component via the \`props\` option.\n\n
34+
Eg: const { /** Results **/ } = render(MyComponent, { props: { /** props here **/ } })\n\n
35+
`)
36+
}
37+
38+
return options
3439
}
40+
41+
return { props: options }
3542
}
3643

3744
const component = new ComponentConstructor({
3845
target,
39-
...(isProps ? { props: options } : options)
46+
...checkProps(options)
4047
})
4148

4249
containerCache.set(container, { target, component })
@@ -53,8 +60,8 @@ const render = (
5360

5461
// eslint-disable-next-line no-new
5562
const newComponent = new ComponentConstructor({
56-
...options,
57-
target
63+
target,
64+
...checkProps(options)
5865
})
5966

6067
containerCache.set(container, { target, newComponent })

0 commit comments

Comments
 (0)