@@ -105,15 +105,15 @@ test.describe('build-stable-chunks', () => {
105105 const root = 'examples/basic'
106106 const createEditor = useCreateEditor ( root )
107107
108- test ( 'basic' , async ( ) => {
108+ test . only ( 'basic' , async ( ) => {
109109 // 1st build
110110 await x ( 'pnpm' , [ 'build' ] , {
111111 throwOnError : true ,
112112 nodeOptions : {
113113 cwd : root ,
114114 } ,
115115 } )
116- const manifest1 = JSON . parse (
116+ const manifest1 : import ( 'vite' ) . Manifest = JSON . parse (
117117 createEditor ( 'dist/client/.vite/manifest.json' ) . read ( ) ,
118118 )
119119
@@ -128,15 +128,26 @@ test.describe('build-stable-chunks', () => {
128128 cwd : root ,
129129 } ,
130130 } )
131- const manifest2 = JSON . parse (
131+ const manifest2 : import ( 'vite' ) . Manifest = JSON . parse (
132132 createEditor ( 'dist/client/.vite/manifest.json' ) . read ( ) ,
133133 )
134134
135135 // compare two mainfest.json
136- console . log ( {
137- manifest1,
138- manifest2,
139- } )
136+ const files1 = new Set ( Object . values ( manifest1 ) . map ( ( v ) => v . file ) )
137+ const files2 = new Set ( Object . values ( manifest2 ) . map ( ( v ) => v . file ) )
138+ const oldChunks = Object . entries ( manifest2 )
139+ . filter ( ( [ _k , v ] ) => ! files1 . has ( v . file ) )
140+ . map ( ( [ k ] ) => k )
141+ . sort ( )
142+ const newChunks = Object . entries ( manifest1 )
143+ . filter ( ( [ _k , v ] ) => ! files2 . has ( v . file ) )
144+ . map ( ( [ k ] ) => k )
145+ . sort ( )
146+ expect ( newChunks ) . toEqual ( [
147+ 'src/framework/entry.browser.tsx' ,
148+ 'src/routes/client.tsx' ,
149+ ] )
150+ expect ( oldChunks ) . toEqual ( newChunks )
140151 } )
141152} )
142153
0 commit comments