From 2f8e1affa445e88bbd526954a3fa55c058950959 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 10 Dec 2021 01:23:11 +0100 Subject: [PATCH 1/3] fix the i18n to load the keys again - witht he bable transform this no longer happend --- frontend/babel.config.js | 1 - frontend/package.json | 1 - frontend/yarn.lock | 9 +-------- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/frontend/babel.config.js b/frontend/babel.config.js index 7acdca661..5907ab074 100644 --- a/frontend/babel.config.js +++ b/frontend/babel.config.js @@ -1,7 +1,6 @@ module.exports = { presets: ['@babel/preset-env'], plugins: [ - 'transform-require-context', [ 'component', { diff --git a/frontend/package.json b/frontend/package.json index 86b127676..5fbdcb0d8 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -24,7 +24,6 @@ "babel-core": "^7.0.0-bridge.0", "babel-jest": "^27.3.1", "babel-plugin-require-context-hook": "^1.0.0", - "babel-plugin-transform-require-context": "^0.1.1", "babel-preset-vue": "^2.0.2", "bootstrap": "4.3.1", "bootstrap-vue": "^2.5.0", diff --git a/frontend/yarn.lock b/frontend/yarn.lock index ec95b138a..d1d6eacd0 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1217,7 +1217,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/template@7", "@babel/template@^7.12.13", "@babel/template@^7.16.0", "@babel/template@^7.3.3": +"@babel/template@^7.12.13", "@babel/template@^7.16.0", "@babel/template@^7.3.3": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.0.tgz#d16a35ebf4cd74e202083356fab21dd89363ddd6" integrity sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A== @@ -3345,13 +3345,6 @@ babel-plugin-transform-es2015-modules-commonjs@^6.26.0, babel-plugin-transform-e babel-template "^6.26.0" babel-types "^6.26.0" -babel-plugin-transform-require-context@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-require-context/-/babel-plugin-transform-require-context-0.1.1.tgz#319b545ca83080b5062776b46cc9b8b346fea9a6" - integrity sha512-4ceqYOtzgmq4/QsB8dP7pUrUOCjY/jrRYdt7YkIOWHxtGDQbcf6YZDyLCiPQf6KsEIcIbSQiTRXOsbLiuJfgNQ== - dependencies: - "@babel/template" "7" - babel-plugin-transform-strict-mode@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" From 5ff262df9105b9113945b85ff15856033ae51aea Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 10 Dec 2021 04:14:26 +0100 Subject: [PATCH 2/3] reinclude moriz's solution but only in test environment --- frontend/babel.config.js | 19 +++++++++++++++---- frontend/package.json | 2 +- frontend/yarn.lock | 14 ++++++++------ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/frontend/babel.config.js b/frontend/babel.config.js index 5907ab074..fab7b82b8 100644 --- a/frontend/babel.config.js +++ b/frontend/babel.config.js @@ -1,11 +1,22 @@ -module.exports = { - presets: ['@babel/preset-env'], - plugins: [ +module.exports = function (api) { + api.cache(true) + + const presets = ['@babel/preset-env'] + const plugins = [ [ 'component', { styleLibraryName: 'theme-chalk', }, ], - ], + ] + + if (process.env.NODE_ENV === 'test') { + plugins.push('transform-require-context') + } + + return { + presets, + plugins, + } } diff --git a/frontend/package.json b/frontend/package.json index 5fbdcb0d8..cfa7be87c 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -23,7 +23,6 @@ "axios": "^0.21.1", "babel-core": "^7.0.0-bridge.0", "babel-jest": "^27.3.1", - "babel-plugin-require-context-hook": "^1.0.0", "babel-preset-vue": "^2.0.2", "bootstrap": "4.3.1", "bootstrap-vue": "^2.5.0", @@ -89,6 +88,7 @@ "@vue/eslint-config-prettier": "^4.0.1", "babel-eslint": "^10.1.0", "babel-plugin-component": "^1.1.0", + "babel-plugin-transform-require-context": "^0.1.1", "dotenv-webpack": "^7.0.3", "node-sass": "^6.0.1", "sass-loader": "^10", diff --git a/frontend/yarn.lock b/frontend/yarn.lock index d1d6eacd0..2bc1361be 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1217,7 +1217,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/template@^7.12.13", "@babel/template@^7.16.0", "@babel/template@^7.3.3": +"@babel/template@7", "@babel/template@^7.12.13", "@babel/template@^7.16.0", "@babel/template@^7.3.3": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.0.tgz#d16a35ebf4cd74e202083356fab21dd89363ddd6" integrity sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A== @@ -3325,11 +3325,6 @@ babel-plugin-polyfill-regenerator@^0.1.2: dependencies: "@babel/helper-define-polyfill-provider" "^0.1.2" -babel-plugin-require-context-hook@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-require-context-hook/-/babel-plugin-require-context-hook-1.0.0.tgz#3f0e7cce87c338f53639b948632fd4e73834632d" - integrity sha512-EMZD1563QUqLhzrqcThk759RhuNVX/ZJdrtGK6drwzgvnR+ARjWyXIHPbu+tUNaMGtPz/gQeAM2M6VUw2UiUeA== - babel-plugin-syntax-jsx@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" @@ -3345,6 +3340,13 @@ babel-plugin-transform-es2015-modules-commonjs@^6.26.0, babel-plugin-transform-e babel-template "^6.26.0" babel-types "^6.26.0" +babel-plugin-transform-require-context@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-require-context/-/babel-plugin-transform-require-context-0.1.1.tgz#319b545ca83080b5062776b46cc9b8b346fea9a6" + integrity sha512-4ceqYOtzgmq4/QsB8dP7pUrUOCjY/jrRYdt7YkIOWHxtGDQbcf6YZDyLCiPQf6KsEIcIbSQiTRXOsbLiuJfgNQ== + dependencies: + "@babel/template" "7" + babel-plugin-transform-strict-mode@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" From fcd355e486e0d48b93cd2cf6865192797b342044 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 10 Dec 2021 04:27:13 +0100 Subject: [PATCH 3/3] run frontend tests in test environment --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0435d0c76..42c83ff06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -380,7 +380,7 @@ jobs: ########################################################################## - name: frontend | Unit tests run: | - docker run -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test + docker run --env NODE_ENV=test -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test cp -r ~/coverage ./coverage ########################################################################## # COVERAGE REPORT FRONTEND ###############################################