Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/api-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/api-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,38 +135,40 @@ 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,
});
instrumentation.enable();
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();
pichlermarc marked this conversation as resolved.
Show resolved Hide resolved
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,
});
Expand All @@ -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,
});
Expand All @@ -187,15 +191,17 @@ 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,
});
instrumentation.enable();
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,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/otlp-exporter-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/otlp-transformer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/sampler-jaeger-remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/sdk-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/sdk-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/shim-opencensus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/web-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading
Loading