Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Rewrite #120

Open
wants to merge 154 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
432865c
Remove old source
RealOrangeOne Dec 10, 2016
6d681c8
Update dependancies
RealOrangeOne Dec 10, 2016
d9a5753
Add babel build
RealOrangeOne Dec 10, 2016
96b1114
Add haste map generator
RealOrangeOne Dec 10, 2016
aa72a6f
Build file on post install
RealOrangeOne Dec 10, 2016
89f467c
Use require, dummy!
RealOrangeOne Dec 10, 2016
19c9cc9
Remove old test files
RealOrangeOne Dec 10, 2016
a8430c9
Add prepublish
RealOrangeOne Dec 10, 2016
c6a65d4
dont commit the map fool!
RealOrangeOne Dec 10, 2016
4e3296b
Add mock file
RealOrangeOne Dec 10, 2016
3c07424
use imports
RealOrangeOne Dec 10, 2016
b4e0916
use built script
RealOrangeOne Dec 10, 2016
f1d40a0
Start on mocking code
RealOrangeOne Dec 10, 2016
68ca353
Make haste script node 4 compatable
RealOrangeOne Dec 10, 2016
7b247b2
wrong lib...
RealOrangeOne Dec 10, 2016
e13a36c
Disable var check on haste builder
RealOrangeOne Dec 11, 2016
6680892
Add extra dependandies for node 4
RealOrangeOne Dec 11, 2016
130a5ee
Add remaining mock library
RealOrangeOne Dec 11, 2016
151bc02
add some basic tests
RealOrangeOne Dec 11, 2016
33567e4
Update lint config
RealOrangeOne Dec 11, 2016
9a24aa4
add tests for mock component script
RealOrangeOne Dec 11, 2016
1888718
Fix linter
RealOrangeOne Dec 12, 2016
568102d
Better tests
RealOrangeOne Dec 12, 2016
1706f48
fix typo
RealOrangeOne Dec 12, 2016
9e8c8b4
remove pointless test
RealOrangeOne Dec 12, 2016
3783b75
Add coverage
RealOrangeOne Dec 12, 2016
8c8d9f1
Added nycrc file, woops
RealOrangeOne Dec 13, 2016
e0623d2
More tests on global
RealOrangeOne Dec 14, 2016
24df013
Add better tests to haste map
RealOrangeOne Dec 14, 2016
4e22354
Add longer timeout for tests
RealOrangeOne Dec 14, 2016
184b5c7
Remove unnecessary done
RealOrangeOne Dec 14, 2016
1c1edab
Add more general test
RealOrangeOne Dec 14, 2016
049df39
More timeout
RealOrangeOne Dec 14, 2016
c9610a6
Refactor mocks to not require mockery internally
RealOrangeOne Dec 31, 2016
2191970
Fix mock component
RealOrangeOne Dec 31, 2016
79bbb76
Update ListViewDataSource mock
RealOrangeOne Dec 31, 2016
6e6123b
update requireNativeComponent
RealOrangeOne Dec 31, 2016
32b5f8c
add RefreshControl mock
RealOrangeOne Dec 31, 2016
bfb7850
cleanup dependencies
RealOrangeOne Dec 31, 2016
3457640
fix lint
RealOrangeOne Dec 31, 2016
5c69cf3
QUICKLY
RealOrangeOne Jan 1, 2017
47803e3
Added sinon for spying
RealOrangeOne Jan 1, 2017
4c08063
Add test cases for native modules
RealOrangeOne Jan 1, 2017
17fde2e
Test mocked components
RealOrangeOne Jan 1, 2017
4c8a0a7
Better check module requires
RealOrangeOne Jan 1, 2017
c598674
Make images requirable
RealOrangeOne Jan 2, 2017
d0e99ae
FIx mock component display name
RealOrangeOne Jan 2, 2017
f81a298
Fix linting
RealOrangeOne Jan 2, 2017
751dc0d
Start rendering actual components
RealOrangeOne Jan 2, 2017
6b6106e
Add / setup jsdom
RealOrangeOne Jan 2, 2017
6578af5
Fix haste map generator
RealOrangeOne Jan 2, 2017
09b1c2e
Create expect spy wrapper
RealOrangeOne Jan 2, 2017
9583ea8
Add some tests of actual components
RealOrangeOne Jan 2, 2017
2684426
Allow 0.38+
RealOrangeOne Jan 3, 2017
d191d31
Rearrange mocks and add listview mock
RealOrangeOne Jan 3, 2017
557c734
rearrange mocks again
RealOrangeOne Jan 3, 2017
5981d4a
less hax in test
RealOrangeOne Jan 3, 2017
f32e79f
Use less simple tests for ActivityIndicator and ListView
RealOrangeOne Jan 3, 2017
401b096
Cleanup listview mock
RealOrangeOne Jan 3, 2017
5dcd3f9
Validate react-native version
RealOrangeOne Jan 3, 2017
c898b43
Added remaining basic tests
RealOrangeOne Jan 3, 2017
7600e0d
Import old tests
RealOrangeOne Jan 3, 2017
9a481f9
Cleanup readme
RealOrangeOne Jan 3, 2017
189434e
fix lint
RealOrangeOne Jan 3, 2017
3056818
Added polyfill for navigator if not defined
RealOrangeOne Jan 5, 2017
2866e5d
Fix coverage
RealOrangeOne Jan 8, 2017
5af4dcd
Add test for platform native module
RealOrangeOne Jan 8, 2017
d567f33
Fix lint
RealOrangeOne Jan 8, 2017
1ebd34a
Use flat icons on readme
RealOrangeOne Jan 8, 2017
a36714a
Add timer for haste map
RealOrangeOne Jan 8, 2017
4b9e968
Increase timeout because node4 is really slow
RealOrangeOne Jan 8, 2017
5b19fd3
fix eslint
RealOrangeOne Jan 8, 2017
5d7c09d
Merge remote-tracking branch 'origin' into rewrite
RealOrangeOne Jan 8, 2017
07974bf
Add script to stop requiring
RealOrangeOne Jan 8, 2017
c025450
Fix lint and remove unused dep
RealOrangeOne Jan 8, 2017
8e43096
Add codecov
RealOrangeOne Jan 8, 2017
27d2f45
Use actual codecov link...
RealOrangeOne Jan 8, 2017
c384be3
Fix markdown syntax
RealOrangeOne Jan 8, 2017
783ca5b
Use actual project paths instead of self
RealOrangeOne Jan 9, 2017
6efcd3a
Lock to versions of react-native
RealOrangeOne Jan 9, 2017
48a45b3
Fix glob path when in project tests
RealOrangeOne Feb 28, 2017
bac5fbe
Test there are items in haste map
RealOrangeOne Feb 28, 2017
99dbc53
Merge remote-tracking branch 'origin' into rewrite
RealOrangeOne Feb 28, 2017
ee571f8
Add tests for alert
RealOrangeOne Mar 1, 2017
eb657b3
Add alertIOS tests
RealOrangeOne Mar 1, 2017
d34acc7
Add tests for appregistry
RealOrangeOne Mar 1, 2017
d13c12b
Add more UIManager spies
RealOrangeOne Mar 1, 2017
1c4f754
Fix lint
RealOrangeOne Mar 1, 2017
6f84e21
Test AppState
RealOrangeOne Mar 1, 2017
c2f0dd7
Add functional mock for AsyncStorage
RealOrangeOne Mar 1, 2017
ac5a0c8
Fix import
RealOrangeOne Mar 1, 2017
fd8b992
Add BackAndroid tests
RealOrangeOne Mar 1, 2017
32b444c
Add CameraRoll tests
RealOrangeOne Mar 1, 2017
9ab4dd5
Add clipboard test
RealOrangeOne Mar 1, 2017
e7184dc
Add DatePickerAndroid tests
RealOrangeOne Mar 1, 2017
7f73a38
Add Dimensions tests
RealOrangeOne Mar 1, 2017
d372ad8
Add easing tests
RealOrangeOne Mar 1, 2017
954e770
Try running all the tests
RealOrangeOne Mar 2, 2017
a4b76d6
Install all at once, rebuild haste afterwards
RealOrangeOne Mar 2, 2017
0cf5aad
Loose version numbers
RealOrangeOne Mar 2, 2017
2b081af
Update test for new workflow
RealOrangeOne Mar 2, 2017
12aabb5
MOAR TESTS
RealOrangeOne Mar 2, 2017
9173378
Enable circleci for standard testing
RealOrangeOne Mar 2, 2017
c26302b
Add circleci image to readme
RealOrangeOne Mar 2, 2017
31746f0
Increase timeout to a minute, node 4 is SLOW
RealOrangeOne Mar 2, 2017
a8b7f7f
Cover additional native modules in tests
RealOrangeOne Mar 3, 2017
80d305d
Improve spy checks
RealOrangeOne Mar 3, 2017
3e3fb41
Add GeoLocation tests
RealOrangeOne Mar 4, 2017
46c4a50
Add ImageEditor tests
RealOrangeOne Mar 4, 2017
36489e4
Add ImagePickerIOS tests
RealOrangeOne Mar 4, 2017
0f6b952
Cover main import handler
RealOrangeOne Mar 4, 2017
2ff15c4
Fix platform native modules
RealOrangeOne Mar 6, 2017
ab67ea8
Add Platform API tests
RealOrangeOne Mar 6, 2017
a31f573
test against [email protected]
RealOrangeOne Mar 6, 2017
1bd8d2d
Make test match native modules
RealOrangeOne Mar 10, 2017
48f544d
43 isnt released yet
RealOrangeOne Mar 10, 2017
d82ef81
Add Keyboard tests
RealOrangeOne Mar 10, 2017
4360312
Add ImageStore tests
RealOrangeOne Mar 10, 2017
5e2687a
Add InteractionManager tests
RealOrangeOne Mar 10, 2017
b132204
dont require mocking script inside tests
RealOrangeOne Mar 10, 2017
36a4eba
fix strange promise stuff
RealOrangeOne Mar 10, 2017
2b330aa
Fix scrollview mock
RealOrangeOne Mar 10, 2017
bd69f54
Lint scripts
RealOrangeOne Mar 10, 2017
85a98e6
format main script
RealOrangeOne Mar 10, 2017
fee6e30
Test async storage is mocked
RealOrangeOne Mar 10, 2017
dc26ea0
Update linter rule
RealOrangeOne Mar 10, 2017
e6ca3b9
Add jest test run for reference
RealOrangeOne Mar 10, 2017
48fe4fa
Add Linking test
RealOrangeOne Mar 10, 2017
706778f
Try testing against 0.43
RealOrangeOne Apr 9, 2017
b756c15
Remove pinned deps, upgrade enzyme
RealOrangeOne Apr 9, 2017
16df641
Update to RN 0.49
Nov 5, 2017
513d44a
Fix BackAndroid and add BackHandler
Nov 5, 2017
84cb37b
Remove `Navigator` test as it was removed from RN
Nov 5, 2017
d8e6869
Fix Dimensions test
Nov 5, 2017
43c045a
Fix tests for Android progress bar and NativeModules Dimensions
Nov 5, 2017
f005766
Update for RN 0.50
Nov 5, 2017
4256a3d
Package updates
Nov 5, 2017
4fcf080
Automatic lint fixes
Nov 5, 2017
a15c31e
Manual lint fixes
Nov 5, 2017
e7b2d15
Fix test broken by chai upgrade
Nov 5, 2017
36f18ea
More package updates
Nov 5, 2017
014cde7
Update travis to test RN 0.49+
Nov 5, 2017
6aa7840
Remove react-addons-test-utils from travis builds
Nov 6, 2017
f1b2f25
Use RN 0.50+
Nov 6, 2017
9d8ff3b
Add tests for Node 8 now that it's LTS
Nov 6, 2017
669d461
Add back devDeps for RN and react to fix build
Nov 6, 2017
ad2ced5
Fix CI to not rely on devDeps react and react-native
Nov 6, 2017
9d48815
Drop support for Node 4
Nov 6, 2017
e70acd5
Node support
Jan 6, 2018
e4b98c6
Set base Node 8 test version to 8.9.1
Jan 6, 2018
5df69b0
Merge pull request #151 from jasonfma/rewrite
RealOrangeOne Jan 16, 2018
bef446a
Merge branch 'master' of github.com:RealOrangeOne/react-native-mock i…
Feb 6, 2018
a07a694
Enable nodir for glob.sync
mnt Mar 5, 2018
b5a45b8
Merge pull request #160 from mnt/rewrite
RealOrangeOne Mar 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["airbnb", "react-native"],
"presets": ["react-native"],
}
17 changes: 13 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"env": {
"mocha": true
},
"parser": "babel-eslint",
"rules": {
"no-unused-vars": [2, {"vars": "all", "args": "none"}],
"comma-dangle": 0,
"comma-dangle": ["error", "never"],
"func-names": 0,
"prefer-arrow-callback": 0,
"global-require": 0,
Expand All @@ -20,14 +19,24 @@
"guard-for-in": 0,
"no-restricted-syntax": 0,
"prefer-template": 0,
"no-console": 0,
"no-unused-expressions": 0,
"vars-on-top": 0,
"react/jsx-no-bind": 0,
"one-var": 0,
"one-var-declaration-per-line": 0,
"max-len": [
2,
120,
2,
{
"ignoreComments": true
}
]
],
"no-multiple-empty-lines": [2, {"max": 3}],
"import/no-extraneous-dependencies": 0,
"react/jsx-filename-extension": 0,
"import/no-dynamic-require": 0,
"no-multi-assign": 0,
"o-undef": 0,
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ node_modules
.node_repl_history

