test(instrumentation): skip unwrap tests for esm (#5153)

Co-authored-by: Mend Renovate <bot@renovateapp.com>
This commit is contained in:
Marc Pichler 2024-11-14 17:11:44 +01:00 committed by GitHub
parent c78a02fe74
commit d51fa95a6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
46 changed files with 615 additions and 305 deletions

View File

@ -77,7 +77,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack": "5.28.5",

View File

@ -64,7 +64,7 @@
"@opentelemetry/api-logs": "0.54.2"
},
"devDependencies": {
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",

View File

@ -63,7 +63,7 @@
"@opentelemetry/api": "^1.3.0"
},
"devDependencies": {
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",

View File

@ -54,7 +54,7 @@
"@opentelemetry/api-logs": "0.54.2",
"@opentelemetry/otlp-exporter-base": "0.54.2",
"@opentelemetry/resources": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -74,7 +74,7 @@
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/resources": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -66,7 +66,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"babel-plugin-istanbul": "7.0.0",

View File

@ -51,7 +51,7 @@
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/otlp-exporter-base": "0.54.2",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -65,7 +65,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -65,7 +65,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"babel-plugin-istanbul": "7.0.0",

View File

@ -56,7 +56,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"babel-plugin-istanbul": "7.0.0",

View File

@ -50,7 +50,7 @@
"devDependencies": {
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -65,7 +65,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -56,7 +56,7 @@
},
"devDependencies": {
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -45,7 +45,7 @@
"devDependencies": {
"@opentelemetry/api": "1.9.0",
"@opentelemetry/semantic-conventions": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -60,7 +60,7 @@
"@opentelemetry/context-zone": "1.27.0",
"@opentelemetry/propagator-b3": "1.27.0",
"@opentelemetry/sdk-trace-base": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -57,7 +57,7 @@
"@protobuf-ts/grpc-transport": "2.9.4",
"@protobuf-ts/runtime": "2.9.4",
"@protobuf-ts/runtime-rpc": "2.9.4",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/semver": "7.5.8",
"@types/sinon": "17.0.3",

View File

@ -53,7 +53,7 @@
"@opentelemetry/sdk-metrics": "1.27.0",
"@opentelemetry/sdk-trace-base": "1.27.0",
"@opentelemetry/sdk-trace-node": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/request-promise-native": "1.0.21",
"@types/semver": "7.5.8",

View File

@ -60,7 +60,7 @@
"@opentelemetry/context-zone": "1.27.0",
"@opentelemetry/propagator-b3": "1.27.0",
"@opentelemetry/sdk-trace-base": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -85,7 +85,7 @@
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/sdk-metrics": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/semver": "7.5.8",
"@types/sinon": "17.0.3",

View File

@ -135,18 +135,18 @@ class TestAbsoluteFileInstrumentationPatchFn extends InstrumentationBase {
this._unwrap(moduleExports, 'testFunction');
return moduleExports;
}
)
),
]
)
);
}
}
describe('when loading esm module', () => {
describe('when loading esm module', function () {
const instrumentationWrap = new TestInstrumentationWrapFn({
enabled: false,
});
it('should patch module file directly', async () => {
it('should patch module file directly', async function () {
const instrumentation = new TestInstrumentationSimple({
enabled: false,
});
@ -154,19 +154,21 @@ describe('when loading esm module', () => {
assert.deepEqual(exported.testConstant, 43);
});
it('should patch a module with the wrap function', async () => {
it('should patch a module with the wrap function', async function () {
instrumentationWrap.enable();
assert.deepEqual(exported.testFunction(), 'patched');
});
it('should unwrap a patched function', async () => {
it('should unwrap a patched function', async function () {
// Test skipped due to https://github.com/nodejs/import-in-the-middle/pull/153 breaking unwrap functionality
this.skip();
instrumentationWrap.enable();
// disable to trigger unwrap
instrumentationWrap.disable();
assert.deepEqual(exported.testFunction(), 'original');
});
it('should wrap multiple functions with masswrap', () => {
it('should wrap multiple functions with masswrap', function () {
const instrumentation = new TestInstrumentationMasswrapFn({
enabled: false,
});
@ -176,7 +178,9 @@ describe('when loading esm module', () => {
assert.deepEqual(exported.secondTestFunction(), 'patched');
});
it('should unwrap multiple functions with massunwrap', () => {
it('should unwrap multiple functions with massunwrap', async function () {
// Test skipped due to https://github.com/nodejs/import-in-the-middle/pull/153 breaking unwrap functionality
this.skip();
const instrumentation = new TestInstrumentationMasswrapFn({
enabled: false,
});
@ -187,7 +191,7 @@ describe('when loading esm module', () => {
assert.deepEqual(exported.secondTestFunction(), 'original');
});
it('should patch function from a file with absolute path', async () => {
it('should patch function from a file with absolute path', async function () {
const instrumentation = new TestAbsoluteFileInstrumentationPatchFn({
enabled: false,
});
@ -195,7 +199,9 @@ describe('when loading esm module', () => {
assert.deepEqual(exportedAbsolute.testFunction(), 'patched');
});
it('should unwrap a patched function from a file with absolute path', async () => {
it('should unwrap a patched function from a file with absolute path', async function () {
// Test skipped due to https://github.com/nodejs/import-in-the-middle/pull/153 breaking unwrap functionality
this.skip();
const instrumentation = new TestAbsoluteFileInstrumentationPatchFn({
enabled: false,
});

View File

@ -68,7 +68,7 @@
"@opentelemetry/api": "1.9.0",
"@opentelemetry/context-async-hooks": "1.27.0",
"@opentelemetry/exporter-jaeger": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/semver": "7.5.8",
"@types/sinon": "17.0.3",

View File

@ -67,7 +67,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"babel-plugin-istanbul": "7.0.0",

View File

@ -49,7 +49,7 @@
"@opentelemetry/api": "1.9.0",
"@opentelemetry/resources": "1.27.0",
"@opentelemetry/sdk-trace-base": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -62,7 +62,7 @@
},
"devDependencies": {
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",
"cross-var": "1.1.0",

View File

@ -48,7 +48,7 @@
"@opentelemetry/api": "^1.3.0"
},
"devDependencies": {
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -68,7 +68,7 @@
"devDependencies": {
"@babel/core": "7.25.2",
"@opentelemetry/api": "1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"@types/webpack-env": "1.16.3",

View File

@ -75,7 +75,7 @@
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": ">=1.4.0 <1.10.0",
"@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"babel-plugin-istanbul": "7.0.0",

View File

@ -52,7 +52,7 @@
"@opentelemetry/api": "1.9.0",
"@opentelemetry/context-async-hooks": "1.27.0",
"@opentelemetry/sdk-trace-base": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -75,7 +75,7 @@
"@opentelemetry/api": "1.9.0",
"@opentelemetry/api-events": "0.54.2",
"@opentelemetry/api-logs": "0.54.2",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"@types/webpack-env": "1.16.3",

View File

@ -29,7 +29,7 @@
"devDependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/core": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"cross-var": "1.1.0",
"lerna": "6.6.2",

804
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"cross-var": "1.1.0",
"lerna": "6.6.2",

View File

@ -56,7 +56,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -64,7 +64,7 @@
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -46,7 +46,7 @@
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/resources": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",

View File

@ -62,7 +62,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": "^1.0.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -58,7 +58,7 @@
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"cross-var": "1.1.0",
"lerna": "6.6.2",

View File

@ -55,7 +55,7 @@
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -65,7 +65,7 @@
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -65,7 +65,7 @@
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -48,7 +48,7 @@
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"@opentelemetry/resources": "1.27.0",
"@opentelemetry/semantic-conventions": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/semver": "7.5.8",
"@types/sinon": "17.0.3",

View File

@ -60,8 +60,8 @@
"@opentelemetry/context-zone": "1.27.0",
"@opentelemetry/propagator-b3": "1.27.0",
"@opentelemetry/resources": "1.27.0",
"@types/jquery": "3.5.31",
"@types/mocha": "10.0.8",
"@types/jquery": "3.5.32",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",

View File

@ -46,7 +46,7 @@
"@opentelemetry/propagator-b3": "1.27.0",
"@opentelemetry/propagator-jaeger": "1.27.0",
"@opentelemetry/sdk-trace-base": "1.27.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"cross-var": "1.1.0",
"lerna": "6.6.2",

View File

@ -57,7 +57,7 @@
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@opentelemetry/api": ">=1.3.0 <1.10.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"babel-plugin-istanbul": "7.0.0",

View File

@ -41,7 +41,7 @@
"babel-loader": "8.4.1",
"babel-polyfill": "6.26.0",
"browserstack-local": "1.4.8",
"chromedriver": "130.0.0",
"chromedriver": "130.0.4",
"dotenv": "16.0.0",
"fast-safe-stringify": "2.1.1",
"geckodriver": "3.0.1",

View File

@ -76,7 +76,7 @@
"@size-limit/file": "^11.0.1",
"@size-limit/time": "^11.0.1",
"@size-limit/webpack": "^11.0.1",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",