/
keep-all.test.ts
38 lines (32 loc) · 967 Bytes
/
keep-all.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { format } from 'prettier';
import { plugin } from 'src/index';
import { describe, expect, it } from 'vitest';
describe('Options', () => {
describe('pugCommentPreserveSpaces', () => {
const expected: string = readFileSync(
resolve(__dirname, 'formatted.pug'),
'utf8',
);
const code: string = readFileSync(
resolve(__dirname, 'unformatted.pug'),
'utf8',
);
it('should keep all spaces within comments', () => {
const actual: string = format(code, {
parser: 'pug',
plugins: [plugin],
pugCommentPreserveSpaces: 'keep-all',
});
expect(actual).toBe(expected);
});
it('should keep all spaces within comments by default', () => {
const actual: string = format(code, {
parser: 'pug',
plugins: [plugin],
});
expect(actual).toBe(expected);
});
});
});