@@ -19,17 +19,20 @@ import {
1919 GEN_AI_USAGE_TOTAL_TOKENS ,
2020} from '@sentry/conventions/attributes' ;
2121import { afterAll , describe , expect } from 'vitest' ;
22- import { cleanupChildProcesses , createEsmAndCjsTests } from '../../../utils/runner' ;
22+ import { cleanupChildProcesses , createEsmTests } from '../../../utils/runner' ;
2323
2424const PROVIDER = 'mistral' ;
2525const ORIGIN = 'auto.ai.mistral' ;
2626
27+ // ESM-only: `@mistralai/mistralai` v2 ships no CJS build, so CJS consumers load it via `require(esm)`,
28+ // whose auto-instrumentation is inconsistent across Node versions. The SDK's native mode is ESM, so we
29+ // only run the suite there.
2730describe ( 'Mistral integration' , ( ) => {
2831 afterAll ( ( ) => {
2932 cleanupChildProcesses ( ) ;
3033 } ) ;
3134
32- createEsmAndCjsTests ( __dirname , 'scenario-chat.mjs' , 'instrument.mjs' , ( createRunner , test ) => {
35+ createEsmTests ( __dirname , 'scenario-chat.mjs' , 'instrument.mjs' , ( createRunner , test ) => {
3336 test ( 'creates chat spans with genAI recording disabled' , async ( ) => {
3437 await createRunner ( )
3538 . expect ( {
@@ -69,7 +72,7 @@ describe('Mistral integration', () => {
6972 } ) ;
7073 } ) ;
7174
72- createEsmAndCjsTests ( __dirname , 'scenario-chat.mjs' , 'instrument-with-pii.mjs' , ( createRunner , test ) => {
75+ createEsmTests ( __dirname , 'scenario-chat.mjs' , 'instrument-with-pii.mjs' , ( createRunner , test ) => {
7376 test ( 'records chat inputs and outputs with PII enabled' , async ( ) => {
7477 await createRunner ( )
7578 . expect ( {
@@ -89,7 +92,7 @@ describe('Mistral integration', () => {
8992 } ) ;
9093 } ) ;
9194
92- createEsmAndCjsTests ( __dirname , 'scenario-chat.mjs' , 'instrument-with-options.mjs' , ( createRunner , test ) => {
95+ createEsmTests ( __dirname , 'scenario-chat.mjs' , 'instrument-with-options.mjs' , ( createRunner , test ) => {
9396 test ( 'records chat inputs and outputs with explicit integration options' , async ( ) => {
9497 await createRunner ( )
9598 . expect ( {
@@ -105,7 +108,7 @@ describe('Mistral integration', () => {
105108 } ) ;
106109 } ) ;
107110
108- createEsmAndCjsTests ( __dirname , 'scenario-embeddings.mjs' , 'instrument.mjs' , ( createRunner , test ) => {
111+ createEsmTests ( __dirname , 'scenario-embeddings.mjs' , 'instrument.mjs' , ( createRunner , test ) => {
109112 test ( 'creates embeddings spans' , async ( ) => {
110113 await createRunner ( )
111114 . expect ( {
@@ -131,7 +134,7 @@ describe('Mistral integration', () => {
131134 } ) ;
132135 } ) ;
133136
134- createEsmAndCjsTests ( __dirname , 'scenario-embeddings.mjs' , 'instrument-with-pii.mjs' , ( createRunner , test ) => {
137+ createEsmTests ( __dirname , 'scenario-embeddings.mjs' , 'instrument-with-pii.mjs' , ( createRunner , test ) => {
135138 test ( 'records embeddings input with PII enabled' , async ( ) => {
136139 await createRunner ( )
137140 . expect ( {
@@ -148,7 +151,7 @@ describe('Mistral integration', () => {
148151 } ) ;
149152 } ) ;
150153
151- createEsmAndCjsTests ( __dirname , 'scenario-agents.mjs' , 'instrument.mjs' , ( createRunner , test ) => {
154+ createEsmTests ( __dirname , 'scenario-agents.mjs' , 'instrument.mjs' , ( createRunner , test ) => {
152155 test ( 'creates invoke_agent spans' , async ( ) => {
153156 await createRunner ( )
154157 . expect ( {
@@ -179,7 +182,7 @@ describe('Mistral integration', () => {
179182 } ) ;
180183 } ) ;
181184
182- createEsmAndCjsTests ( __dirname , 'scenario-agents.mjs' , 'instrument-with-pii.mjs' , ( createRunner , test ) => {
185+ createEsmTests ( __dirname , 'scenario-agents.mjs' , 'instrument-with-pii.mjs' , ( createRunner , test ) => {
183186 test ( 'records agent inputs and outputs with PII enabled' , async ( ) => {
184187 await createRunner ( )
185188 . expect ( {
0 commit comments