File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,11 @@ import { format } from 'prettier';
44import * as SveltePlugin from '../../src' ;
55
66let dirs = readdirSync ( 'test/formatting/samples' ) ;
7+ const printerFilesHaveOnly = readdirSync ( 'test/printer/samples' ) . some (
8+ ( f ) => f . endsWith ( '.only.html' ) || f . endsWith ( '.only.md' ) ,
9+ ) ;
710const endsWithOnly = ( f : string ) : boolean => f . endsWith ( '.only' ) ;
8- const hasOnly = dirs . some ( endsWithOnly ) ;
11+ const hasOnly = printerFilesHaveOnly || dirs . some ( endsWithOnly ) ;
912dirs = ! hasOnly ? dirs : dirs . filter ( endsWithOnly ) ;
1013
1114if ( process . env . CI && hasOnly ) {
Original file line number Diff line number Diff line change 11import test from 'ava' ;
22import { readdirSync , readFileSync , existsSync } from 'fs' ;
33import { format } from 'prettier' ;
4- import * as SveltePlugin from '../../src'
4+ import * as SveltePlugin from '../../src' ;
55
66let files = readdirSync ( 'test/printer/samples' ) . filter (
77 ( name ) => name . endsWith ( '.html' ) || name . endsWith ( '.md' ) ,
88) ;
9+ const formattingDirsHaveOnly = readdirSync ( 'test/formatting/samples' ) . some ( ( d ) =>
10+ d . endsWith ( '.only' ) ,
11+ ) ;
912const endsWithOnly = ( f : string ) : boolean => f . endsWith ( '.only.html' ) || f . endsWith ( '.only.md' ) ;
10- const hasOnly = files . some ( endsWithOnly ) ;
13+ const hasOnly = formattingDirsHaveOnly || files . some ( endsWithOnly ) ;
1114files = ! hasOnly ? files : files . filter ( endsWithOnly ) ;
1215
1316if ( process . env . CI && hasOnly ) {
@@ -23,7 +26,7 @@ for (const file of files) {
2326
2427 test ( `printer: ${ file . slice ( 0 , file . length - `.${ ending } ` . length ) } ` , async ( t ) => {
2528 const actualOutput = await format ( input , {
26- parser : ( ending === 'html' ? 'svelte' : 'markdown' ) ,
29+ parser : ending === 'html' ? 'svelte' : 'markdown' ,
2730 plugins : [ SveltePlugin ] ,
2831 tabWidth : 4 ,
2932 ...options ,
You can’t perform that action at this time.
0 commit comments