11import { afterEach , beforeEach , describe , expect , it , test , vi } from 'vitest' ;
22import {
33 Scope ,
4- SentryError ,
54 SyncPromise ,
65 addBreadcrumb ,
76 dsnToString ,
@@ -13,6 +12,7 @@ import {
1312 withMonitor ,
1413} from '../../src' ;
1514import type { BaseClient , Client } from '../../src/client' ;
15+ import { _makeInternalError } from '../../src/client' ;
1616import * as integrationModule from '../../src/integration' ;
1717import type { Envelope , ErrorEvent , Event , SpanJSON , TransactionEvent } from '../../src/types-hoist' ;
1818import * as loggerModule from '../../src/utils-hoist/logger' ;
@@ -533,7 +533,7 @@ describe('Client', () => {
533533 ) ;
534534 } ) ;
535535
536- test ( 'it adds a trace context to all events xxx ' , ( ) => {
536+ test ( 'it adds a trace context to all events' , ( ) => {
537537 expect . assertions ( 1 ) ;
538538
539539 const options = getDefaultTestClientOptions ( { dsn : PUBLIC_DSN } ) ;
@@ -1206,7 +1206,7 @@ describe('Client', () => {
12061206 const options = getDefaultTestClientOptions ( { dsn : PUBLIC_DSN , beforeSend } ) ;
12071207 const client = new TestClient ( options ) ;
12081208 const captureExceptionSpy = vi . spyOn ( client , 'captureException' ) ;
1209- const loggerWarnSpy = vi . spyOn ( loggerModule . logger , 'log' ) ;
1209+ const loggerLogSpy = vi . spyOn ( loggerModule . logger , 'log' ) ;
12101210
12111211 client . captureEvent ( { message : 'hello' } ) ;
12121212
@@ -1215,7 +1215,7 @@ describe('Client', () => {
12151215 // This proves that the reason the event didn't send/didn't get set on the test client is not because there was an
12161216 // error, but because `beforeSend` returned `null`
12171217 expect ( captureExceptionSpy ) . not . toBeCalled ( ) ;
1218- expect ( loggerWarnSpy ) . toBeCalledWith ( 'before send for type `error` returned `null`, will not send event.' ) ;
1218+ expect ( loggerLogSpy ) . toBeCalledWith ( 'before send for type `error` returned `null`, will not send event.' ) ;
12191219 } ) ;
12201220
12211221 test ( 'calls `beforeSendTransaction` and discards the event' , ( ) => {
@@ -1225,7 +1225,7 @@ describe('Client', () => {
12251225 const options = getDefaultTestClientOptions ( { dsn : PUBLIC_DSN , beforeSendTransaction } ) ;
12261226 const client = new TestClient ( options ) ;
12271227 const captureExceptionSpy = vi . spyOn ( client , 'captureException' ) ;
1228- const loggerWarnSpy = vi . spyOn ( loggerModule . logger , 'log' ) ;
1228+ const loggerLogSpy = vi . spyOn ( loggerModule . logger , 'log' ) ;
12291229
12301230 client . captureEvent ( { transaction : '/dogs/are/great' , type : 'transaction' } ) ;
12311231
@@ -1234,7 +1234,7 @@ describe('Client', () => {
12341234 // This proves that the reason the event didn't send/didn't get set on the test client is not because there was an
12351235 // error, but because `beforeSendTransaction` returned `null`
12361236 expect ( captureExceptionSpy ) . not . toBeCalled ( ) ;
1237- expect ( loggerWarnSpy ) . toBeCalledWith ( 'before send for type `transaction` returned `null`, will not send event.' ) ;
1237+ expect ( loggerLogSpy ) . toBeCalledWith ( 'before send for type `transaction` returned `null`, will not send event.' ) ;
12381238 } ) ;
12391239
12401240 test ( 'does not discard span and warn when returning null from `beforeSendSpan' , ( ) => {
@@ -1294,7 +1294,7 @@ describe('Client', () => {
12941294 expect ( beforeSend ) . toHaveBeenCalled ( ) ;
12951295 expect ( TestClient . instance ! . event ) . toBeUndefined ( ) ;
12961296 expect ( loggerWarnSpy ) . toBeCalledWith (
1297- new SentryError ( 'before send for type `error` must return `null` or a valid event.' ) ,
1297+ _makeInternalError ( 'before send for type `error` must return `null` or a valid event.' ) . message ,
12981298 ) ;
12991299 }
13001300 } ) ;
@@ -1315,7 +1315,7 @@ describe('Client', () => {
13151315 expect ( beforeSendTransaction ) . toHaveBeenCalled ( ) ;
13161316 expect ( TestClient . instance ! . event ) . toBeUndefined ( ) ;
13171317 expect ( loggerWarnSpy ) . toBeCalledWith (
1318- new SentryError ( 'before send for type `transaction` must return `null` or a valid event.' ) ,
1318+ _makeInternalError ( 'before send for type `transaction` must return `null` or a valid event.' ) . message ,
13191319 ) ;
13201320 }
13211321 } ) ;
@@ -1688,9 +1688,9 @@ describe('Client', () => {
16881688 originalException : exception ,
16891689 } ) ;
16901690 expect ( loggerWarnSpy ) . toBeCalledWith (
1691- new SentryError (
1691+ _makeInternalError (
16921692 `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${ exception } ` ,
1693- ) ,
1693+ ) . message ,
16941694 ) ;
16951695 } ) ;
16961696
0 commit comments