|
1 | | -'use strict'; |
| 1 | +"use strict"; |
2 | 2 |
|
3 | | -const fs = require('fs'); |
4 | | -const path = require('path'); |
5 | | -const childProcess = require('child_process'); |
| 3 | +const fs = require("fs"); |
| 4 | +const path = require("path"); |
| 5 | +const childProcess = require("child_process"); |
6 | 6 |
|
7 | | -describe('config', () => { |
8 | | - it('samples does not causes errors without eslint-config-typescript/prettier', () => { |
| 7 | +describe("config", () => { |
| 8 | + it("samples does not causes errors without eslint-config-typescript/prettier", () => { |
9 | 9 | const result = childProcess.spawnSync( |
10 | | - 'npm', |
| 10 | + "npm", |
11 | 11 | [ |
12 | | - 'run', |
13 | | - 'test:spec', |
14 | | - '--silent', |
15 | | - '--', |
16 | | - '--no-ignore', |
17 | | - '--config', |
18 | | - './specs/configs/base.js', |
19 | | - './specs/samples/prettier.ts' |
| 12 | + "run", |
| 13 | + "test:spec", |
| 14 | + "--silent", |
| 15 | + "--", |
| 16 | + "--no-ignore", |
| 17 | + "--config", |
| 18 | + "./specs/configs/base.js", |
| 19 | + "./specs/samples/prettier.ts" |
20 | 20 | ], |
21 | | - { encoding: 'utf8' } |
| 21 | + { encoding: "utf8" } |
22 | 22 | ); |
23 | 23 | const output = JSON.parse( |
24 | | - result.stdout.substring(result.stdout.indexOf('[')) |
| 24 | + result.stdout.substring(result.stdout.indexOf("[")) |
25 | 25 | ); |
26 | 26 |
|
27 | 27 | expect(output.length).toBe(1); |
28 | 28 | expect(output[0].messages.length).toBe(0); |
29 | 29 | }); |
30 | 30 |
|
31 | | - it('samples causes errors with eslint-config-typescript/prettier', () => { |
| 31 | + it("samples causes errors with eslint-config-typescript/prettier", () => { |
32 | 32 | const result = childProcess.spawnSync( |
33 | | - 'npm', |
| 33 | + "npm", |
34 | 34 | [ |
35 | | - 'run', |
36 | | - 'test:spec', |
37 | | - '--silent', |
38 | | - '--', |
39 | | - '--no-ignore', |
40 | | - '--config', |
41 | | - './specs/configs/prettier.js', |
42 | | - './specs/samples/prettier.ts' |
| 35 | + "run", |
| 36 | + "test:spec", |
| 37 | + "--silent", |
| 38 | + "--", |
| 39 | + "--no-ignore", |
| 40 | + "--config", |
| 41 | + "./specs/configs/prettier.js", |
| 42 | + "./specs/samples/prettier.ts" |
43 | 43 | ], |
44 | | - { encoding: 'utf8' } |
| 44 | + { encoding: "utf8" } |
45 | 45 | ); |
46 | 46 | const output = JSON.parse( |
47 | | - result.stdout.substring(result.stdout.indexOf('[')) |
| 47 | + result.stdout.substring(result.stdout.indexOf("[")) |
48 | 48 | ); |
49 | 49 |
|
50 | 50 | expect(output.length).toBe(1); |
51 | 51 | expect(output[0].messages.length).toBe(1); |
52 | 52 | }); |
53 | 53 |
|
54 | | - it('returns all rules', () => { |
55 | | - const config = require('../prettier'); |
| 54 | + it("returns all rules", () => { |
| 55 | + const config = require("../prettier"); |
56 | 56 |
|
57 | 57 | expect(config).toBeDefined(); |
58 | | - expect(config.extends).toContain('prettier'); |
59 | | - expect(config.extends).toContain('prettier/react'); |
60 | | - expect(config.plugins).toContain('prettier'); |
| 58 | + expect(config.extends).toContain("prettier"); |
| 59 | + expect(config.extends).toContain("prettier/react"); |
| 60 | + expect(config.plugins).toContain("prettier"); |
61 | 61 | expect(config.rules).toBeDefined(); |
62 | | - expect(config.rules['prettier/prettier']).toBeDefined(); |
63 | | - expect(config.rules['prettier/prettier'][0]).toBe('error'); |
64 | | - expect(config.rules['prettier/prettier'][1]).toMatchObject({ |
65 | | - parser: 'typescript' |
| 62 | + expect(config.rules["prettier/prettier"]).toBeDefined(); |
| 63 | + expect(config.rules["prettier/prettier"][0]).toBe("error"); |
| 64 | + expect(config.rules["prettier/prettier"][1]).toMatchObject({ |
| 65 | + parser: "typescript" |
66 | 66 | }); |
67 | 67 | }); |
68 | 68 | }); |
0 commit comments