Skip to content

Commit

Permalink
feat: update webpack outside of examples (open-telemetry#963)
Browse files Browse the repository at this point in the history
* feat: update webpack outside of examples

* chore: replace istanbul-instrumenter-loader with @jsdevtools/coverage-istanbul-loader

Co-authored-by: Valentin Marchaud <[email protected]>
  • Loading branch information
rauno56 and vmarchaud authored Apr 12, 2022
1 parent 80e855a commit 9a58648
Show file tree
Hide file tree
Showing 18 changed files with 240 additions and 72 deletions.
2 changes: 1 addition & 1 deletion karma.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
listenAddress: 'localhost',
hostname: 'localhost',
browsers: ['ChromeHeadless'],
frameworks: ['mocha'],
frameworks: ['mocha', 'webpack'],
coverageIstanbulReporter: {
reports: ['json'],
dir: '.nyc_output',
Expand Down
4 changes: 2 additions & 2 deletions karma.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const webpackNodePolyfills = require('./webpack.node-polyfills.js');
module.exports = {
mode: 'development',
target: 'web',
output: { filename: 'bundle.js' },
name: 'bundle',
resolve: { extensions: ['.ts', '.js', '.tsx'] },
devtool: 'inline-source-map',
module: {
Expand All @@ -31,7 +31,7 @@ module.exports = {
exclude: /(node_modules|\.test\.[tj]sx?$)/,
test: /\.ts$/,
use: {
loader: 'istanbul-instrumenter-loader',
loader: '@jsdevtools/coverage-istanbul-loader',
options: { esModules: true }
}
},
Expand Down
21 changes: 20 additions & 1 deletion metapackages/auto-instrumentations-web/karma.conf.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
}))
Expand Down
17 changes: 10 additions & 7 deletions metapackages/auto-instrumentations-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,32 @@
},
"devDependencies": {
"@babel/core": "7.15.0",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
"@opentelemetry/api": "1.0.2",
"@types/mocha": "8.2.3",
"@types/node": "16.11.21",
"@types/sinon": "10.0.2",
"@types/webpack-env": "1.16.2",
"assert": "2.0.0",
"babel-loader": "8.2.2",
"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",
"sinon": "13.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"typescript": "4.3.5",
"webpack": "4.46.0",
"webpack-cli": "4.7.2",
"util": "0.12.4",
"webpack": "5.72.0",
"webpack-cli": "4.9.2",
"webpack-merge": "5.8.0"
},
"dependencies": {
Expand Down
29 changes: 23 additions & 6 deletions packages/opentelemetry-id-generator-aws-xray/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,30 @@
* limitations under the License.
*/

const webpack = require('webpack');

const karmaWebpackConfig = require('../../karma.webpack');
const karmaBaseConfig = require('../../karma.base');

module.exports = config => {
config.set(
Object.assign({}, karmaBaseConfig, {
webpack: karmaWebpackConfig,
})
);
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
}))
};
14 changes: 8 additions & 6 deletions packages/opentelemetry-id-generator-aws-xray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,29 @@
"@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/sinon": "10.0.2",
"@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",
"sinon": "13.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"typescript": "4.3.5",
"webpack": "4.46.0"
"webpack": "5.72.0"
},
"dependencies": {
"@opentelemetry/core": "^1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,32 @@
},
"devDependencies": {
"@babel/core": "7.15.0",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
"@opentelemetry/api": "1.0.2",
"@types/mocha": "8.2.3",
"@types/node": "16.11.21",
"@types/sinon": "10.0.2",
"@types/webpack-env": "1.16.2",
"assert": "2.0.0",
"babel-loader": "8.2.2",
"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",
"sinon": "13.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"typescript": "4.3.5",
"webpack": "4.46.0",
"webpack-cli": "4.7.2",
"util": "0.12.4",
"webpack": "5.72.0",
"webpack-cli": "4.9.2",
"webpack-merge": "5.8.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,31 @@
* 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, {
frameworks: karmaBaseConfig.frameworks.concat(['jquery-1.8.3']),
webpack: karmaWebpackConfig,
webpack: karmaWebpackConfig
}))
};
16 changes: 9 additions & 7 deletions plugins/web/opentelemetry-instrumentation-long-task/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,34 @@
},
"devDependencies": {
"@babel/core": "7.15.0",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
"@opentelemetry/api": "1.0.2",
"@opentelemetry/sdk-trace-base": "1.0.1",
"@types/jquery": "3.5.6",
"@types/mocha": "7.0.2",
"@types/node": "16.11.21",
"@types/sinon": "10.0.2",
"@types/webpack-env": "1.16.2",
"assert": "2.0.0",
"babel-loader": "8.2.2",
"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-jquery": "0.2.4",
"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",
"sinon": "13.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"typescript": "4.3.5",
"webpack": "4.46.0",
"webpack-cli": "4.7.2",
"webpack": "5.72.0",
"webpack-cli": "4.9.2",
"webpack-merge": "5.8.0",
"zone.js": "0.11.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,31 @@
* 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, {
frameworks: karmaBaseConfig.frameworks.concat(['jquery-1.8.3']),
webpack: karmaWebpackConfig,
webpack: karmaWebpackConfig
}))
};
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
},
"devDependencies": {
"@babel/core": "7.15.0",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
"@opentelemetry/api": "1.0.2",
"@opentelemetry/context-zone-peer-dep": "1.0.1",
"@opentelemetry/instrumentation-xml-http-request": "0.27.0",
Expand All @@ -57,25 +58,26 @@
"@types/node": "16.11.21",
"@types/sinon": "10.0.2",
"@types/webpack-env": "1.16.2",
"assert": "2.0.0",
"babel-loader": "8.2.2",
"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-jquery": "0.2.4",
"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",
"sinon": "13.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"typescript": "4.3.5",
"webpack": "4.46.0",
"webpack-cli": "4.7.2",
"webpack": "5.72.0",
"webpack-cli": "4.9.2",
"webpack-merge": "5.8.0",
"zone.js": "0.11.4"
},
Expand Down
Loading

0 comments on commit 9a58648

Please sign in to comment.