diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index edb8cb92fd..2b6bdd74f6 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -28,6 +28,7 @@ jobs: - node: "12" lerna-extra-args: >- --ignore @opentelemetry/instrumentation-redis-4 + --ignore @opentelemetry/instrumentation-pino runs-on: ubuntu-latest services: memcached: diff --git a/.gitignore b/.gitignore index 4398092d2b..547db388f6 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,4 @@ package.json.lerna_backup # version.ts file is automatically generated at compile time version.ts +/.vs diff --git a/karma.base.js b/karma.base.js index 995bd79659..70435dda11 100644 --- a/karma.base.js +++ b/karma.base.js @@ -18,7 +18,7 @@ module.exports = { listenAddress: 'localhost', hostname: 'localhost', browsers: ['ChromeHeadless'], - frameworks: ['mocha', 'webpack'], + frameworks: ['mocha'], coverageIstanbulReporter: { reports: ['json'], dir: '.nyc_output', diff --git a/karma.webpack.js b/karma.webpack.js index 10bf5ad0e9..158e61c32e 100644 --- a/karma.webpack.js +++ b/karma.webpack.js @@ -20,7 +20,7 @@ const webpackNodePolyfills = require('./webpack.node-polyfills.js'); module.exports = { mode: 'development', target: 'web', - name: 'bundle', + output: { filename: 'bundle.js' }, resolve: { extensions: ['.ts', '.js', '.tsx'] }, devtool: 'inline-source-map', module: { diff --git a/metapackages/auto-instrumentations-web/karma.conf.js b/metapackages/auto-instrumentations-web/karma.conf.js index 133e22df63..edcd9f055f 100644 --- a/metapackages/auto-instrumentations-web/karma.conf.js +++ b/metapackages/auto-instrumentations-web/karma.conf.js @@ -1,5 +1,5 @@ /*! - * Copyright The OpenTelemetry Authors + * Copyright 2020, 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,29 +14,10 @@ * 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/metapackages/auto-instrumentations-web/package.json b/metapackages/auto-instrumentations-web/package.json index be65e2f50c..0cee415876 100644 --- a/metapackages/auto-instrumentations-web/package.json +++ b/metapackages/auto-instrumentations-web/package.json @@ -34,32 +34,29 @@ }, "devDependencies": { "@babel/core": "7.15.0", - "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.0.0", "@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", - "karma": "6.3.17", - "karma-chrome-launcher": "3.1.1", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "karma": "6.3.16", + "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.33", - "karma-webpack": "5.0.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", - "process": "0.11.10", "rimraf": "3.0.2", "sinon": "14.0.0", "ts-loader": "8.3.0", "ts-mocha": "10.0.0", "typescript": "4.3.5", - "util": "0.12.4", - "webpack": "5.72.0", - "webpack-cli": "4.9.2", + "webpack": "4.46.0", + "webpack-cli": "4.7.2", "webpack-merge": "5.8.0" }, "dependencies": { diff --git a/packages/opentelemetry-id-generator-aws-xray/karma.conf.js b/packages/opentelemetry-id-generator-aws-xray/karma.conf.js index 133e22df63..f1a1f3a7e8 100644 --- a/packages/opentelemetry-id-generator-aws-xray/karma.conf.js +++ b/packages/opentelemetry-id-generator-aws-xray/karma.conf.js @@ -14,30 +14,13 @@ * 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 - })) +module.exports = config => { + config.set( + Object.assign({}, karmaBaseConfig, { + webpack: karmaWebpackConfig, + }) + ); }; diff --git a/packages/opentelemetry-id-generator-aws-xray/package.json b/packages/opentelemetry-id-generator-aws-xray/package.json index b66b039c00..87100a2afc 100644 --- a/packages/opentelemetry-id-generator-aws-xray/package.json +++ b/packages/opentelemetry-id-generator-aws-xray/package.json @@ -54,29 +54,27 @@ "@opentelemetry/api": "^1.0.0" }, "devDependencies": { - "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.0.0", "@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", - "karma": "6.3.17", - "karma-chrome-launcher": "3.1.1", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "karma": "6.3.16", + "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.33", - "karma-webpack": "5.0.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", - "process": "0.11.10", "rimraf": "3.0.2", "sinon": "14.0.0", "ts-loader": "8.3.0", "ts-mocha": "10.0.0", "typescript": "4.3.5", - "webpack": "5.72.0" + "webpack": "4.46.0" }, "dependencies": { "@opentelemetry/core": "^1.0.0" diff --git a/plugins/node/opentelemetry-instrumentation-pino/.tav.yml b/plugins/node/opentelemetry-instrumentation-pino/.tav.yml index aa5599b864..5ff15066e0 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/.tav.yml +++ b/plugins/node/opentelemetry-instrumentation-pino/.tav.yml @@ -1,6 +1,13 @@ pino: - versions: "^7.11.0 || 7.8.0 || 7.2.0 || ^6.13.1 || 5.17.0 || 5.14.0" - commands: npm run test + - versions: "^8.0.0 || ^7.11.0 || 7.8.0 || 7.2.0 || ^6.13.1 || 5.17.0 || 5.14.0" + node: ">=14" + commands: npm run test - # Fix missing `contrib-test-utils` package - pretest: npm run --prefix ../../../ lerna:link + # Fix missing `contrib-test-utils` package + pretest: npm run --prefix ../../../ lerna:link + - versions: "^7.11.0 || 7.8.0 || 7.2.0 || ^6.13.1 || 5.17.0 || 5.14.0" + node: ">=8 <14" + commands: npm run test + + # Fix missing `contrib-test-utils` package + pretest: npm run --prefix ../../../ lerna:link diff --git a/plugins/node/opentelemetry-instrumentation-pino/README.md b/plugins/node/opentelemetry-instrumentation-pino/README.md index 499357564a..288a69756b 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/README.md +++ b/plugins/node/opentelemetry-instrumentation-pino/README.md @@ -55,7 +55,7 @@ When no span context is active or the span context is invalid, injection is skip ### Supported versions -`>=5.14.0 <8` +`>=5.14.0 <9` ## Useful links diff --git a/plugins/node/opentelemetry-instrumentation-pino/package.json b/plugins/node/opentelemetry-instrumentation-pino/package.json index 8e750dfdce..8a02211788 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/package.json +++ b/plugins/node/opentelemetry-instrumentation-pino/package.json @@ -58,16 +58,16 @@ "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", + "pino": "8.3.1", "rimraf": "3.0.2", + "semver": "7.3.5", "sinon": "14.0.0", "test-all-versions": "5.0.1", "ts-mocha": "10.0.0", "typescript": "4.3.5" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.32.0", - "pino": "7.10.0", - "semver": "^7.3.5" + "@opentelemetry/instrumentation": "^0.32.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-pino#readme" } diff --git a/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts index 463d59a0cf..424c687d01 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts @@ -26,11 +26,10 @@ import { InstrumentationNodeModuleDefinition, safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation'; -import { Pino, PinoInstrumentationConfig } from './types'; +import { PinoInstrumentationConfig } from './types'; import { VERSION } from './version'; -import type { pino } from 'pino'; -const pinoVersions = ['>=5.14.0 <8']; +const pinoVersions = ['>=5.14.0 <9']; export class PinoInstrumentation extends InstrumentationBase { constructor(config: PinoInstrumentationConfig = {}) { @@ -39,7 +38,7 @@ export class PinoInstrumentation extends InstrumentationBase { protected init() { return [ - new InstrumentationNodeModuleDefinition( + new InstrumentationNodeModuleDefinition( 'pino', pinoVersions, pinoModule => { @@ -61,17 +60,22 @@ export class PinoInstrumentation extends InstrumentationBase { args.splice(0, 0, { mixin: instrumentation._getMixinFunction(), }); - return pinoModule(...(args as Parameters)); + return pinoModule(...args); } } - args[0] = instrumentation._combineOptions( - args[0] as pino.LoggerOptions - ); + args[0] = instrumentation._combineOptions(args[0]); - return pinoModule(...(args as Parameters)); + return pinoModule(...args); }, pinoModule); + if (typeof patchedPino.pino === 'function') { + patchedPino.pino = patchedPino; + } + if (typeof patchedPino.default === 'function') { + patchedPino.default = patchedPino; + } + return patchedPino; } ), @@ -135,7 +139,7 @@ export class PinoInstrumentation extends InstrumentationBase { }; } - private _combineOptions(options?: pino.LoggerOptions) { + private _combineOptions(options?: any) { if (options === undefined) { return { mixin: this._getMixinFunction() }; } diff --git a/plugins/node/opentelemetry-instrumentation-pino/src/types.ts b/plugins/node/opentelemetry-instrumentation-pino/src/types.ts index 7e29d47cc7..4bf80f5a34 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-pino/src/types.ts @@ -16,7 +16,6 @@ import { Span } from '@opentelemetry/api'; import { InstrumentationConfig } from '@opentelemetry/instrumentation'; -import type { pino } from 'pino'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type LogHookFunction = ( @@ -28,5 +27,3 @@ export type LogHookFunction = ( export interface PinoInstrumentationConfig extends InstrumentationConfig { logHook?: LogHookFunction; } - -export type Pino = typeof pino; diff --git a/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts b/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts index 4d2a5c3ff1..3f175bc90a 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts +++ b/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts @@ -75,11 +75,16 @@ describe('PinoInstrumentation', () => { return record; } - function init() { + function init(importType: 'global' | 'default' | 'pino' = 'global') { stream = new Writable(); stream._write = () => {}; writeSpy = sinon.spy(stream, 'write'); - logger = pino(stream); + if (importType === 'global') { + logger = pino(stream); + } else { + // @ts-expect-error the same function reexported + logger = pino[importType](stream); + } } before(() => { @@ -100,6 +105,30 @@ describe('PinoInstrumentation', () => { }); }); + it('injects span context to records in default export', function () { + // @ts-expect-error the same function reexported + if (!pino.default) { + this.skip(); + } + init('default'); + const span = tracer.startSpan('abc'); + context.with(trace.setSpan(context.active(), span), () => { + testInjection(span); + }); + }); + + it('injects span context to records in named export', function () { + // @ts-expect-error the same function reexported + if (!pino.pino) { + this.skip(); + } + init('pino'); + const span = tracer.startSpan('abc'); + context.with(trace.setSpan(context.active(), span), () => { + testInjection(span); + }); + }); + it('injects span context to child logger records', () => { const span = tracer.startSpan('abc'); context.with(trace.setSpan(context.active(), span), () => { @@ -243,7 +272,7 @@ describe('PinoInstrumentation', () => { instrumentation.enable(); }); - beforeEach(init); + beforeEach(() => init()); it('does not inject span context', () => { const span = tracer.startSpan('abc'); diff --git a/plugins/web/opentelemetry-instrumentation-document-load/karma.conf.js b/plugins/web/opentelemetry-instrumentation-document-load/karma.conf.js index 35e9ab9375..6174839d65 100644 --- a/plugins/web/opentelemetry-instrumentation-document-load/karma.conf.js +++ b/plugins/web/opentelemetry-instrumentation-document-load/karma.conf.js @@ -14,29 +14,10 @@ * 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/plugins/web/opentelemetry-instrumentation-document-load/package.json b/plugins/web/opentelemetry-instrumentation-document-load/package.json index 95f2205475..107b052245 100644 --- a/plugins/web/opentelemetry-instrumentation-document-load/package.json +++ b/plugins/web/opentelemetry-instrumentation-document-load/package.json @@ -51,32 +51,29 @@ }, "devDependencies": { "@babel/core": "7.15.0", - "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.0.0", "@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", - "karma": "6.3.17", - "karma-chrome-launcher": "3.1.1", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "karma": "6.3.16", + "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.33", - "karma-webpack": "5.0.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", - "process": "0.11.10", "rimraf": "3.0.2", "sinon": "14.0.0", "ts-loader": "8.3.0", "ts-mocha": "10.0.0", "typescript": "4.3.5", - "util": "0.12.4", - "webpack": "5.72.0", - "webpack-cli": "4.9.2", + "webpack": "4.46.0", + "webpack-cli": "4.7.2", "webpack-merge": "5.8.0" }, "dependencies": { diff --git a/plugins/web/opentelemetry-instrumentation-long-task/karma.conf.js b/plugins/web/opentelemetry-instrumentation-long-task/karma.conf.js index 62d6fdcb46..4a4bd49791 100644 --- a/plugins/web/opentelemetry-instrumentation-long-task/karma.conf.js +++ b/plugins/web/opentelemetry-instrumentation-long-task/karma.conf.js @@ -14,31 +14,12 @@ * 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, })) }; diff --git a/plugins/web/opentelemetry-instrumentation-long-task/package.json b/plugins/web/opentelemetry-instrumentation-long-task/package.json index 49089e9587..a29440796a 100644 --- a/plugins/web/opentelemetry-instrumentation-long-task/package.json +++ b/plugins/web/opentelemetry-instrumentation-long-task/package.json @@ -48,7 +48,6 @@ }, "devDependencies": { "@babel/core": "7.15.0", - "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.0.0", "@opentelemetry/sdk-trace-base": "^1.3.1", "@types/jquery": "3.5.6", @@ -56,26 +55,25 @@ "@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", - "karma": "6.3.17", - "karma-chrome-launcher": "3.1.1", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "karma": "6.3.16", + "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-jquery": "0.2.4", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.33", - "karma-webpack": "5.0.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", - "process": "0.11.10", "rimraf": "3.0.2", "sinon": "14.0.0", "ts-loader": "8.3.0", "ts-mocha": "10.0.0", "typescript": "4.3.5", - "webpack": "5.72.0", - "webpack-cli": "4.9.2", + "webpack": "4.46.0", + "webpack-cli": "4.7.2", "webpack-merge": "5.8.0", "zone.js": "0.11.4" }, diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/karma.conf.js b/plugins/web/opentelemetry-instrumentation-user-interaction/karma.conf.js index 62d6fdcb46..4a4bd49791 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/karma.conf.js +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/karma.conf.js @@ -14,31 +14,12 @@ * 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, })) }; diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json index 50cb207cfc..83b008750d 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json @@ -48,7 +48,6 @@ }, "devDependencies": { "@babel/core": "7.15.0", - "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.0.0", "@opentelemetry/context-zone-peer-dep": "^1.3.1", "@opentelemetry/instrumentation-xml-http-request": "^0.32.0", @@ -58,26 +57,25 @@ "@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", - "karma": "6.3.17", - "karma-chrome-launcher": "3.1.1", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "karma": "6.3.16", + "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-jquery": "0.2.4", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.33", - "karma-webpack": "5.0.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", - "process": "0.11.10", "rimraf": "3.0.2", "sinon": "14.0.0", "ts-loader": "8.3.0", "ts-mocha": "10.0.0", "typescript": "4.3.5", - "webpack": "5.72.0", - "webpack-cli": "4.9.2", + "webpack": "4.46.0", + "webpack-cli": "4.7.2", "webpack-merge": "5.8.0", "zone.js": "0.11.4" }, diff --git a/plugins/web/opentelemetry-plugin-react-load/karma.conf.js b/plugins/web/opentelemetry-plugin-react-load/karma.conf.js index 35e9ab9375..6174839d65 100644 --- a/plugins/web/opentelemetry-plugin-react-load/karma.conf.js +++ b/plugins/web/opentelemetry-plugin-react-load/karma.conf.js @@ -14,29 +14,10 @@ * 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/plugins/web/opentelemetry-plugin-react-load/package.json b/plugins/web/opentelemetry-plugin-react-load/package.json index 7bb63053a7..3a1f035b91 100644 --- a/plugins/web/opentelemetry-plugin-react-load/package.json +++ b/plugins/web/opentelemetry-plugin-react-load/package.json @@ -48,7 +48,6 @@ }, "devDependencies": { "@babel/core": "7.15.0", - "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.0.0", "@opentelemetry/propagator-b3": "^1.3.1", "@types/mocha": "7.0.2", @@ -59,18 +58,17 @@ "@types/shimmer": "1.0.2", "@types/sinon": "10.0.2", "@types/webpack-env": "1.16.2", - "assert": "2.0.0", "babel-loader": "8.2.2", "gts": "3.1.0", - "karma": "6.3.17", - "karma-chrome-launcher": "3.1.1", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "karma": "6.3.16", + "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.33", - "karma-webpack": "5.0.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", - "process": "0.11.10", "react": "17.0.2", "react-dom": "17.0.2", "rimraf": "3.0.2", @@ -78,8 +76,8 @@ "ts-loader": "8.3.0", "ts-mocha": "10.0.0", "typescript": "4.3.5", - "webpack": "5.72.0", - "webpack-cli": "4.9.2", + "webpack": "4.46.0", + "webpack-cli": "4.7.2", "webpack-merge": "5.8.0" }, "peerDependencies": { diff --git a/propagators/opentelemetry-propagator-aws-xray/karma.conf.js b/propagators/opentelemetry-propagator-aws-xray/karma.conf.js index 133e22df63..edcd9f055f 100644 --- a/propagators/opentelemetry-propagator-aws-xray/karma.conf.js +++ b/propagators/opentelemetry-propagator-aws-xray/karma.conf.js @@ -1,5 +1,5 @@ /*! - * Copyright The OpenTelemetry Authors + * Copyright 2020, 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,29 +14,10 @@ * 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/propagators/opentelemetry-propagator-aws-xray/package.json b/propagators/opentelemetry-propagator-aws-xray/package.json index cef8e11b4d..a2b25c8d37 100644 --- a/propagators/opentelemetry-propagator-aws-xray/package.json +++ b/propagators/opentelemetry-propagator-aws-xray/package.json @@ -48,28 +48,25 @@ "@opentelemetry/api": "^1.0.0" }, "devDependencies": { - "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "16.11.21", "@types/webpack-env": "1.16.2", - "assert": "2.0.0", "gts": "3.1.0", - "karma": "6.3.17", - "karma-chrome-launcher": "3.1.1", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "karma": "6.3.16", + "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.33", - "karma-webpack": "5.0.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", - "process": "0.11.10", "rimraf": "3.0.2", "ts-loader": "8.3.0", "ts-mocha": "10.0.0", "typescript": "4.3.5", - "webpack": "5.72.0", - "webpack-cli": "4.9.2" + "webpack": "4.46.0" }, "dependencies": { "@opentelemetry/core": "^1.0.0" diff --git a/propagators/opentelemetry-propagator-ot-trace/karma.conf.js b/propagators/opentelemetry-propagator-ot-trace/karma.conf.js index 133e22df63..f1a1f3a7e8 100644 --- a/propagators/opentelemetry-propagator-ot-trace/karma.conf.js +++ b/propagators/opentelemetry-propagator-ot-trace/karma.conf.js @@ -14,30 +14,13 @@ * 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 - })) +module.exports = config => { + config.set( + Object.assign({}, karmaBaseConfig, { + webpack: karmaWebpackConfig, + }) + ); }; diff --git a/propagators/opentelemetry-propagator-ot-trace/package.json b/propagators/opentelemetry-propagator-ot-trace/package.json index 39a869e8e3..d56da06da9 100644 --- a/propagators/opentelemetry-propagator-ot-trace/package.json +++ b/propagators/opentelemetry-propagator-ot-trace/package.json @@ -49,27 +49,24 @@ "@opentelemetry/api": "^1.0.0" }, "devDependencies": { - "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "16.11.21", "@types/webpack-env": "1.16.2", - "assert": "2.0.0", "gts": "3.1.0", - "karma": "6.3.17", - "karma-chrome-launcher": "3.1.1", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "karma": "6.3.16", + "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.33", - "karma-webpack": "5.0.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", - "process": "0.11.10", "ts-loader": "8.3.0", "ts-mocha": "10.0.0", "typescript": "4.3.5", - "webpack": "5.72.0", - "webpack-cli": "4.9.2" + "webpack": "4.46.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/propagators/opentelemetry-propagator-ot-trace#readme" }