Skip to content

Commit

Permalink
[enzyme-adapter-react-16.3] fork the react 16 adapter for ~16.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 7, 2018
1 parent 41d833e commit 6517ea4
Show file tree
Hide file tree
Showing 16 changed files with 569 additions and 18 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ React:

| Enzyme Adapter Package | React semver compatibility |
| --- | --- |
| `enzyme-adapter-react-16` | `^16.3.0-0` |
| `enzyme-adapter-react-16` | `^16.4.0-0` |
| `enzyme-adapter-react-16.3` | `~16.3.0-0` |
| `enzyme-adapter-react-16.2` | `~16.2` |
| `enzyme-adapter-react-16.1` | `~16.0.0-0 || ~16.1` |
| `enzyme-adapter-react-15` | `^15.5.0` |
Expand Down
3 changes: 2 additions & 1 deletion docs/guides/migration-from-2-to-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ The list of adapter npm packages for React semver ranges are as follows:

| enzyme Adapter Package | React semver compatibility |
| --- | --- |
| `enzyme-adapter-react-16` | `^16.3.0-0` |
| `enzyme-adapter-react-16` | `^16.4.0-0` |
| `enzyme-adapter-react-16.3` | `~16.3.0-0` |
| `enzyme-adapter-react-16.2` | `~16.2` |
| `enzyme-adapter-react-16.1` | `~16.0.0-0 || ~16.1` |
| `enzyme-adapter-react-15` | `^15.5.0` |
Expand Down
4 changes: 4 additions & 0 deletions install-relevant-react.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ if [ "$REACT" = "15" ]; then
npm run react:15
fi

if [ "$REACT" = "16.3" ]; then
npm run react:16.3
fi

if [ "$REACT" = "16.2" ]; then
npm run react:16.2
fi
Expand Down
5 changes: 4 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function getPlugins() {
const adapter15 = new IgnorePlugin(/enzyme-adapter-react-15$/);
const adapter161 = new IgnorePlugin(/enzyme-adapter-react-16.1$/);
const adapter162 = new IgnorePlugin(/enzyme-adapter-react-16.2$/);
const adapter163 = new IgnorePlugin(/enzyme-adapter-react-16.3$/);
const adapter16 = new IgnorePlugin(/enzyme-adapter-react-16$/);

var plugins = [
Expand Down Expand Up @@ -41,7 +42,9 @@ function getPlugins() {
plugins = plugins.filter(not(adapter161));
} else if (is('~16.2')) {
plugins = plugins.filter(not(adapter162));
} else if (is('^16.3.0-0')) {
} else if (is('~16.3.0-0')) {
plugins = plugins.filter(not(adapter163));
} else if (is('^16.4.0-0')) {
plugins = plugins.filter(not(adapter16));
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
"pretest:karma": "npm run build",
"test:karma": "karma start",
"test:env": "sh ./example-test.sh",
"test:all": "npm run react:13 && npm run test:only && npm run react:14 && npm run test:only && npm run react:15.4 && npm run test:only && npm run react:15 && npm run test:only && npm run react:16.1 && npm run test:only && npm run react:16.1 && npm run test:only && npm run react:16 && npm run test:only",
"test:all": "npm run react:13 && npm run test:only && npm run react:14 && npm run test:only && npm run react:15.4 && npm run test:only && npm run react:15 && npm run test:only && npm run react:16.1 && npm run test:only && npm run react:16.2 && npm run test:only && npm run react:16.3 && npm run test:only && npm run react:16 && npm run test:only",
"react:13": "npm run env -- 13",
"react:14": "npm run env -- 14",
"react:15.4": "npm run env -- 15.4",
"react:15": "npm run env -- 15",
"react:16.1": "npm run env -- 16.1",
"react:16.2": "npm run env -- 16.2",
"react:16.3": "npm run env -- 16.3",
"react:16": "npm run env -- 16",
"env": "babel-node ./env.js",
"docs:clean": "rimraf _book",
Expand Down
6 changes: 6 additions & 0 deletions packages/enzyme-adapter-react-16.3/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": ["airbnb"],
"plugins": [
["transform-replace-object-assign", { "moduleSpecifier": "object.assign" }],
],
}
4 changes: 4 additions & 0 deletions packages/enzyme-adapter-react-16.3/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_book/
build/
node_modules/
**/node_modules/
12 changes: 12 additions & 0 deletions packages/enzyme-adapter-react-16.3/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"rules": {
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": 0,
"import/extensions": 0,
"react/no-deprecated": 0,
"react/no-find-dom-node": 0,
"react/no-multi-comp": 0,
"no-underscore-dangle": 0,
"class-methods-use-this": 0
}
}
36 changes: 36 additions & 0 deletions packages/enzyme-adapter-react-16.3/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# babel configuration
.babelrc

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Jetbrains IDEs
.idea

#/build # commented out intentionally, since this is the meat of the package.
_book
1 change: 1 addition & 0 deletions packages/enzyme-adapter-react-16.3/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
65 changes: 65 additions & 0 deletions packages/enzyme-adapter-react-16.3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "enzyme-adapter-react-16.3",
"version": "1.0.0",
"description": "JavaScript Testing utilities for React",
"homepage": "http://airbnb.io/enzyme/",
"main": "build",
"scripts": {
"clean": "rimraf build",
"lint": "eslint --ext js,jsx .",
"pretest": "npm run lint",
"prebuild": "npm run clean",
"build": "babel src --out-dir build",
"watch": "npm run build -- -w",
"prepublish": "npm run build && safe-publish-latest && (not-in-publish || cp ../../{LICENSE,README}.md ./)"
},
"repository": {
"type": "git",
"url": "https://github.com/airbnb/enzyme.git"
},
"keywords": [
"javascript",
"shallow rendering",
"shallowRender",
"test",
"reactjs",
"react",
"flux",
"testing",
"test utils",
"assertion helpers",
"tdd",
"mocha"
],
"author": "Leland Richardson <leland.richardson@airbnb.com>",
"license": "MIT",
"dependencies": {
"enzyme-adapter-utils": "^1.5.0",
"function.prototype.name": "^1.1.0",
"object.assign": "^4.1.0",
"object.values": "^1.0.4",
"prop-types": "^15.6.2",
"react-is": "^16.4.1",
"react-reconciler": "^0.7.0",
"react-test-renderer": "~16.3.0-0"
},
"peerDependencies": {
"enzyme": "^3.0.0",
"react": "~16.3.0-0",
"react-dom": "~16.3.0-0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-transform-replace-object-assign": "^1.0.0",
"babel-preset-airbnb": "^2.5.3",
"enzyme": "^3.0.0",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^17.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.10.0",
"in-publish": "^2.0.0",
"rimraf": "^2.6.2",
"safe-publish-latest": "^1.1.2"
}
}

0 comments on commit 6517ea4

Please sign in to comment.