@@ -45,7 +45,7 @@ describe('makeCopyInstrumentationFilePlugin()', () => {
4545 it ( 'detects Nitro environment and reads output dir' , ( ) => {
4646 const resolvedConfig = {
4747 root : '/project' ,
48- plugins : [ ] ,
48+ plugins : [ { name : 'nitro' } ] ,
4949 environments : {
5050 nitro : {
5151 build : {
@@ -71,7 +71,7 @@ describe('makeCopyInstrumentationFilePlugin()', () => {
7171 it ( 'detects Nitro environment with array rollup output' , ( ) => {
7272 const resolvedConfig = {
7373 root : '/project' ,
74- plugins : [ ] ,
74+ plugins : [ { name : 'nitro' } ] ,
7575 environments : {
7676 nitro : {
7777 build : {
@@ -94,7 +94,7 @@ describe('makeCopyInstrumentationFilePlugin()', () => {
9494 it ( 'detects Cloudflare plugin and sets dist/server as output dir' , ( ) => {
9595 const resolvedConfig = {
9696 root : '/project' ,
97- plugins : [ { name : 'vite-plugin- cloudflare' } ] ,
97+ plugins : [ { name : 'cloudflare' } ] ,
9898 } as unknown as ResolvedConfig ;
9999
100100 ( plugin . configResolved as AnyFunction ) ( resolvedConfig ) ;
@@ -108,7 +108,7 @@ describe('makeCopyInstrumentationFilePlugin()', () => {
108108 it ( 'detects Netlify plugin and sets dist/server as output dir' , ( ) => {
109109 const resolvedConfig = {
110110 root : '/project' ,
111- plugins : [ { name : 'netlify-plugin ' } ] ,
111+ plugins : [ { name : 'netlify' } ] ,
112112 } as unknown as ResolvedConfig ;
113113
114114 ( plugin . configResolved as AnyFunction ) ( resolvedConfig ) ;
@@ -125,19 +125,42 @@ describe('makeCopyInstrumentationFilePlugin()', () => {
125125 plugins : [ { name : 'some-other-plugin' } ] ,
126126 } as unknown as ResolvedConfig ;
127127
128+ const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
129+
128130 ( plugin . configResolved as AnyFunction ) ( resolvedConfig ) ;
129131
130132 ( plugin . closeBundle as AnyFunction ) ( ) ;
131133
132134 expect ( fs . promises . access ) . not . toHaveBeenCalled ( ) ;
135+
136+ warnSpy . mockRestore ( ) ;
137+ } ) ;
138+
139+ it ( 'logs a warning when no recognized deployment plugin is detected' , ( ) => {
140+ const resolvedConfig = {
141+ root : '/project' ,
142+ plugins : [ { name : 'some-other-plugin' } ] ,
143+ } as unknown as ResolvedConfig ;
144+
145+ const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
146+
147+ ( plugin . configResolved as AnyFunction ) ( resolvedConfig ) ;
148+
149+ expect ( warnSpy ) . toHaveBeenCalledWith (
150+ '[Sentry TanStack Start] Could not determine server output directory. ' +
151+ 'Could not detect nitro, cloudflare, or netlify vite plugin. ' +
152+ 'The instrument.server.mjs file will not be copied to the build output automatically.' ,
153+ ) ;
154+
155+ warnSpy . mockRestore ( ) ;
133156 } ) ;
134157 } ) ;
135158
136159 describe ( 'closeBundle' , ( ) => {
137160 it ( 'copies instrumentation file when it exists and output dir is set' , async ( ) => {
138161 const resolvedConfig = {
139162 root : '/project' ,
140- plugins : [ ] ,
163+ plugins : [ { name : 'nitro' } ] ,
141164 environments : {
142165 nitro : {
143166 build : {
@@ -176,18 +199,22 @@ describe('makeCopyInstrumentationFilePlugin()', () => {
176199 plugins : [ { name : 'some-other-plugin' } ] ,
177200 } as unknown as ResolvedConfig ;
178201
202+ const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
203+
179204 ( plugin . configResolved as AnyFunction ) ( resolvedConfig ) ;
180205
181206 await ( plugin . closeBundle as AnyFunction ) ( ) ;
182207
183208 expect ( fs . promises . access ) . not . toHaveBeenCalled ( ) ;
184209 expect ( fs . promises . copyFile ) . not . toHaveBeenCalled ( ) ;
210+
211+ warnSpy . mockRestore ( ) ;
185212 } ) ;
186213
187214 it ( 'does nothing when instrumentation file does not exist' , async ( ) => {
188215 const resolvedConfig = {
189216 root : '/project' ,
190- plugins : [ ] ,
217+ plugins : [ { name : 'nitro' } ] ,
191218 environments : {
192219 nitro : {
193220 build : {
@@ -214,7 +241,7 @@ describe('makeCopyInstrumentationFilePlugin()', () => {
214241 it ( 'logs a warning when copy fails' , async ( ) => {
215242 const resolvedConfig = {
216243 root : '/project' ,
217- plugins : [ ] ,
244+ plugins : [ { name : 'nitro' } ] ,
218245 environments : {
219246 nitro : {
220247 build : {
0 commit comments