/build
haste-map.json
.nyc_output/
23 changes: 23 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"lines": 0,
"statements": 0,
"functions": 0,
"branches": 0,
"include": [
"src/**/*.js",
"mock.js"
],
"extension": [
".js"
],
"reporter": [
"lcov",
"text",
"text-summary"
],
"all": true,
"check-coverage": true,
"sourceMap": true,
"instrument": true,
"report-dir": "./coverage"
}
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
language: node_js
node_js:
- "4.0.0"
- "6.0.0"
- "4"
- "6"
- "8.9.1"
- "8"


# values taken from react-native's package.json
env:
- REACT_NATIVE_VERSION=0.50 REACT_VERSION=16.0.0

before_install:
- npm install react@~$REACT_VERSION react-dom@~$REACT_VERSION react-native@~$REACT_NATIVE_VERSION

before_script:
- npm run build-haste
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Jake Howard
Copyright (c) 2017 Jake Howard

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
40 changes: 17 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
# react-native-mock [![Build Status](https://travis-ci.org/RealOrangeOne/react-native-mock.svg?branch=master)](https://travis-ci.org/RealOrangeOne/react-native-mock)
# React-Native-Mock

[![Travis](https://img.shields.io/travis/RealOrangeOne/react-native-mock.svg?style=flat-square)](https://travis-ci.org/RealOrangeOne/react-native-mock)
[![CircleCI](https://img.shields.io/circleci/project/github/RealOrangeOne/react-native-mock.svg?style=flat-square)](https://circleci.com/gh/RealOrangeOne/react-native-mock)
[![npm](https://img.shields.io/npm/dm/react-native-mock.svg?style=flat-square)](https://www.npmjs.com/package/react-native-mock)
[![npm](https://img.shields.io/npm/v/react-native-mock.svg?style=flat-square)](https://www.npmjs.com/package/react-native-mock)
[![Gitter](https://img.shields.io/gitter/room/RealOrangeOne/react-native-mock.svg?style=flat-square)](https://gitter.im/RealOrangeOne/react-native-mock)
[![Codecov](https://img.shields.io/codecov/c/github/RealOrangeOne/react-native-mock.svg?style=flat-square)](https://codecov.io/gh/RealOrangeOne/react-native-mock)

[![Join the chat at https://gitter.im/RealOrangeOne/react-native-mock](https://badges.gitter.im/RealOrangeOne/react-native-mock.svg)](https://gitter.im/RealOrangeOne/react-native-mock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
A fully mocked and test-friendly version of react native

## Requirements
- Node.js 4+
- Node.js 6+ (dropping support for Node 4 as some dev dependencies don't support it)
- The latest version of react-native

__Note__: This library is designed to work with the most recent version of react-native. If you aren't using the most recent version, you will need to download an older version of this library, as the API is likely to be different, and the dependencies are likely to break.
__Note__: This library is designed to work with the most recent version of react-native. If you aren't using the most recent version, you will probably need to download an older version of this library, as the API is likely to be different, and the dependencies are likely to break.

## How Am I Supposed To Use This?

##### Install it

```bash
npm i react-native-mock --save-dev
npm install react-native-mock --save-dev
```

##### Add it to your test pipeline _(there's multiple ways)_
```js
/* file-that-runs-before-all-of-my-tests.js */

// This will mutate `react-native`'s require cache with `react-native-mock`'s.
require('react-native-mock/mock'); // <-- side-effects!!!
```

## Why?

Testing React Native components is *hard*. I'm hoping this makes it easier.

I wrote a React Testing Library that works really well for React "Web", but didn't really work for React "Native" without something like this.


## Wait... Is this actually a terrible idea?

I don't know. Maybe.

I'd love to figure that out though... feel free to file an issue if you have opinions.

```bash
mocha --require react-native-mock/mock ...
```

## Contributing
Discovered a bug, got a new feature, or found something that needs improving? __Submit a PR!__
Expand All @@ -44,6 +41,3 @@ Make sure to read through the CONTRIBUTING.md file before submitting your PR!
### Core Contributors
- [Jake Howard](https://github.com/RealOrangeOne)
- [Leland Richardson](https://github.com/lelandrichardson) (Original Creator)

## What do the labels mean?
See [this wiki page](https://github.com/RealOrangeOne/react-native-mock/wiki/Labels---What-do-they-mean%3F).
9 changes: 9 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
machine:
node:
version: 6

test:
post:
- bash ./scripts/run_jest.sh
- bash <(curl -s https://codecov.io/bash)

11 changes: 11 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage:
precision: 2
round: down
range: "70...100"

status:
project: false
patch: false
changes: false

comment: off
15 changes: 4 additions & 11 deletions mock.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
const ReactNativeMock = require('./build/react-native');
/*
Shortcut file to allow use via `react-native-mock/mock`
*/

// the cache key that real react native would get
const key = require.resolve('react-native');

// make sure the cache is filled with our lib
require.cache[key] = {
id: key,
filename: key,
loaded: true,
exports: ReactNativeMock,
};
module.exports = require('./build/react-native-mock.js');
81 changes: 43 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{
"name": "react-native-mock",
"version": "0.3.1",
"version": "1.0.0",
"description": "A fully mocked and test-friendly version of react native",
"main": "build/react-native.js",
"main": "build/no-import.js",
"scripts": {
"prepublish": "npm run build",
"test": "npm run lint && npm run mocha",
"mocha": "mocha --require babel-core/register 'test/**/*.js'",
"mocha:watch": "npm run test -- --watch",
"build": "rm -rf build/ && babel src --out-dir build",
"lint": "eslint 'src/' 'test/' 'mock.js'"
"postinstall": "npm run build-haste",
"test": "npm run lint && npm run coverage",
"mocha": "mocha --require scripts/test-helper.js mock.js --bail --timeout 60000 'tests/**/*.test.js'",
"lint": "eslint 'src/' 'tests/' 'scripts/' 'mock.js'",
"coverage": "nyc npm run mocha",
"build": "babel src --out-dir build",
"build-haste": "node src/haste.js"
},
"jest": {
"preset": "react-native"
},
"repository": {
"type": "git",
Expand All @@ -27,39 +32,39 @@
"url": "https://github.com/RealOrangeOne/react-native-mock/issues"
},
"homepage": "https://github.com/RealOrangeOne/react-native-mock#readme",
"devDependencies": {
"babel-cli": "6.9.0",
"babel-core": "6.9.0",
"babel-eslint": "6.0.4",
"babel-preset-airbnb": "2.0.0",
"babel-preset-react-native": "1.8.0",
"chai": "3.5.0",
"eslint": "2.10.2",
"eslint-config-airbnb": "9.0.1",
"eslint-plugin-import": "1.8.0",
"eslint-plugin-jsx-a11y": "1.2.2",
"eslint-plugin-react": "5.1.1",
"eslint-plugin-react-native": "1.0.2",
"mocha": "2.5.3",
"react": "^15.4.0",
"react-native": "^0.38.0"
},
"dependencies": {
"cubic-bezier": "^0.1.2",
"invariant": "^2.2.1",
"keymirror": "^0.1.1",
"raf": "^3.2.0",
"react-addons-create-fragment": "^15.4.0",
"react-addons-perf": "^15.4.0",
"react-addons-pure-render-mixin": "^15.4.0",
"react-addons-test-utils": "^15.4.0",
"react-addons-update": "^15.4.0",
"react-dom": "^15.4.0",
"react-timer-mixin": "^0.13.3",
"warning": "^2.1.0"
"glob": "7.1.2",
"mockery": "2.1.0",
"perfy": "1.1.2",
"promise": "8.0.1",
"regenerator-runtime": "0.11.0",
"sinon": "4.1.1",
"underscore": "1.8.3"
},
"devDependencies": {
"babel-cli": "6.26.0",
"chai": "4.1.2",
"chai-as-promised": "7.1.1",
"enzyme": "3.1.1",
"enzyme-adapter-react-16": "1.0.4",
"eslint": "4.10.0",
"eslint-config-airbnb": "16.1.0",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "6.0.2",
"eslint-plugin-react": "7.4.0",
"eslint-plugin-react-native": "3.1.0",
"jsdom": "11.3.0",
"mocha": "4.0.1",
"mocha-assume": "1.0.0",
"nyc": "11.3.0",
"semver": "5.4.1",
"sinon-chai": "2.14.0"
},
"peerDependencies": {
"react": "*",
"react-native": "*"
"babel-core": "*",
"babel-preset-react-native": "*",
"react": ">=16.0.0",
"react-dom": ">=16.0.0",
"react-native": ">=0.50.0"
}
}
9 changes: 9 additions & 0 deletions scripts/run_jest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

# run Jest tests to check against speed and API coverage

npm install [email protected] [email protected]

node_modules/.bin/jest tests/integration/**/*.test.js --runInBand --verbose

exit 0
33 changes: 33 additions & 0 deletions scripts/test-helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const chai = require('chai');
const sinonChai = require('sinon-chai');
const chaiAsPromised = require('chai-as-promised');
const jsdom = require('jsdom');
const Enzyme = require('enzyme');
const React16Adapter = require('enzyme-adapter-react-16');

Enzyme.configure({ adapter: new React16Adapter() });

chai.expect();
chai.use(sinonChai);
chai.use(chaiAsPromised);

// Jsdom document & window
const { JSDOM } = jsdom;
const dom = new JSDOM('<!doctype html><html><body></body></html>');
const win = dom.window;

// Add to global
global.document = win.document;
global.window = win;

// Add window keys to global window
Object.keys(window).forEach((key) => { // eslint-disable-line no-undef
if (!(key in global)) {
global[key] = window[key]; // eslint-disable-line no-undef
}
});

if (!global.navigator.userAgent || !global.window.navigator.userAgent) {
// react-dom needs a useragent
global.navigator.userAgent = global.window.navigator.userAgent = 'node.js';
}
45 changes: 0 additions & 45 deletions src/Libraries/EventEmitter/EmitterSubscription.js

This file was deleted.

Loading