Skip to content

Commit 44988a3

Browse files
committed
Make ESM test standalone
1 parent 44e37ea commit 44988a3

File tree

1 file changed

+26
-25
lines changed
  • plugins/node/opentelemetry-instrumentation-pg/test

1 file changed

+26
-25
lines changed

plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ describe('pg', () => {
160160
if (testPostgresLocally) {
161161
testUtils.cleanUpDocker('postgres');
162162
}
163+
163164
await client.end();
164165
});
165166

@@ -1087,31 +1088,31 @@ describe('pg', () => {
10871088
});
10881089
});
10891090
});
1091+
});
10901092

1091-
it('should work with ESM usage', async () => {
1092-
await testUtils.runTestFixture({
1093-
cwd: __dirname,
1094-
argv: ['fixtures/use-pg.mjs'],
1095-
env: {
1096-
NODE_OPTIONS:
1097-
'--experimental-loader=@opentelemetry/instrumentation/hook.mjs',
1098-
NODE_NO_WARNINGS: '1',
1099-
},
1100-
checkResult: (err, stdout, stderr) => {
1101-
assert.ifError(err);
1102-
},
1103-
checkCollector: (collector: testUtils.TestCollector) => {
1104-
const spans = collector.sortedSpans;
1105-
1106-
assert.strictEqual(spans.length, 3);
1107-
1108-
assert.strictEqual(spans[0].name, 'pg.connect');
1109-
assert.strictEqual(spans[0].kind, 3);
1110-
assert.strictEqual(spans[1].name, 'test-span');
1111-
assert.strictEqual(spans[1].kind, 1);
1112-
assert.strictEqual(spans[2].name, 'pg.query:SELECT postgres');
1113-
assert.strictEqual(spans[2].kind, 3);
1114-
},
1115-
});
1093+
it('should work with ESM usage', async () => {
1094+
await testUtils.runTestFixture({
1095+
cwd: __dirname,
1096+
argv: ['fixtures/use-pg.mjs'],
1097+
env: {
1098+
NODE_OPTIONS:
1099+
'--experimental-loader=@opentelemetry/instrumentation/hook.mjs',
1100+
NODE_NO_WARNINGS: '1',
1101+
},
1102+
checkResult: (err, stdout, stderr) => {
1103+
assert.ifError(err);
1104+
},
1105+
checkCollector: (collector: testUtils.TestCollector) => {
1106+
const spans = collector.sortedSpans;
1107+
1108+
assert.strictEqual(spans.length, 3);
1109+
1110+
assert.strictEqual(spans[0].name, 'pg.connect');
1111+
assert.strictEqual(spans[0].kind, 3);
1112+
assert.strictEqual(spans[1].name, 'test-span');
1113+
assert.strictEqual(spans[1].kind, 1);
1114+
assert.strictEqual(spans[2].name, 'pg.query:SELECT postgres');
1115+
assert.strictEqual(spans[2].kind, 3);
1116+
},
11161117
});
11171118
});

0 commit comments

Comments
 (0)