From 18e8efaa7a6528c173e048b33dbadd26b7f82118 Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Tue, 12 Apr 2022 12:47:12 +0300 Subject: [PATCH] feat: update webpack outside of examples (#963) * feat: update webpack outside of examples * chore: replace istanbul-instrumenter-loader with @jsdevtools/coverage-istanbul-loader Co-authored-by: Valentin Marchaud --- karma.conf.js | 21 ++++++++++++++++++++- package.json | 15 +++++++++------ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index edcd9f055fd..133e22df63b 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,5 +1,5 @@ /*! - * Copyright 2020, OpenTelemetry Authors + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,29 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../karma.webpack'); const karmaBaseConfig = require('../../karma.base'); module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + config.set(Object.assign({}, karmaBaseConfig, { webpack: karmaWebpackConfig })) diff --git a/package.json b/package.json index 7df61a9a03c..06a8e66e623 100644 --- a/package.json +++ b/package.json @@ -48,25 +48,28 @@ "@opentelemetry/api": "^1.0.2" }, "devDependencies": { + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@types/mocha": "8.2.3", "@types/node": "16.11.21", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "rimraf": "3.0.2", "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0" + "webpack": "5.72.0", + "webpack-cli": "4.9.2" }, "dependencies": { "@opentelemetry/core": "^1.0.0"