Skip to content

Commit

Permalink
Merge pull request #154 from wordpress-mobile/fix/broken-jest-platfor…
Browse files Browse the repository at this point in the history
…m-resolution

Fix broken jest platform resolution
  • Loading branch information
hypest authored Sep 24, 2018
2 parents 1fd26e0 + bbb9fe5 commit 6a8d736
Show file tree
Hide file tree
Showing 54 changed files with 78 additions and 172 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; ignore the submodules
gutenberg
symlinked-packages-in-parent
react-native-aztec

6 changes: 2 additions & 4 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ libdefs.js
emoji=true

module.system=haste
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=symlinked-packages

module.file_ext=.js
module.file_ext=.jsx
Expand All @@ -84,10 +86,6 @@ module.file_ext=.scss
munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.name_mapper='@wordpress/block-library' -> '<PROJECT_ROOT>/gutenberg/packages/block-library/src'
module.name_mapper='@wordpress/blocks' -> '<PROJECT_ROOT>/gutenberg/packages/blocks/src'
module.name_mapper='@wordpress/element' -> '<PROJECT_ROOT>/gutenberg/packages/element/src'
module.name_mapper='@wordpress/components' -> '<PROJECT_ROOT>/gutenberg/packages/components/src'

; mock/ignore style files
module.name_mapper='.*\(.scss\)' -> 'empty/object'
Expand Down
8 changes: 7 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ android {

defaultConfig {
applicationId "com.gutenberg"
minSdkVersion 16
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
Expand Down Expand Up @@ -157,6 +157,12 @@ repositories {
maven { url "https://jitpack.io" }
}

configurations.all {
resolutionStrategy {
force 'org.webkit:android-jsc:r224109'
}
}

dependencies {
implementation project(':react-native-svg')
implementation project(':react-native-aztec')
Expand Down
4 changes: 4 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Local Maven repo containing AARs with JSC library built for Android
url "$rootDir/../node_modules/jsc-android/dist"
}
}
}
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 46 files
+4 −0 docs/reference/deprecated.md
+1 −1 docs/reference/faq.md
+19 −1 edit-post/components/header/style.scss
+1 −1 edit-post/components/keyboard-shortcut-help-modal/config.js
+2 −2 edit-post/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap
+1 −1 gutenberg.php
+1 −0 lib/client-assets.php
+2 −1 package-lock.json
+1 −1 package.json
+1 −0 packages/autop/package.json
+1 −0 packages/blob/package.json
+5 −0 packages/block-library/src/block/edit-panel/style.scss
+12 −0 packages/blocks/src/api/raw-handling/head-remover.js
+2 −0 packages/blocks/src/api/raw-handling/index.js
+45 −0 packages/core-data/src/controls.js
+8 −15 packages/core-data/src/entities.js
+12 −3 packages/core-data/src/index.js
+13 −16 packages/core-data/src/resolvers.js
+25 −36 packages/core-data/src/test/entities.js
+32 −84 packages/core-data/src/test/resolvers.js
+10 −0 packages/data/CHANGELOG.md
+1 −0 packages/data/package.json
+10 −0 packages/data/src/plugins/async-generator/middleware.js
+2 −0 packages/data/src/test/registry.js
+1 −0 packages/deprecated/package.json
+1 −1 packages/editor/CHANGELOG.md
+24 −38 packages/editor/src/components/block-mover/style.scss
+2 −2 packages/editor/src/components/editor-global-keyboard-shortcuts/index.js
+7 −1 packages/editor/src/components/post-permalink/style.scss
+1 −7 packages/editor/src/components/rich-text/index.js
+1 −1 packages/editor/src/store/effects/test/utils.js
+1 −0 packages/hooks/package.json
+1 −0 packages/i18n/package.json
+6 −0 packages/jest-console/CHANGELOG.md
+18 −3 packages/jest-console/src/index.js
+12 −0 packages/jest-console/src/test/index.test.js
+1 −1 packages/redux-routine/src/runtime.js
+5 −3 post-content.php
+2 −2 test/e2e/specs/block-deletion.test.js
+58 −0 test/e2e/specs/demo.test.js
+6 −1 test/integration/blocks-raw-handling.spec.js
+3 −0 test/integration/fixtures/gutenberg-in.html
+3 −0 test/integration/fixtures/gutenberg-out.html
+27 −0 test/integration/fixtures/ms-word-styled-in.html
+15 −0 test/integration/fixtures/ms-word-styled-out.html
+1 −1 test/unit/__mocks__/@wordpress/data.js
21 changes: 2 additions & 19 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,13 @@ module.exports = {
testEnvironment: 'jsdom',
testPathIgnorePatterns: [
'/node_modules/',
'/gutenberg/gutenberg-mobile/',
'<rootDir>/gutenberg/gutenberg-mobile/',
'/gutenberg/test/',
'/gutenberg/packages/',
],
moduleFileExtensions: [
'native.js',
'android.js',
'ios.js',
'js',
'native.json',
'android.json',
'ios.json',
'json',
'native.jsx',
'android.jsx',
'ios.jsx',
'jsx',
'node',
],
modulePathIgnorePatterns: [ '<rootDir>/gutenberg/gutenberg-mobile' ],
moduleDirectories: [ 'node_modules', 'symlinked-packages' ],
moduleNameMapper: {
'@wordpress\\/(block-serialization-default-parser|blocks|data|element|deprecated|editor|block-library|components|keycodes|url|a11y|viewport|core-data|api-fetch|nux)$':
'<rootDir>/gutenberg/packages/$1/src/index',

// Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
'\\.(scss)$': '<rootDir>/__mocks__/styleMock.js',
},
Expand Down
8 changes: 1 addition & 7 deletions jest_gb.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@ const main = require( './jest.config.js' );

module.exports = {
...main,
moduleNameMapper: {
'@wordpress\\/(blocks|data|element|deprecated|editor|block-library|components|keycodes|url|a11y|viewport|core-data|api-fetch|nux|block-serialization-default-parser)$':
'<rootDir>/../packages/$1/build/index',

// Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
'\\.(scss)$': '<rootDir>/__mocks__/styleMock.js',
},
moduleDirectories: [ 'node_modules', 'symlinked-packages-in-parent' ],
};
11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"react-native-sass-transformer": "^1.1.1",
"react-test-renderer": "16.3.1",
"remote-redux-devtools": "^0.5.12",
"rungen": "^0.3.2",
"sprintf-js": "^1.1.1"
},
"scripts": {
Expand Down Expand Up @@ -71,22 +72,14 @@
"lint:fix": "yarn lint --fix"
},
"dependencies": {
"@wordpress/autop": "^1.0.6",
"@wordpress/blob": "^2.0.0",
"@wordpress/compose": "^1.0.1",
"@wordpress/deprecated": "^1.0.0-alpha.2",
"@wordpress/element": "^1.0.2",
"@wordpress/hooks": "^1.2.1",
"@wordpress/i18n": "^1.1.0",
"@wordpress/is-shallow-equal": "^1.0.1",
"@wordpress/redux-routine": "^2.0.0",
"babel-preset-es2015": "^6.24.1",
"classnames": "^2.2.5",
"dom-react": "^2.2.1",
"domutils": "^1.7.0",
"hpq": "^1.2.0",
"jed": "^1.1.1",
"js-beautify": "^1.7.5",
"jsc-android": "224109.x.x",
"jsdom-jscore": "git+https://github.com/iamcco/jsdom-jscore-rn.git#6eac88dd5d5e7c21ce6382abde7dbc376d7f7f59",
"jsx-to-string": "^1.3.1",
"memize": "^1.0.5",
Expand Down
11 changes: 4 additions & 7 deletions rn-cli.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/** @format */
const blacklist = require( 'metro' ).createBlacklist;
const path = require( 'path' );
const enm = require( './extra-node-modules.config.js' );

module.exports = {
extraNodeModules: enm,
getBlacklistRE: function() {
// Blacklist the GB packages we want to consume from NPM (online) directly.
// On the other hand, GB packages that are loaded from the source tree directly
// are automagically resolved by Metro so, there is no list of them anywhere.
return blacklist( [
/gutenberg\/packages\/(autop|compose|deprecated|hooks|i18n|is-shallow-equal|blob|redux-routine)\/.*/,
/gutenberg\/gutenberg-mobile\/.*/,
] );
// There's a nested checkout of the mobile code inside the Gutenberg repo
// as a submodule. Blacklist it to avoid errors due to duplicate modules.
return blacklist( [ new RegExp( path.basename( __dirname ) + '/gutenberg/gutenberg-mobile/.*/' ) ] );
},
getTransformModulePath() {
return require.resolve( './sass-transformer.js' );
Expand Down
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/a11y
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/api-fetch
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/autop
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/blob
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/block-library
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/blocks
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/components
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/compose
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/core-data
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/data
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/deprecated
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/editor
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/element
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/hooks
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/i18n
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/is-shallow-equal
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/keycodes
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/nux
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/redux-routine
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/url
1 change: 1 addition & 0 deletions symlinked-packages-in-parent/@wordpress/viewport
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/a11y
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/api-fetch
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/autop
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/blob
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/block-library
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/blocks
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/components
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/compose
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/core-data
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/data
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/deprecated
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/editor
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/element
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/hooks
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/i18n
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/is-shallow-equal
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/keycodes
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/nux
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/redux-routine
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/url
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/viewport
Loading

0 comments on commit 6a8d736

Please sign in to comment.