|
1 |
| -import { describe, expect, it } from 'vitest'; |
| 1 | +import { describe, expect, it, vi } from 'vitest'; |
2 | 2 | import type { ClientOptions, SpanJSON } from '../../../src';
|
| 3 | +import { debug } from '../../../src/utils/debug-logger'; |
3 | 4 | import { reparentChildSpans, shouldIgnoreSpan } from '../../../src/utils/should-ignore-span';
|
4 | 5 |
|
5 | 6 | describe('shouldIgnoreSpan', () => {
|
@@ -87,6 +88,16 @@ describe('shouldIgnoreSpan', () => {
|
87 | 88 | expect(shouldIgnoreSpan(span11, ignoreSpans)).toBe(false);
|
88 | 89 | expect(shouldIgnoreSpan(span12, ignoreSpans)).toBe(false);
|
89 | 90 | });
|
| 91 | + |
| 92 | + it('emits a debug log when a span is ignored', () => { |
| 93 | + const debugLogSpy = vi.spyOn(debug, 'log'); |
| 94 | + const span = { description: 'testDescription', op: 'testOp' }; |
| 95 | + const ignoreSpans = [/test/]; |
| 96 | + expect(shouldIgnoreSpan(span, ignoreSpans)).toBe(true); |
| 97 | + expect(debugLogSpy).toHaveBeenCalledWith( |
| 98 | + 'Ignoring span testOp - testDescription because it matches `ignoreSpans`.', |
| 99 | + ); |
| 100 | + }); |
90 | 101 | });
|
91 | 102 |
|
92 | 103 | describe('reparentChildSpans', () => {
|
|
0 commit comments