File tree
Expand file treeCollapse file tree2 files changed
+10
-4
lines changed Expand file treeCollapse file tree2 files changed
+10
-4
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -4,8 +4,11 @@ import { format } from 'prettier';
|
4 | 4 | import * as SveltePlugin from '../../src';
|
5 | 5 |
|
6 | 6 | 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 | +); |
7 | 10 | const endsWithOnly = (f: string): boolean => f.endsWith('.only');
|
8 |
| -const hasOnly = dirs.some(endsWithOnly); |
| 11 | +const hasOnly = printerFilesHaveOnly || dirs.some(endsWithOnly); |
9 | 12 | dirs = !hasOnly ? dirs : dirs.filter(endsWithOnly);
|
10 | 13 |
|
11 | 14 | if (process.env.CI && hasOnly) {
|
|
Original file line number | Diff line number | Diff line change |
---|
|
1 | 1 | import test from 'ava';
|
2 | 2 | import { readdirSync, readFileSync, existsSync } from 'fs';
|
3 | 3 | import { format } from 'prettier';
|
4 |
| -import * as SveltePlugin from '../../src' |
| 4 | +import * as SveltePlugin from '../../src'; |
5 | 5 |
|
6 | 6 | let files = readdirSync('test/printer/samples').filter(
|
7 | 7 | (name) => name.endsWith('.html') || name.endsWith('.md'),
|
8 | 8 | );
|
| 9 | +const formattingDirsHaveOnly = readdirSync('test/formatting/samples').some((d) => |
| 10 | +d.endsWith('.only'), |
| 11 | +); |
9 | 12 | 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); |
11 | 14 | files = !hasOnly ? files : files.filter(endsWithOnly);
|
12 | 15 |
|
13 | 16 | if (process.env.CI && hasOnly) {
|
@@ -23,7 +26,7 @@ for (const file of files) {
|
23 | 26 |
|
24 | 27 | test(`printer: ${file.slice(0, file.length - `.${ending}`.length)}`, async (t) => {
|
25 | 28 | const actualOutput = await format(input, {
|
26 |
| -parser: (ending === 'html' ? 'svelte' : 'markdown'), |
| 29 | +parser: ending === 'html' ? 'svelte' : 'markdown', |
27 | 30 | plugins: [SveltePlugin],
|
28 | 31 | tabWidth: 4,
|
29 | 32 | ...options,
|
|
You can’t perform that action at this time.
0 commit comments