@@ -3161,6 +3161,7 @@ describe.each([
31613161
31623162 describe ( "should handle custom fs errors and response 500 code without `fs.createReadStream`" , ( ) => {
31633163 let compiler ;
3164+ // Try to disable this
31643165
31653166 const outputPath = path . resolve (
31663167 __dirname ,
@@ -4004,83 +4005,87 @@ describe.each([
40044005 } ) ;
40054006
40064007 describe ( "writeToDisk option" , ( ) => {
4007- describe ( 'should work with "true" value' , ( ) => {
4008- let compiler ;
4008+ ( name === "hono" ? describe . only : describe ) (
4009+ 'should work with "true" value' ,
4010+ ( ) => {
4011+ let compiler ;
40094012
4010- const outputPath = path . resolve (
4011- __dirname ,
4012- "./outputs/write-to-disk-true" ,
4013- ) ;
4013+ const outputPath = path . resolve (
4014+ __dirname ,
4015+ "./outputs/write-to-disk-true" ,
4016+ ) ;
40144017
4015- beforeAll ( async ( ) => {
4016- compiler = getCompiler ( {
4017- ...webpackConfig ,
4018- output : {
4019- filename : "bundle.js" ,
4020- path : outputPath ,
4021- publicPath : "/public/" ,
4022- } ,
4023- } ) ;
4018+ beforeAll ( async ( ) => {
4019+ compiler = getCompiler ( {
4020+ ...webpackConfig ,
4021+ output : {
4022+ filename : "bundle.js" ,
4023+ path : outputPath ,
4024+ publicPath : "/public/" ,
4025+ } ,
4026+ } ) ;
40244027
4025- [ server , req , instance ] = await frameworkFactory (
4026- name ,
4027- framework ,
4028- compiler ,
4029- { writeToDisk : true } ,
4030- ) ;
4031- } ) ;
4028+ [ server , req , instance ] = await frameworkFactory (
4029+ name ,
4030+ framework ,
4031+ compiler ,
4032+ { writeToDisk : true } ,
4033+ ) ;
4034+ } ) ;
40324035
4033- afterAll ( async ( ) => {
4034- await fs . promises . rm ( outputPath , {
4035- recursive : true ,
4036- force : true ,
4036+ afterAll ( async ( ) => {
4037+ await fs . promises . rm ( outputPath , {
4038+ recursive : true ,
4039+ force : true ,
4040+ } ) ;
4041+ await close ( server , instance ) ;
40374042 } ) ;
4038- await close ( server , instance ) ;
4039- } ) ;
40404043
4041- it ( "should find the bundle file on disk" , ( done ) => {
4042- req . get ( "/public/bundle.js" ) . expect ( 200 , ( error ) => {
4043- if ( error ) {
4044- return done ( error ) ;
4045- }
4044+ it ( "should find the bundle file on disk" , ( done ) => {
4045+ req . get ( "/public/bundle.js" ) . expect ( 200 , ( error ) => {
4046+ if ( error ) {
4047+ return done ( error ) ;
4048+ }
40464049
4047- const bundlePath = path . resolve (
4048- __dirname ,
4049- "./outputs/write-to-disk-true/bundle.js" ,
4050- ) ;
4050+ const bundlePath = path . resolve (
4051+ __dirname ,
4052+ "./outputs/write-to-disk-true/bundle.js" ,
4053+ ) ;
40514054
4052- expect (
4053- compiler . hooks . assetEmitted . taps . filter (
4054- ( hook ) => hook . name === "DevMiddleware" ,
4055- ) ,
4056- ) . toHaveLength ( 1 ) ;
4057- expect ( fs . existsSync ( bundlePath ) ) . toBe ( true ) ;
4055+ expect (
4056+ compiler . hooks . assetEmitted . taps . filter (
4057+ ( hook ) => hook . name === "DevMiddleware" ,
4058+ ) ,
4059+ ) . toHaveLength ( 1 ) ;
4060+ expect ( fs . existsSync ( bundlePath ) ) . toBe ( true ) ;
40584061
4059- instance . invalidate ( ) ;
4062+ instance . invalidate ( ) ;
40604063
4061- return compiler . hooks . done . tap (
4062- "DevMiddlewareWriteToDiskTest" ,
4063- ( ) => {
4064- expect (
4065- compiler . hooks . assetEmitted . taps . filter (
4066- ( hook ) => hook . name === "DevMiddleware" ,
4067- ) ,
4068- ) . toHaveLength ( 1 ) ;
4064+ return compiler . hooks . done . tap (
4065+ "DevMiddlewareWriteToDiskTest" ,
4066+ ( ) => {
4067+ expect (
4068+ compiler . hooks . assetEmitted . taps . filter (
4069+ ( hook ) => hook . name === "DevMiddleware" ,
4070+ ) ,
4071+ ) . toHaveLength ( 1 ) ;
40694072
4070- done ( ) ;
4071- } ,
4072- ) ;
4073+ done ( ) ;
4074+ } ,
4075+ ) ;
4076+ } ) ;
40734077 } ) ;
4074- } ) ;
40754078
4076- it ( "should not allow to get files above root" , async ( ) => {
4077- const response = await req . get ( "/public/..%2f../middleware.test.js" ) ;
4079+ it ( "should not allow to get files above root" , async ( ) => {
4080+ const response = await req . get (
4081+ "/public/..%2f../middleware.test.js" ,
4082+ ) ;
40784083
4079- expect ( response . statusCode ) . toBe ( 403 ) ;
4080- expect ( response . headers [ "content-type" ] ) . toBe (
4081- "text/html; charset=utf-8" ,
4082- ) ;
4083- expect ( response . text ) . toBe ( `<!DOCTYPE html>
4084+ expect ( response . statusCode ) . toBe ( 403 ) ;
4085+ expect ( response . headers [ "content-type" ] ) . toBe (
4086+ "text/html; charset=utf-8" ,
4087+ ) ;
4088+ expect ( response . text ) . toBe ( `<!DOCTYPE html>
40844089<html lang="en">
40854090<head>
40864091<meta charset="utf-8">
@@ -4090,8 +4095,9 @@ describe.each([
40904095<pre>Forbidden</pre>
40914096</body>
40924097</html>` ) ;
4093- } ) ;
4094- } ) ;
4098+ } ) ;
4099+ } ,
4100+ ) ;
40954101
40964102 describe ( 'should work with "true" value when the `output.clean` is `true`' , ( ) => {
40974103 const outputPath = path . resolve (
0 commit comments