From bf63e8b2cb656ecea34e99be79cda274f44f2284 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Wed, 28 Mar 2018 13:56:27 +0300 Subject: [PATCH 1/9] Update from current GB master --- gutenberg | 2 +- package.json | 1 + yarn.lock | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 8ee1a4e237..3e81e6bbf4 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 8ee1a4e2370e5a0b734b68615b0b7d54fc5f6a99 +Subproject commit 3e81e6bbf480427aed92d74190cda7f04bc0ba5d diff --git a/package.json b/package.json index c42e60c518..180a8cb9dc 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "classnames": "^2.2.5", "expo": "^25.0.0", "jed": "^1.1.1", + "memize": "^1.0.5", "react": "16.2.0", "react-native": "0.52.0", "react-redux": "^5.0.7", diff --git a/yarn.lock b/yarn.lock index f0c2b64bbe..60944fc14f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4604,6 +4604,10 @@ mem@1.1.0, mem@^1.1.0: dependencies: mimic-fn "^1.0.0" +memize@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/memize/-/memize-1.0.5.tgz#51d89e8407643dbc8cab98c6d56b889f9a3954e3" + merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" From b98235832718594fa7a51e7656ecfb2112b9c37d Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Wed, 28 Mar 2018 16:01:41 +0300 Subject: [PATCH 2/9] Add a handy script command to debug jest tests --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 180a8cb9dc..84f04601db 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "android": "react-native-scripts android", "ios": "react-native-scripts ios", "test": "cross-env NODE_ENV=test node node_modules/jest/bin/jest.js --verbose --config jest.config.js", + "test-debug": "cross-env NODE_ENV=test node --inspect-brk node_modules/jest/bin/jest.js --runInBand --verbose --config jest.config.js", "flow": "flow", "prettier": "prettier --write *.js *block-management/*.js", "prettier-check": "prettier -l *.js *block-management/*.js" From 5694235244bfa9bc4f5cf679b8a4b83b7bb322eb Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Wed, 28 Mar 2018 16:38:56 +0300 Subject: [PATCH 3/9] Use GB code updated from master --- gutenberg | 2 +- package.json | 1 + yarn.lock | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 3e81e6bbf4..0f3b9ea62f 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 3e81e6bbf480427aed92d74190cda7f04bc0ba5d +Subproject commit 0f3b9ea62f9236517a90763263d3b7e45c47ce17 diff --git a/package.json b/package.json index 84f04601db..197bd4a6fa 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "devDependencies": { "@wordpress/babel-preset-default": "^1.1.2", + "babel-plugin-transform-async-generator-functions": "^6.24.1", "cross-env": "^5.1.4", "flow-bin": "0.56.0", "jest-expo": "25.0.0", diff --git a/yarn.lock b/yarn.lock index 60944fc14f..2d026e9272 100644 --- a/yarn.lock +++ b/yarn.lock @@ -702,6 +702,10 @@ babel-plugin-syntax-async-functions@^6.5.0, babel-plugin-syntax-async-functions@ version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" +babel-plugin-syntax-async-generators@^6.5.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz#6bc963ebb16eccbae6b92b596eb7f35c342a8b9a" + babel-plugin-syntax-class-properties@^6.5.0, babel-plugin-syntax-class-properties@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz#d7eb23b79a317f8543962c505b827c7d6cac27de" @@ -738,6 +742,14 @@ babel-plugin-syntax-trailing-function-commas@^6.20.0, babel-plugin-syntax-traili version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" +babel-plugin-transform-async-generator-functions@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz#f058900145fd3e9907a6ddf28da59f215258a5db" + dependencies: + babel-helper-remap-async-to-generator "^6.24.1" + babel-plugin-syntax-async-generators "^6.5.0" + babel-runtime "^6.22.0" + babel-plugin-transform-async-to-generator@6.16.0: version "6.16.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.16.0.tgz#19ec36cb1486b59f9f468adfa42ce13908ca2999" From f283fa304e08b0a27f174bf0ee4e85872b07b42d Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Wed, 28 Mar 2018 16:40:01 +0300 Subject: [PATCH 4/9] Remove unused Jest config section --- package.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/package.json b/package.json index 197bd4a6fa..44f04fc01a 100644 --- a/package.json +++ b/package.json @@ -25,14 +25,6 @@ "prettier": "prettier --write *.js *block-management/*.js", "prettier-check": "prettier -l *.js *block-management/*.js" }, - "jest": { - "preset": "jest-expo", - "moduleNameMapper": { - "@wordpress/hooks": "/wordpress/hooks", - "@wordpress/i18n": "/gutenberg/i18n", - "@gutenberg": "/gutenberg" - } - }, "dependencies": { "babel-plugin-module-resolver": "^3.1.0", "classnames": "^2.2.5", From c54f1d9d1263a9515ed8b582764f6104db9fc14b Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Thu, 29 Mar 2018 17:14:22 +0300 Subject: [PATCH 5/9] Define `wp` and reuse `component.createElement()` --- App.test.js | 2 ++ globals.js | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 globals.js diff --git a/App.test.js b/App.test.js index 05730ee91f..1e0b29528a 100644 --- a/App.test.js +++ b/App.test.js @@ -1,5 +1,7 @@ /** @format */ +import './globals'; + import React from 'react'; import renderer from 'react-test-renderer'; diff --git a/globals.js b/globals.js new file mode 100644 index 0000000000..bd85daff96 --- /dev/null +++ b/globals.js @@ -0,0 +1,7 @@ +/** @format */ + +import * as element from '@gutenberg/element'; + +global.wp = { + element, // load the element creation function, needed by Gutenberg-web +}; From 2be70b14b61159c6be41da5146e468e16207499a Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Thu, 29 Mar 2018 04:05:01 +0300 Subject: [PATCH 6/9] Ignore mobile native files in GB's eslint --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 0f3b9ea62f..a3d5ab4af3 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 0f3b9ea62f9236517a90763263d3b7e45c47ce17 +Subproject commit a3d5ab4af34941e5afb12eba3b620dce565a78e6 From 5700e20c578c706c20d2b332e62b61dcc646746d Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Thu, 29 Mar 2018 04:30:33 +0300 Subject: [PATCH 7/9] Add react-dom as a dev dep to fix Jest on Travis --- package.json | 1 + yarn.lock | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/package.json b/package.json index 44f04fc01a..79433cfe52 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "flow-bin": "0.56.0", "jest-expo": "25.0.0", "prettier": "git+https://github.com/Automattic/calypso-prettier.git#calypso-1.9", + "react-dom": "^16.2.0", "react-native-scripts": "1.11.1", "react-test-renderer": "16.2.0", "remote-redux-devtools": "^0.5.12" diff --git a/yarn.lock b/yarn.lock index 2d026e9272..4f797ef90d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5745,6 +5745,15 @@ react-devtools-core@3.0.0: shell-quote "^1.6.1" ws "^2.0.3" +react-dom@^16.2.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.2.0.tgz#69003178601c0ca19b709b33a83369fe6124c044" + dependencies: + fbjs "^0.8.16" + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.0" + react-native-branch@2.0.0-beta.3: version "2.0.0-beta.3" resolved "https://registry.yarnpkg.com/react-native-branch/-/react-native-branch-2.0.0-beta.3.tgz#2167af86bbc9f964bd45bd5f37684e5b54965e32" From 0a206e81a12f0ce88345b9c0467c578742c672dd Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Thu, 29 Mar 2018 17:23:58 +0300 Subject: [PATCH 8/9] Ignore tests in the gutenberg subdir --- jest.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jest.config.js b/jest.config.js index 305cf5b404..11288833fb 100644 --- a/jest.config.js +++ b/jest.config.js @@ -10,6 +10,10 @@ if ( process.env.TEST_RN_PLATFORM ) { module.exports = { preset: 'jest-expo', + testPathIgnorePatterns: [ + "/node_modules/", + "/gutenberg/" + ], moduleNameMapper: { '@wordpress/hooks': '/wordpress/hooks', '@wordpress/i18n': '/gutenberg/i18n', From 89bedf6d2ea885de5f295e7f16a18dad847d1450 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Thu, 29 Mar 2018 17:37:45 +0300 Subject: [PATCH 9/9] Make prettier happy --- jest.config.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/jest.config.js b/jest.config.js index 3166cd6f0e..0d0a8b9570 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,10 +11,7 @@ if ( process.env.TEST_RN_PLATFORM ) { module.exports = { preset: 'jest-react-native', testEnvironment: 'jsdom', - testPathIgnorePatterns: [ - "/node_modules/", - "/gutenberg/" - ], + testPathIgnorePatterns: [ '/node_modules/', '/gutenberg/' ], moduleNameMapper: { '@wordpress/hooks': '/wordpress/hooks', '@wordpress/i18n': '/gutenberg/i18n',