File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -279,8 +279,8 @@ function containsSolidField(fields: Record<string, any>) {
279
279
return false ;
280
280
}
281
281
282
- function getJestDomExport ( test : { setupFiles : string [ ] } ) {
283
- return ( test . setupFiles || [ ] ) . some ( ( path ) => / j e s t - d o m / . test ( path ) )
282
+ function getJestDomExport ( setupFiles : string [ ] ) {
283
+ return ( setupFiles || [ ] ) . some ( ( path ) => / j e s t - d o m / . test ( path ) )
284
284
? undefined
285
285
: [ '@testing-library/jest-dom/vitest' , '@testing-library/jest-dom/extend-expect' ] . find (
286
286
( path ) => {
@@ -328,13 +328,19 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
328
328
329
329
const test = ( userConfig as any ) . test || { } ;
330
330
331
+ // to simplify the processing of the config, we normalize the setupFiles to an array
332
+ const userSetupFiles : string [ ] =
333
+ typeof test . setupFiles === 'string' ? [ test . setupFiles ] : test . setupFiles || [ ] ;
334
+
331
335
if ( userConfig . mode === 'test' ) {
332
336
if ( ! test . environment && ! options . ssr ) {
333
337
test . environment = 'jsdom' ;
334
338
}
335
- const jestDomImport = getJestDomExport ( test ) ;
339
+
340
+ const jestDomImport = getJestDomExport ( userSetupFiles ) ;
341
+
336
342
if ( jestDomImport ) {
337
- test . setupFiles = [ ...( test . setupFiles || [ ] ) , require . resolve ( jestDomImport ) ] ;
343
+ test . setupFiles = [ ...userSetupFiles , require . resolve ( jestDomImport ) ] ;
338
344
}
339
345
}
340
346
You can’t perform that action at this time.
0 commit comments