File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import { format } from 'prettier';
44
import * as SveltePlugin from '../../src';
55

66
let dirs = readdirSync('test/formatting/samples');
7+
const printerFilesHaveOnly = readdirSync('test/printer/samples').some(
8+
(f) => f.endsWith('.only.html') || f.endsWith('.only.md'),
9+
);
710
const endsWithOnly = (f: string): boolean => f.endsWith('.only');
8-
const hasOnly = dirs.some(endsWithOnly);
11+
const hasOnly = printerFilesHaveOnly || dirs.some(endsWithOnly);
912
dirs = !hasOnly ? dirs : dirs.filter(endsWithOnly);
1013

1114
if (process.env.CI && hasOnly) {
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import test from 'ava';
22
import { readdirSync, readFileSync, existsSync } from 'fs';
33
import { format } from 'prettier';
4-
import * as SveltePlugin from '../../src'
4+
import * as SveltePlugin from '../../src';
55

66
let 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+
);
912
const 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);
1114
files = !hasOnly ? files : files.filter(endsWithOnly);
1215

1316
if (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,

0 commit comments

Comments
 (0)