@@ -14,12 +14,12 @@ const cwd = fileURLToPath(new URL('./test', import.meta.url));
1414
1515/**
1616 * @param {string } dir
17- * @param {import('types').Config } config
17+ * @param {(code: string) => string } [prepare_expected]
1818 */
19- async function run_test ( dir , config = { } ) {
19+ async function run_test ( dir , prepare_expected = ( code ) => code ) {
2020 rimraf ( path . join ( cwd , dir , '.svelte-kit' ) ) ;
2121
22- const initial = options ( config , 'config' ) ;
22+ const initial = options ( { } , 'config' ) ;
2323
2424 initial . kit . files . assets = path . resolve ( cwd , 'static' ) ;
2525 initial . kit . files . params = path . resolve ( cwd , 'params' ) ;
@@ -56,7 +56,7 @@ async function run_test(dir, config = {}) {
5656 parser : 'typescript'
5757 } ) ;
5858 const err_msg = `Expected equal file contents for ${ file } in ${ dir } ` ;
59- assert . fixture ( actual , expected , err_msg ) ;
59+ assert . fixture ( actual , prepare_expected ( expected ) , err_msg ) ;
6060 }
6161}
6262
@@ -81,7 +81,15 @@ test('Create $types for grouped layout and page', async () => {
8181} ) ;
8282
8383test ( 'Create $types with params' , async ( ) => {
84- await run_test ( 'slugs' ) ;
84+ await run_test ( 'slugs' , ( code ) =>
85+ // For some reason, the order of the params differentiates between windows and mac/linux
86+ process . platform === 'win32'
87+ ? code . replace (
88+ 'rest?: string; slug?: string; optional?: string' ,
89+ 'optional?: string; rest?: string; slug?: string'
90+ )
91+ : code
92+ ) ;
8593} ) ;
8694
8795test ( 'Create $types with params and required return types for layout' , async ( ) => {
0 commit comments