From 773216ad3fa148ff32e930be3ddace6b4bcdf386 Mon Sep 17 00:00:00 2001 From: Ryan Tsao Date: Thu, 4 Apr 2019 10:53:30 -0700 Subject: [PATCH 1/3] Add failing test --- .../split-translations/fixture/src/routes.js | 2 +- test/e2e/split-translations/test.js | 28 ++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/test/e2e/split-translations/fixture/src/routes.js b/test/e2e/split-translations/fixture/src/routes.js index 675406f8..2462bf96 100644 --- a/test/e2e/split-translations/fixture/src/routes.js +++ b/test/e2e/split-translations/fixture/src/routes.js @@ -21,7 +21,7 @@ export default [ path: '/split2', component: split({ load() { - return import('./split2'); + return import(/* webpackChunkName: "named-chunk" */ './split2'); }, LoadingComponent, ErrorComponent, diff --git a/test/e2e/split-translations/test.js b/test/e2e/split-translations/test.js index fefc20d0..7def1b81 100644 --- a/test/e2e/split-translations/test.js +++ b/test/e2e/split-translations/test.js @@ -109,6 +109,16 @@ test('`fusion dev` app with split translations integration', async () => { 'renders first split translation' ); + await Promise.all([ + page.click('#split2-link'), + page.waitForSelector('#split2-translation'), + ]); + const content3 = await page.content(); + t.ok( + content3.includes('__SPLIT2_TRANSLATED__'), + 'renders second split translation' + ); + const reloaded = page.evaluate(() => { return new Promise(resolve => { // eslint-disable-next-line @@ -128,9 +138,9 @@ test('`fusion dev` app with split translations integration', async () => { page.click('#split2-link'), page.waitForSelector('#split2-translation'), ]); - const content3 = await page.content(); + const content4 = await page.content(); t.ok( - content3.includes('__HOT_TRANSLATED__'), + content4.includes('__HOT_TRANSLATED__'), 'renders second, hot split translation' ); @@ -140,9 +150,9 @@ test('`fusion dev` app with split translations integration', async () => { page.click('#split1-link'), page.waitForSelector('#split1-translation'), ]); - const content4 = await page.content(); + const content5 = await page.content(); t.ok( - content4.includes('__SPLIT1_TRANSLATED__'), + content5.includes('__SPLIT1_TRANSLATED__'), 'renders translation from unmodified file after rebuild' ); @@ -180,5 +190,15 @@ test('`fusion dev` app with split translations integration (cached)', async () = 'renders first split translation' ); + await Promise.all([ + page.click('#split2-link'), + page.waitForSelector('#split2-translation'), + ]); + const content3 = await page.content(); + t.ok( + content3.includes('__SPLIT2_TRANSLATED__'), + 'renders second split translation' + ); + app.teardown(); }, 100000); From 180d51b0bbaf5a6d050a78d082c274a746a7c640 Mon Sep 17 00:00:00 2001 From: Ryan Tsao Date: Thu, 4 Apr 2019 11:04:41 -0700 Subject: [PATCH 2/3] Update failing test --- test/e2e/split-translations/test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/e2e/split-translations/test.js b/test/e2e/split-translations/test.js index 7def1b81..adb7e6c3 100644 --- a/test/e2e/split-translations/test.js +++ b/test/e2e/split-translations/test.js @@ -119,6 +119,8 @@ test('`fusion dev` app with split translations integration', async () => { 'renders second split translation' ); + await page.goto(`${url}/`, {waitUntil: 'load'}); + const reloaded = page.evaluate(() => { return new Promise(resolve => { // eslint-disable-next-line From d79741d4ff3c2d5eae5e6e752319a4a4f71b2897 Mon Sep 17 00:00:00 2001 From: Ryan Tsao Date: Thu, 4 Apr 2019 11:38:59 -0700 Subject: [PATCH 3/3] Fix failing test by upgrading i18n --- package.json | 3 +- yarn.lock | 120 +++++---------------------------------------------- 2 files changed, 11 insertions(+), 112 deletions(-) diff --git a/package.json b/package.json index 83e77514..c3d24640 100644 --- a/package.json +++ b/package.json @@ -72,8 +72,7 @@ "eslint-plugin-react": "^7.11.1", "flow-bin": "^0.95.0", "fusion-core": "^1.10.4-1", - "fusion-plugin-i18n": "^1.2.0", - "fusion-plugin-i18n-react": "^1.2.3", + "fusion-plugin-i18n-react": "1.2.5-0", "fusion-plugin-react-router": "^1.4.2", "fusion-plugin-universal-events": "^1.3.2", "fusion-react": "1.3.7", diff --git a/yarn.lock b/yarn.lock index 28c01868..72db2e15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -243,7 +243,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-json-strings" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.2.0", "@babel/plugin-proposal-object-rest-spread@^7.3.1": +"@babel/plugin-proposal-object-rest-spread@^7.3.1": version "7.3.2" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.3.2.tgz#6d1859882d4d778578e41f82cc5d7bf3d5daf6c1" integrity sha512-DjeMS+J2+lpANkYLLO+m6GjoTMygYglKmRe6cDTbFv3L9i6mmiE8fe6B8MtCSLZpVXscD5kn7s6SgtHrDoBWoA== @@ -594,53 +594,6 @@ core-js "^2.5.7" regenerator-runtime "^0.12.0" -"@babel/preset-env@7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.2.3.tgz#948c8df4d4609c99c7e0130169f052ea6a7a8933" - integrity sha512-AuHzW7a9rbv5WXmvGaPX7wADxFkZIqKlbBh1dmZUQp4iwiPpkE/Qnrji6SC4UQCQzvWY/cpHET29eUhXS9cLPw== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.2.0" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.2.0" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.2.0" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.2.0" - "@babel/plugin-transform-classes" "^7.2.0" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.2.0" - "@babel/plugin-transform-dotall-regex" "^7.2.0" - "@babel/plugin-transform-duplicate-keys" "^7.2.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.2.0" - "@babel/plugin-transform-function-name" "^7.2.0" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.2.0" - "@babel/plugin-transform-modules-commonjs" "^7.2.0" - "@babel/plugin-transform-modules-systemjs" "^7.2.0" - "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-new-target" "^7.0.0" - "@babel/plugin-transform-object-super" "^7.2.0" - "@babel/plugin-transform-parameters" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.0.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.2.0" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.2.0" - browserslist "^4.3.4" - invariant "^2.2.2" - js-levenshtein "^1.1.3" - semver "^5.3.0" - "@babel/preset-env@7.3.1": version "7.3.1" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.3.1.tgz#389e8ca6b17ae67aaf9a2111665030be923515db" @@ -3390,57 +3343,6 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -fusion-cli@^1.13.1: - version "1.16.0" - resolved "https://registry.yarnpkg.com/fusion-cli/-/fusion-cli-1.16.0.tgz#aa7641e0dc433f2e265a04ce4aeab64b86a264cc" - integrity sha512-1WKbbIVWm0Sjk9IESD3aU8gx+3lbXCa/kBggPyTBrMp8YzWH5FhW83o+sdnBMFfh/QEYTH95gKxaQSO6bXxutA== - dependencies: - "@babel/core" "^7.1.6" - "@babel/plugin-syntax-dynamic-import" "7.2.0" - "@babel/plugin-transform-flow-strip-types" "7.2.3" - "@babel/polyfill" "^7.0.0" - "@babel/preset-env" "7.2.3" - "@babel/preset-react" "7.0.0" - "@gfx/zopfli" "^1.0.10" - "@rtsao/plugin-proposal-class-properties" "7.0.1-patch.1" - babel-core "^7.0.0-bridge.0" - babel-jest "^24.0.0" - babel-plugin-dynamic-import-node "^2.2.0" - babel-plugin-transform-cup-globals "^1.0.1" - bundle-analyzer "^0.0.6" - case-sensitive-paths-webpack-plugin "^2.1.2" - chalk "^2.4.1" - compression-webpack-plugin "^2.0.0" - enzyme-adapter-react-16 "^1.7.0" - enzyme-to-json "^3.3.4" - get-port "^4.0.0" - graphql-tag "^2.10.1" - http-proxy "^1.17.0" - iltorb "^2.4.1" - imagemin "^6.0.0" - imagemin-svgo "^7.0.0" - istanbul-api "^2.0.6" - istanbul-lib-coverage "^2.0.1" - jest "^24.0.0" - jest-environment-jsdom-global "^1.1.0" - just-snake-case "^1.1.0" - koa-mount "^4.0.0" - koa-static "^5.0.0" - loader-utils "^1.1.0" - make-dir "^1.3.0" - memory-fs "^0.4.1" - progress-bar-webpack-plugin "^1.11.0" - react-dev-utils "^6.1.1" - request "^2.88.0" - resolve-from "^4.0.0" - rimraf "^2.6.2" - sade "^1.4.1" - source-map-support "^0.5.9" - terser-webpack-plugin "^1.1.0" - webpack "4.26.1" - webpack-hot-middleware "^2.24.3" - winston "^3.1.0" - fusion-core@^1.10.4-1: version "1.10.4-1" resolved "https://registry.yarnpkg.com/fusion-core/-/fusion-core-1.10.4-1.tgz#edd1946ce4202b8f90436831702965799bc56b2d" @@ -3453,21 +3355,19 @@ fusion-core@^1.10.4-1: ua-parser-js "^0.7.19" uuid "^3.3.2" -fusion-plugin-i18n-react@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/fusion-plugin-i18n-react/-/fusion-plugin-i18n-react-1.2.3.tgz#d67db49d86560067770f2acd3d63c740811fa1e8" - integrity sha512-mvAZvagcKdLAfnNx2gDqJbDJe/8ayTr+jbCubmg8H1xBkS3uSPdgkKV2nUjV552OFMhJMaQzg18e9F9xtCoivw== +fusion-plugin-i18n-react@1.2.5-0: + version "1.2.5-0" + resolved "https://registry.yarnpkg.com/fusion-plugin-i18n-react/-/fusion-plugin-i18n-react-1.2.5-0.tgz#5a68800161dcd299d4d84b3d008e7fabde90b6cc" + integrity sha512-suhTj+ae3CqzhzflHRMPV2irlLepktbcHgVPZboTnO4EI4t4dBDI0OSAI6b4w5a3XnvmCXj4+wRUb7OGeuzqxg== dependencies: - fusion-cli "^1.13.1" - fusion-plugin-i18n "^1.2.0" + fusion-plugin-i18n "^1.2.2-1" prop-types "^15.6.2" -fusion-plugin-i18n@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/fusion-plugin-i18n/-/fusion-plugin-i18n-1.2.0.tgz#fc54e9637dc842e4f4292779bf20af577ff7b3ed" - integrity sha512-bHBsKlTjXnOStS8HAnwj3tNibRi9cE0AXXBnvvlghi1LAfLg6bAd4Kf0MRQmpaG1v6FT0aP1rnzEJLGP0SlsXw== +fusion-plugin-i18n@^1.2.2-1: + version "1.2.2-1" + resolved "https://registry.yarnpkg.com/fusion-plugin-i18n/-/fusion-plugin-i18n-1.2.2-1.tgz#c171daff506356c40e761195fb20691c9032d06f" + integrity sha512-sWwLinB3qE1dgFMNkW+zx0jaYGiygs2C08KpusvzKPJheidkWS3HuewLaPCoJodQryC9MgrnyVKShI5xYB6GHA== dependencies: - eslint-plugin-jest "^22.1.0" locale "^0.1.0" rollup "^0.67.3"