Skip to content

Commit 7a57626

Browse files
author
Kent C. Dodds
committed
improve a few things
1 parent 42942b7 commit 7a57626

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

add-commands.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// this file is here so it's easy to register the commands
2+
// `import 'cypress-testing-library/add-commands'`
3+
// eslint-disable-next-line
4+
require('./dist/add-commands')

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,19 @@
1717
"precommit": "kcd-scripts precommit"
1818
},
1919
"files": [
20-
"dist"
20+
"dist",
21+
"add-commands.js"
22+
],
23+
"keywords": [
24+
"testing",
25+
"cypress",
26+
"ui",
27+
"dom",
28+
"integration",
29+
"functional",
30+
"end-to-end",
31+
"e2e"
2132
],
22-
"keywords": [],
2333
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
2434
"license": "MIT",
2535
"dependencies": {

src/add-commands.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {commands} from './'
2+
3+
commands.forEach(({command, name}) => {
4+
Cypress.Commands.add(name, command)
5+
})
6+
7+
/* global Cypress */

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const commands = Object.keys(queries)
55
.map(queryName => {
66
const commandName = queryName.replace(/^query/, 'get')
77
return {
8-
commandName,
8+
name: commandName,
99
command: (...args) => {
1010
const fn = new Function(
1111
'args',

0 commit comments

Comments
 (0)