@@ -4,8 +4,8 @@ import * as fs from 'node:fs';
44import * as path from 'node:path' ;
55import { compile } from 'svelte/compiler' ;
66import { afterAll , assert , beforeAll , describe } from 'vitest' ;
7- import { suite , suite_with_variants , type TemplatingMode } from '../suite' ;
8- import { write } from '../helpers' ;
7+ import { suite , suite_with_variants } from '../suite' ;
8+ import { write , templatingMode } from '../helpers' ;
99import type { Warning } from '#compiler' ;
1010
1111const assert_file = path . resolve ( __dirname , 'assert.js' ) ;
@@ -35,50 +35,42 @@ const { run: run_browser_tests } = suite_with_variants<
3535 return false ;
3636 } ,
3737 ( ) => { } ,
38- async ( config , test_dir , variant , _ , templating_mode ) => {
39- await run_test ( test_dir , config , variant === 'hydrate' , templating_mode ) ;
38+ async ( config , test_dir , variant ) => {
39+ await run_test ( test_dir , config , variant === 'hydrate' ) ;
4040 }
4141) ;
4242
4343describe . concurrent (
4444 'runtime-browser' ,
45- ( ) => run_browser_tests ( __dirname , 'string' ) ,
46- // Browser tests are brittle and slow on CI
47- { timeout : 20000 , retry : process . env . CI ? 1 : 0 }
48- ) ;
49-
50- describe . concurrent (
51- 'runtime-browser-functional' ,
52- ( ) => run_browser_tests ( __dirname , 'functional' ) ,
45+ ( ) => run_browser_tests ( __dirname ) ,
5346 // Browser tests are brittle and slow on CI
5447 { timeout : 20000 , retry : process . env . CI ? 1 : 0 }
5548) ;
5649
5750const { run : run_ce_tests } = suite < ReturnType < typeof import ( './assert' ) . test > > (
58- async ( config , test_dir , templating_mode ) => {
59- await run_test ( test_dir , config , false , templating_mode ) ;
51+ async ( config , test_dir ) => {
52+ await run_test ( test_dir , config , false ) ;
6053 }
6154) ;
6255
6356describe . concurrent (
6457 'custom-elements' ,
65- ( ) => run_ce_tests ( __dirname , 'string' , ' custom-elements-samples') ,
58+ ( ) => run_ce_tests ( __dirname , 'custom-elements-samples' ) ,
6659 // Browser tests are brittle and slow on CI
6760 { timeout : 20000 , retry : process . env . CI ? 1 : 0 }
6861) ;
6962
7063describe . concurrent (
7164 'custom-elements' ,
72- ( ) => run_ce_tests ( __dirname , 'functional' , ' custom-elements-samples') ,
65+ ( ) => run_ce_tests ( __dirname , 'custom-elements-samples' ) ,
7366 // Browser tests are brittle and slow on CI
7467 { timeout : 20000 , retry : process . env . CI ? 1 : 0 }
7568) ;
7669
7770async function run_test (
7871 test_dir : string ,
7972 config : ReturnType < typeof import ( './assert' ) . test > ,
80- hydrate : boolean ,
81- templating_mode : TemplatingMode
73+ hydrate : boolean
8274) {
8375 const warnings : any [ ] = [ ] ;
8476
@@ -102,17 +94,14 @@ async function run_test(
10294 build . onLoad ( { filter : / \. s v e l t e $ / } , ( args ) => {
10395 const compiled = compile ( fs . readFileSync ( args . path , 'utf-8' ) . replace ( / \r / g, '' ) , {
10496 generate : 'client' ,
97+ templatingMode,
10598 ...config . compileOptions ,
10699 immutable : config . immutable ,
107100 customElement : test_dir . includes ( 'custom-elements-samples' ) ,
108- accessors : 'accessors' in config ? config . accessors : true ,
109- templatingMode : templating_mode
101+ accessors : 'accessors' in config ? config . accessors : true
110102 } ) ;
111103
112- write (
113- `${ test_dir } /_output/client${ templating_mode === 'functional' ? '-functional' : '' } /${ path . basename ( args . path ) } .js` ,
114- compiled . js . code
115- ) ;
104+ write ( `${ test_dir } /_output/client/${ path . basename ( args . path ) } .js` , compiled . js . code ) ;
116105
117106 compiled . warnings . forEach ( ( warning ) => {
118107 if ( warning . code === 'options_deprecated_accessors' ) return ;
@@ -121,10 +110,7 @@ async function run_test(
121110
122111 if ( compiled . css !== null ) {
123112 compiled . js . code += `document.head.innerHTML += \`<style>${ compiled . css . code } </style>\`` ;
124- write (
125- `${ test_dir } /_output/${ templating_mode === 'functional' ? '-functional' : '' } /${ path . basename ( args . path ) } .css` ,
126- compiled . css . code
127- ) ;
113+ write ( `${ test_dir } /_output/${ path . basename ( args . path ) } .css` , compiled . css . code ) ;
128114 }
129115
130116 return {
@@ -170,8 +156,7 @@ async function run_test(
170156 ...config . compileOptions ,
171157 immutable : config . immutable ,
172158 customElement : test_dir . includes ( 'custom-elements-samples' ) ,
173- accessors : 'accessors' in config ? config . accessors : true ,
174- templatingMode : templating_mode
159+ accessors : 'accessors' in config ? config . accessors : true
175160 } ) ;
176161
177162 return {
0 commit comments