summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-10-02 15:12:04 -0500
committerMike Greiling <mike@pixelcog.com>2018-10-02 15:15:43 -0500
commita9df7d866dc726ded2cb0a295a4af68a010201e2 (patch)
tree802c8496dcdf4621a920db7a2d14cbbfedf128ef
parent1efed5d3892618f0161506d1bade19738c418c64 (diff)
downloadgitlab-ce-a9df7d866dc726ded2cb0a295a4af68a010201e2.tar.gz
Remove babel-plugin-transform-define dependency
-rw-r--r--.babelrc6
-rw-r--r--config/karma.config.js11
-rw-r--r--package.json1
-rw-r--r--spec/javascripts/test_bundle.js2
-rw-r--r--yarn.lock15
5 files changed, 8 insertions, 27 deletions
diff --git a/.babelrc b/.babelrc
index 72a81d08dbc..83172a47753 100644
--- a/.babelrc
+++ b/.babelrc
@@ -28,12 +28,6 @@
"exclude": ["spec/javascripts/**/*", "app/assets/javascripts/locale/**/app.js"]
}
],
- [
- "babel-plugin-transform-define",
- {
- "process.env.BABEL_ENV": "coverage"
- }
- ],
"babel-plugin-rewire"
]
}
diff --git a/config/karma.config.js b/config/karma.config.js
index cad3c0e9193..7960bbf69ad 100644
--- a/config/karma.config.js
+++ b/config/karma.config.js
@@ -6,7 +6,6 @@ const argumentsParser = require('commander');
const webpackConfig = require('./webpack.config.js');
const ROOT_PATH = path.resolve(__dirname, '..');
-const GENERATE_COVERAGE_REPORT = process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage';
function fatalError(message) {
console.error(chalk.red(`\nError: ${message}\n`));
@@ -24,7 +23,11 @@ webpackConfig.optimization.splitChunks = false;
webpackConfig.devtool = 'cheap-inline-source-map';
webpackConfig.plugins.push(
- new webpack.DefinePlugin({ GENERATE_COVERAGE_REPORT }),
+ new webpack.DefinePlugin({
+ 'process.env': {
+ BABEL_ENV: JSON.stringify(process.env.BABEL_ENV || process.env.NODE_ENV || null),
+ },
+ })
);
const specFilters = argumentsParser
@@ -89,7 +92,7 @@ module.exports = function(config) {
basePath: ROOT_PATH,
browsers: ['ChromeHeadlessCustom'],
client: {
- color: !process.env.CI
+ color: !process.env.CI,
},
customLaunchers: {
ChromeHeadlessCustom: {
@@ -123,7 +126,7 @@ module.exports = function(config) {
};
}
- if (GENERATE_COVERAGE_REPORT) {
+ if (process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage') {
karmaConfig.reporters.push('coverage-istanbul');
karmaConfig.coverageIstanbulReporter = {
reports: ['html', 'text-summary'],
diff --git a/package.json b/package.json
index 96dd414ec30..fe2f56e5da6 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,6 @@
"autosize": "^4.0.0",
"axios": "^0.17.1",
"babel-loader": "^8.0.4",
- "babel-plugin-transform-define": "^1.3.0",
"blackst0ne-mermaid": "^7.1.0-fixed",
"bootstrap": "4.1.1",
"brace-expansion": "^1.1.8",
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js
index d0fba401115..96c0844f83c 100644
--- a/spec/javascripts/test_bundle.js
+++ b/spec/javascripts/test_bundle.js
@@ -155,7 +155,7 @@ describe('test errors', () => {
// if we're generating coverage reports, make sure to include all files so
// that we can catch files with 0% coverage
// see: https://github.com/deepsweet/istanbul-instrumenter-loader/issues/15
-if (GENERATE_COVERAGE_REPORT) { // eslint-disable-line no-undef
+if (process.env.BABEL_ENV === 'coverage') {
// exempt these files from the coverage report
const troubleMakers = [
'./blob_edit/blob_bundle.js',
diff --git a/yarn.lock b/yarn.lock
index 8bc242f208a..023a5f082fd 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1055,13 +1055,6 @@ babel-plugin-rewire@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-rewire/-/babel-plugin-rewire-1.2.0.tgz#822562d72ed2c84e47c0f95ee232c920853e9d89"
-babel-plugin-transform-define@^1.3.0:
- version "1.3.0"
- resolved "https://registry.yarnpkg.com/babel-plugin-transform-define/-/babel-plugin-transform-define-1.3.0.tgz#94c5f9459c810c738cc7c50cbd44a31829d6f319"
- dependencies:
- lodash "4.17.4"
- traverse "0.6.6"
-
babel-polyfill@6.23.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d"
@@ -4461,10 +4454,6 @@ lodash.upperfirst@4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"
-lodash@4.17.4:
- version "4.17.4"
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
-
lodash@^4.11.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@^4.5.0:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
@@ -6643,10 +6632,6 @@ touch@^3.1.0:
dependencies:
nopt "~1.0.10"
-traverse@0.6.6:
- version "0.6.6"
- resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.6.6.tgz#cbdf560fd7b9af632502fed40f918c157ea97137"
-
trim-right@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"