From 29f209a767937e3497f12296ecab0f2de09f592f Mon Sep 17 00:00:00 2001 From: Stefanos Togoulidis Date: Wed, 31 Oct 2018 21:04:53 +0200 Subject: [PATCH] Revert mobile RN testsuite integration (#11318) * Revert "Have Travis run mobile tests that use the parent code (#10034)" This reverts commit b1d9fb74dae09464cb7bf5903fd15f2d3021d023. * Revert "Integrate the mobile React Native testsuite with the main Gutenberg build (#9883)" This reverts commit cb908cff647b7adc3d251a0e1b2defdd71cc2f43. --- .eslintignore | 1 - .gitmodules | 3 --- .stylelintignore | 1 - .travis.yml | 41 ------------------------------ docs/reference/testing-overview.md | 25 ------------------ gutenberg-mobile | 1 - package-lock.json | 6 ----- package.json | 11 +++----- test/e2e/jest.config.json | 9 +------ test/unit/jest.config.json | 6 +---- 10 files changed, 5 insertions(+), 99 deletions(-) delete mode 100644 .gitmodules delete mode 100644 .stylelintignore delete mode 160000 gutenberg-mobile diff --git a/.eslintignore b/.eslintignore index 771c6bce35da5..35fff82ce771c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,4 +5,3 @@ node_modules test/e2e/test-plugins vendor packages/block-serialization-spec-parser/index.js -gutenberg-mobile diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index c70c9c4d7133e..0000000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "gutenberg-mobile"] - path = gutenberg-mobile - url = ../../wordpress-mobile/gutenberg-mobile diff --git a/.stylelintignore b/.stylelintignore deleted file mode 100644 index e6c31cdc0d8e3..0000000000000 --- a/.stylelintignore +++ /dev/null @@ -1 +0,0 @@ -gutenberg-mobile diff --git a/.travis.yml b/.travis.yml index 817b6cb71081c..51ae7a8eaa9e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,44 +69,3 @@ jobs: script: - npm install || exit 1 - ./bin/run-e2e-tests.sh || exit 1 - - stage: test - language: node_js - node_js: 8 - env: - LANE='node' - GUTENBERG_AS_PARENT=true - CHECK_CORRECTNESS='true' - cache: - yarn: true - script: - - cd ./gutenberg-mobile - - yarn install - - ./.travis/travis-checks-js.sh - - stage: test - language: node_js - node_js: 8 - env: - LANE='node' - GUTENBERG_AS_PARENT=true - CHECK_TESTS='true' - TEST_RN_PLATFORM='android' - cache: - yarn: true - script: - - cd ./gutenberg-mobile - - yarn install - - ./.travis/travis-checks-js.sh - - stage: test - language: node_js - node_js: 8 - env: - LANE='node' - GUTENBERG_AS_PARENT=true - CHECK_TESTS='true' - TEST_RN_PLATFORM='ios' - cache: - yarn: true - script: - - cd ./gutenberg-mobile - - yarn install - - ./.travis/travis-checks-js.sh diff --git a/docs/reference/testing-overview.md b/docs/reference/testing-overview.md index f3c3b73133859..fcfc951cfd90f 100644 --- a/docs/reference/testing-overview.md +++ b/docs/reference/testing-overview.md @@ -379,30 +379,5 @@ Code style in PHP is enforced using [PHP_CodeSniffer](https://github.com/squizla To run unit tests only, without the linter, use `npm run test-unit-php` instead. -## Native Mobile Testing - -To enable automated testing against the native mobile app currently in development, the whole of the mobile source code is pulled in as a git submodule. Its testsuite is included in the Travis tests run but it can also be used locally, during development. - -To test locally, along with the typical Gutenberg setup and testing instructions already mentioned earlier, make sure you check out the code of the submodule: -``` -git submodule --init --recursive -``` -You can then use the available script to launch the mobile testsuite in isolation: -``` -npm run test-mobile -``` - -or the typical `npm run test` to run all the lint, unit and mobile tests in one go. - -The mobile tests pick up the compiled Gutenberg code/packages and so, don't forget to run `npm install` (while at the Gutenberg root) after you've made changes to the code. - -### Debugging native mobile - -Say you have made some changes to Gutenberg's code and turns out the mobile tests get broken. What's the path forward? Hopefully, the Jest tests output will have an error message and stacktrace that is indicative enough and helps point where the error happens and what went wrong. Oftenly, what happens is that the code being shared between the web and the mobile project is no longer compatible. - -For example, changing an intermediate interface can inadvertently bring the `file.js` and `file.native.js` pair out of sync. You'll then need to update the `.native.js` file to adhere to the new interface or iterate on the interface itself. Feel free to reach out to mobile devs for help if needed. - -In other usual cases, you might directly employ HTML elements in a `render()` function but those are not actually offered by React Native, the UI framework the native mobile is build on. Those elements are usually starting with a lower-case character like `div` or `span`. In any case that code is incompatible or doesn't make sense for mobile, what needs to be done is to wrap that code in a new component and provide a "nativized" variant of it to be loaded when on native mobile instead. To "nativize" a component just create a new `.native.js` file right alongside the web version one and in it return/run the code that is compatible with mobile. The proper variant will be picked up by the toolchain automatically. - [snapshot testing]: https://facebook.github.io/jest/docs/en/snapshot-testing.html [update snapshots]: https://facebook.github.io/jest/docs/en/snapshot-testing.html#updating-snapshots diff --git a/gutenberg-mobile b/gutenberg-mobile deleted file mode 160000 index 776bb23f7f19e..0000000000000 --- a/gutenberg-mobile +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 776bb23f7f19ef57b491f9708e9795b3a2ddb68e diff --git a/package-lock.json b/package-lock.json index e34e319d22a7f..0cb741133ff3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21940,12 +21940,6 @@ "camelcase": "^4.1.0" } }, - "yarn": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/yarn/-/yarn-1.9.4.tgz", - "integrity": "sha1-O4LYRGtlJ3VyOQC0cNlmhhl2kks=", - "dev": true - }, "yauzl": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", diff --git a/package.json b/package.json index 5ecc9d58868ec..9d9d485054b7d 100644 --- a/package.json +++ b/package.json @@ -112,8 +112,7 @@ "webpack-bundle-analyzer": "3.0.2", "webpack-cli": "2.1.3", "webpack-livereload-plugin": "2.1.1", - "webpack-rtl-plugin": "github:yoavf/webpack-rtl-plugin#develop", - "yarn": "1.9.4" + "webpack-rtl-plugin": "github:yoavf/webpack-rtl-plugin#develop" }, "npmPackageJsonLintConfig": { "extends": "@wordpress/npm-package-json-lint-config", @@ -169,20 +168,16 @@ "lint-css": "stylelint '**/*.scss'", "lint-css:fix": "stylelint '**/*.scss' --fix", "package-plugin": "./bin/build-plugin-zip.sh", - "mobile-submodule-update": "git submodule update --init --recursive", - "mobile-install": "yarn --cwd gutenberg-mobile install", - "preinstall": "npm run mobile-submodule-update", - "postinstall": " npm run mobile-install && npm run check-licenses && npm run build:packages", + "postinstall": "npm run check-licenses && npm run build:packages", "pot-to-php": "./bin/pot-to-php.js", "precommit": "lint-staged", "publish:check": "npm run build:packages && lerna updated", "publish:dev": "npm run build:packages && lerna publish --npm-tag next", "publish:prod": "npm run build:packages && lerna publish", - "test": "concurrently \"npm run lint && npm run test-unit\" \"npm run test-mobile\"", + "test": "npm run lint && npm run test-unit", "pretest-e2e": "concurrently \"./bin/reset-e2e-tests.sh\" \"npm run build\"", "test-e2e": "cross-env JEST_PUPPETEER_CONFIG=test/e2e/puppeteer.config.js wp-scripts test-unit-js --config test/e2e/jest.config.json --runInBand", "test-e2e:watch": "npm run test-e2e -- --watch", - "test-mobile": "yarn --cwd gutenberg-mobile test:inside-gb", "test-php": "npm run lint-php && npm run test-unit-php", "test-unit": "wp-scripts test-unit-js --config test/unit/jest.config.json", "test-unit:coverage": "npm run test-unit -- --coverage", diff --git a/test/e2e/jest.config.json b/test/e2e/jest.config.json index 21c7aecb7809c..354879e3d358a 100644 --- a/test/e2e/jest.config.json +++ b/test/e2e/jest.config.json @@ -1,9 +1,5 @@ { "rootDir": "../../", - "coveragePathIgnorePatterns": [ - "/node_modules/", - "/gutenberg-mobile/" - ], "preset": "jest-puppeteer", "setupTestFrameworkScriptFile": "/test/e2e/support/setup-test-framework.js", "testMatch": [ @@ -11,8 +7,5 @@ ], "transform": { "^.+\\.jsx?$": "/node_modules/babel-jest" - }, - "modulePathIgnorePatterns": [ - "/gutenberg-mobile/" - ] + } } diff --git a/test/unit/jest.config.json b/test/unit/jest.config.json index 2519b3b4e2e97..8c5a2ef25e92f 100644 --- a/test/unit/jest.config.json +++ b/test/unit/jest.config.json @@ -6,8 +6,7 @@ "/.*/build/", "/.*/build-module/", "/packages/.*/benchmark/", - "/packages/.*/test/", - "/gutenberg-mobile/" + "/packages/.*/test/" ], "moduleNameMapper": { "@wordpress\\/(block-serialization-spec-parser|is-shallow-equal)$": "packages/$1", @@ -23,8 +22,5 @@ "/test/e2e", "/.*/build/", "/.*/build-module/" - ], - "modulePathIgnorePatterns": [ - "/gutenberg-mobile/" ] }