1- import { describe , expect , it , vi } from 'vitest' ;
1+ import { describe , expect , it , vi , beforeEach , afterEach } from 'vitest' ;
22
33// mock helper functions not tested directly in this file
44import '../mocks' ;
@@ -14,9 +14,16 @@ import {
1414 userNextConfig ,
1515} from '../fixtures' ;
1616import { materializeFinalNextConfig , materializeFinalWebpackConfig } from '../testUtils' ;
17+ import * as core from '@sentry/core' ;
1718
1819describe ( 'constructWebpackConfigFunction()' , ( ) => {
1920 it ( 'includes expected properties' , async ( ) => {
21+ vi . spyOn ( core , 'loadModule' ) . mockImplementation ( ( ) => ( {
22+ sentryWebpackPlugin : ( ) => ( {
23+ _name : 'sentry-webpack-plugin' ,
24+ } ) ,
25+ } ) ) ;
26+
2027 const finalWebpackConfig = await materializeFinalWebpackConfig ( {
2128 exportedNextConfig,
2229 incomingWebpackConfig : serverWebpackConfig ,
@@ -49,6 +56,11 @@ describe('constructWebpackConfigFunction()', () => {
4956
5057 it ( 'automatically enables deleteSourcemapsAfterUpload for client builds when not explicitly set' , async ( ) => {
5158 const getWebpackPluginOptionsSpy = vi . spyOn ( getWebpackPluginOptionsModule , 'getWebpackPluginOptions' ) ;
59+ vi . spyOn ( core , 'loadModule' ) . mockImplementation ( ( ) => ( {
60+ sentryWebpackPlugin : ( ) => ( {
61+ _name : 'sentry-webpack-plugin' ,
62+ } ) ,
63+ } ) ) ;
5264
5365 await materializeFinalWebpackConfig ( {
5466 exportedNextConfig,
@@ -114,6 +126,12 @@ describe('constructWebpackConfigFunction()', () => {
114126 } ) ;
115127
116128 it ( 'uses `hidden-source-map` as `devtool` value for client-side builds' , async ( ) => {
129+ vi . spyOn ( core , 'loadModule' ) . mockImplementation ( ( ) => ( {
130+ sentryWebpackPlugin : ( ) => ( {
131+ _name : 'sentry-webpack-plugin' ,
132+ } ) ,
133+ } ) ) ;
134+
117135 const finalClientWebpackConfig = await materializeFinalWebpackConfig ( {
118136 exportedNextConfig : exportedNextConfig ,
119137 incomingWebpackConfig : clientWebpackConfig ,
0 commit comments