diff --git a/.all-contributorsrc b/.all-contributorsrc
index 2c085cca..8e42dc90 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -498,6 +498,15 @@
"code",
"test"
]
+ },
+ {
+ "login": "Tolsee",
+ "name": "Tulsi Sapkota",
+ "avatar_url": "https://avatars0.githubusercontent.com/u/16590492?v=4",
+ "profile": "https://github.com/Tolsee",
+ "contributions": [
+ "code"
+ ]
}
]
}
diff --git a/.travis.yml b/.travis.yml
index c845ab33..19e2290f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,7 +6,6 @@ cache:
notifications:
email: false
node_js:
- - 'node'
- '10'
- '8'
install: npm install
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4bac2f05..55ff9fed 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -27,21 +27,6 @@ Thanks for being willing to contribute!
> branch. Whenever you want to update your version of `master`, do a regular
> `git pull`.
-## Add yourself as a contributor
-
-This project follows the [all contributors][all-contributors] specification.
-To add yourself to the table of contributors on the `README.md`, please use the
-automated script as part of your PR:
-
-```console
-npm run add-contributor
-```
-
-Follow the prompt and commit `.all-contributorsrc` and `README.md` in the PR.
-If you've already added yourself to the list and are making
-a new type of contribution, you can run it again and select the added
-contribution type.
-
## Committing and Pushing changes
Please make sure to run the tests before you commit your changes. You can run
diff --git a/README.md b/README.md
index 27061d52..643a2103 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@
[![downloads][downloads-badge]][npmtrends]
[![MIT License][license-badge]][license]
-[](#contributors)
+[](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Code of Conduct][coc-badge]][coc]
@@ -138,7 +138,7 @@ Thanks goes to these people ([emoji key][emojis]):
| [
dadamssg](https://github.com/dadamssg)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=dadamssg "Code") | [
Neil Kistner](https://neilkistner.com/)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=wyze "Code") | [
Ben Chauvette](http://bdchauvette.net/)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=bdchauvette "Code") | [
Jeff Baumgardt](https://github.com/JeffBaumgardt)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=JeffBaumgardt "Code") [📖](https://github.com/kentcdodds/dom-testing-library/commits?author=JeffBaumgardt "Documentation") | [
Matan Kushner](http://matchai.me)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=matchai "Code") [📖](https://github.com/kentcdodds/dom-testing-library/commits?author=matchai "Documentation") [🤔](#ideas-matchai "Ideas, Planning, & Feedback") [⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=matchai "Tests") | [
Alex Wendte](http://www.wendtedesigns.com/)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm "Code") [📖](https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm "Documentation") [⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm "Tests") | [
Tamas Fodor](https://github.com/ruffle1986)
[📖](https://github.com/kentcdodds/dom-testing-library/commits?author=ruffle1986 "Documentation") |
| [
Benjamin Eckardt](https://github.com/BenjaminEckardt)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=BenjaminEckardt "Code") | [
Ryan Campbell](https://github.com/campbellr)
[📖](https://github.com/kentcdodds/dom-testing-library/commits?author=campbellr "Documentation") | [
Taylor Briggs](https://taylor-briggs.com)
[⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=TaylorBriggs "Tests") | [
John Gozde](https://github.com/jgoz)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=jgoz "Code") | [
C. T. Lin](https://github.com/chentsulin)
[📖](https://github.com/kentcdodds/dom-testing-library/commits?author=chentsulin "Documentation") | [
Terrence Wong](http://terrencewwong.com)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=terrencewwong "Code") | [
Soo Jae Hwang](https://www.ossfinder.com)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=misoguy "Code") |
| [
Royston Shufflebotham](https://github.com/RoystonS)
[🐛](https://github.com/kentcdodds/dom-testing-library/issues?q=author%3ARoystonS "Bug reports") [💻](https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS "Code") [📖](https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS "Documentation") [⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS "Tests") | [
Vadim Brodsky](http://www.vadimbrodsky.com)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=VadimBrodsky "Code") | [
Eunjae Lee](https://twitter.com/eunjae_lee)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=eunjae-lee "Code") | [
David Peter](http://davidpeter.me)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=sarenji "Code") | [
Shy Alter](https://twitter.com/@puemos)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=puemos "Code") [📖](https://github.com/kentcdodds/dom-testing-library/commits?author=puemos "Documentation") | [
Łukasz Makuch](https://lukaszmakuch.pl)
[📦](#platform-lukaszmakuch "Packaging/porting to new platform") | [
Tyler Haas](https://github.com/tylerthehaas)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=tylerthehaas "Code") [⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=tylerthehaas "Tests") |
-| [
Vesa Laakso](http://vesalaakso.com)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=valscion "Code") [⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=valscion "Tests") |
+| [
Vesa Laakso](http://vesalaakso.com)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=valscion "Code") [⚠️](https://github.com/kentcdodds/dom-testing-library/commits?author=valscion "Tests") | [
Tulsi Sapkota](https://github.com/Tolsee)
[💻](https://github.com/kentcdodds/dom-testing-library/commits?author=Tolsee "Code") |
diff --git a/jest.config.js b/jest.config.js
index 435c4715..758048f5 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,20 +1,6 @@
const baseConfig = require('kcd-scripts/jest')
module.exports = {
- collectCoverageFrom: baseConfig.collectCoverageFrom,
- coverageThreshold: baseConfig.coverageThreshold,
- projects: [
- {
- ...baseConfig,
- displayName: 'jsdom',
- testEnvironment: 'jest-environment-jsdom',
- },
- {
- ...baseConfig,
- displayName: 'node',
- testEnvironment: 'jest-environment-node',
- },
- ],
- // this is for eslint
- modulePaths: baseConfig.modulePaths,
+ ...baseConfig,
+ testEnvironment: 'jest-environment-jsdom',
}
diff --git a/package.json b/package.json
index 0436eb4c..adb6b817 100644
--- a/package.json
+++ b/package.json
@@ -24,32 +24,36 @@
"node": ">=8"
},
"scripts": {
- "add-contributor": "kcd-scripts contributors add",
"build": "kcd-scripts build && kcd-scripts build --bundle --no-clean",
"lint": "kcd-scripts lint",
"test": "kcd-scripts test",
"test:update": "npm test -- --updateSnapshot --coverage",
"validate": "kcd-scripts validate",
"setup": "npm install && npm run validate -s",
- "precommit": "kcd-scripts precommit",
"dtslint": "dtslint typings"
},
+ "husky": {
+ "hooks": {
+ "pre-commit": "kcd-scripts pre-commit"
+ }
+ },
"files": [
"dist",
"typings"
],
"dependencies": {
- "@babel/runtime": "^7.1.5",
+ "@babel/runtime": "^7.3.4",
"@sheerun/mutationobserver-shim": "^0.3.2",
"pretty-format": "^24.0.0",
"wait-for-expect": "^1.1.0"
},
"devDependencies": {
- "dtslint": "^0.3.0",
- "jest-dom": "^2.1.1",
+ "dtslint": "^0.5.3",
+ "jest-dom": "^3.1.2",
"jest-in-case": "^1.0.2",
- "jsdom": "^13.0.0",
- "kcd-scripts": "^0.46.0"
+ "jest-watch-select-projects": "^0.1.1",
+ "jsdom": "^13.2.0",
+ "kcd-scripts": "^1.1.0"
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js",
diff --git a/src/__tests__/element-queries.js b/src/__tests__/element-queries.js
index d89d9142..f6c09bb6 100644
--- a/src/__tests__/element-queries.js
+++ b/src/__tests__/element-queries.js
@@ -1,7 +1,6 @@
import 'jest-dom/extend-expect'
import {configure} from '../config'
import {render, renderIntoDocument} from './helpers/test-utils'
-import document from './helpers/document'
beforeEach(() => {
document.defaultView.Cypress = null
diff --git a/src/__tests__/events.js b/src/__tests__/events.js
index a53fdf8b..198ceba0 100644
--- a/src/__tests__/events.js
+++ b/src/__tests__/events.js
@@ -1,6 +1,4 @@
import {fireEvent} from '..'
-import document from './helpers/document'
-import window from './helpers/window'
const eventTypes = [
{
diff --git a/src/__tests__/example.js b/src/__tests__/example.js
index f6a96dd6..da0bb8ba 100644
--- a/src/__tests__/example.js
+++ b/src/__tests__/example.js
@@ -2,7 +2,6 @@
import {getByLabelText, getByText, getByTestId, queryByTestId, wait} from '../'
// adds special assertions like toHaveTextContent
import 'jest-dom/extend-expect'
-import document from './helpers/document'
function getExampleDOM() {
// This is just a raw example of setting up some DOM
diff --git a/src/__tests__/get-queries-for-element.js b/src/__tests__/get-queries-for-element.js
index 44d2e43d..1a6afba8 100644
--- a/src/__tests__/get-queries-for-element.js
+++ b/src/__tests__/get-queries-for-element.js
@@ -1,6 +1,5 @@
import {getQueriesForElement} from '../get-queries-for-element'
import {queries} from '..'
-import document from './helpers/document'
test('uses default queries', () => {
const container = document.createElement('div')
diff --git a/src/__tests__/helpers.js b/src/__tests__/helpers.js
index 9e80cdb8..cbf6e628 100644
--- a/src/__tests__/helpers.js
+++ b/src/__tests__/helpers.js
@@ -1,17 +1,7 @@
import {getDocument, newMutationObserver} from '../helpers'
-describe('getDocument', () => {
- if (typeof document === 'undefined') {
- test('throws an error if window does not exist', () => {
- expect(() => getDocument()).toThrowError(
- /Could not find default container/,
- )
- })
- } else {
- test('returns global document if exists', () => {
- expect(getDocument()).toBe(document)
- })
- }
+test('returns global document if exists', () => {
+ expect(getDocument()).toBe(document)
})
class DummyClass {
diff --git a/src/__tests__/helpers/document.js b/src/__tests__/helpers/document.js
deleted file mode 100644
index 1df46c07..00000000
--- a/src/__tests__/helpers/document.js
+++ /dev/null
@@ -1,9 +0,0 @@
-let testWindow = typeof window === 'undefined' ? undefined : window
-
-if (typeof window === 'undefined') {
- const {JSDOM} = require('jsdom')
- const dom = new JSDOM()
- testWindow = dom.window
-}
-
-module.exports = testWindow.document
diff --git a/src/__tests__/helpers/test-utils.js b/src/__tests__/helpers/test-utils.js
index 9a31e232..71461eba 100644
--- a/src/__tests__/helpers/test-utils.js
+++ b/src/__tests__/helpers/test-utils.js
@@ -1,5 +1,4 @@
import {getQueriesForElement} from '../../get-queries-for-element'
-import document from './document'
function render(html) {
const container = document.createElement('div')
diff --git a/src/__tests__/helpers/window.js b/src/__tests__/helpers/window.js
deleted file mode 100644
index f9ebb36c..00000000
--- a/src/__tests__/helpers/window.js
+++ /dev/null
@@ -1,9 +0,0 @@
-let testWindow = typeof window === 'undefined' ? undefined : window
-
-if (typeof window === 'undefined') {
- const {JSDOM} = require('jsdom')
- const dom = new JSDOM()
- testWindow = dom.window
-}
-
-module.exports = testWindow
diff --git a/src/__tests__/pretty-dom.js b/src/__tests__/pretty-dom.js
index b2fe3d02..312cf78b 100644
--- a/src/__tests__/pretty-dom.js
+++ b/src/__tests__/pretty-dom.js
@@ -1,6 +1,5 @@
import {prettyDOM} from '../pretty-dom'
import {render} from './helpers/test-utils'
-import document from './helpers/document'
test('it prints out the given DOM element tree', () => {
const {container} = render('