Skip to content

Commit f15e1ad

Browse files
committed
Allow ignoring of specific envelope item types
1 parent abb74bf commit f15e1ad

File tree

2 files changed

+14
-1
lines changed
  • dev-packages/node-integration-tests

2 files changed

+14
-1
lines changed

dev-packages/node-integration-tests/suites/public-api/LocalVariables/test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ conditionalTest({ min: 18 })('LocalVariables integration', () => {
3535
'Should not include local variables by default',
3636
done => {
3737
createRunner(__dirname, 'no-local-variables.js')
38+
.ignore('session')
3839
.expect({
3940
event: event => {
4041
const frames = event.exception?.values?.[0].stacktrace?.frames || [];
@@ -56,6 +57,7 @@ conditionalTest({ min: 18 })('LocalVariables integration', () => {
5657
'Should include local variables when enabled',
5758
done => {
5859
createRunner(__dirname, 'local-variables.js')
60+
.ignore('session')
5961
.expect({
6062
event: event => {
6163
assertSentryEvent(event, EXPECTED_LOCAL_VARIABLES_EVENT);
@@ -70,6 +72,7 @@ conditionalTest({ min: 18 })('LocalVariables integration', () => {
7072
'Should include local variables with ESM',
7173
done => {
7274
createRunner(__dirname, 'local-variables-caught.mjs')
75+
.ignore('session')
7376
.expect({
7477
event: event => {
7578
assertSentryEvent(event, EXPECTED_LOCAL_VARIABLES_EVENT);
@@ -82,6 +85,7 @@ conditionalTest({ min: 18 })('LocalVariables integration', () => {
8285

8386
test('Includes local variables for caught exceptions when enabled', done => {
8487
createRunner(__dirname, 'local-variables-caught.js')
88+
.ignore('session')
8589
.expect({
8690
event: event => {
8791
assertSentryEvent(event, EXPECTED_LOCAL_VARIABLES_EVENT);

dev-packages/node-integration-tests/utils/runner.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { spawn } from 'child_process';
22
import { join } from 'path';
3-
import type { Envelope, Event, SerializedSession } from '@sentry/types';
3+
import type { Envelope, EnvelopeItemType, Event, SerializedSession } from '@sentry/types';
44

55
export function assertSentryEvent(actual: Event, expected: Event): void {
66
expect(actual).toMatchObject({
@@ -34,6 +34,7 @@ export function createRunner(...paths: string[]) {
3434

3535
const expectedEnvelopes: Expected[] = [];
3636
const flags: string[] = [];
37+
const ignored: EnvelopeItemType[] = [];
3738
let hasExited = false;
3839

3940
if (testPath.endsWith('.ts')) {
@@ -49,6 +50,10 @@ export function createRunner(...paths: string[]) {
4950
flags.push(...args);
5051
return this;
5152
},
53+
ignore: function (...types: EnvelopeItemType[]) {
54+
ignored.push(...types);
55+
return this;
56+
},
5257
start: function (done?: (e?: unknown) => void) {
5358
const expectedEnvelopeCount = expectedEnvelopes.length;
5459
let envelopeCount = 0;
@@ -94,6 +99,10 @@ export function createRunner(...paths: string[]) {
9499
for (const item of envelope[1]) {
95100
const envelopeItemType = item[0].type;
96101

102+
if (ignored.includes(envelopeItemType)) {
103+
continue;
104+
}
105+
97106
const expected = expectedEnvelopes.shift();
98107

99108
// Catch any error or failed assertions and pass them to done

0 commit comments

Comments
 (0)