|
1 |
| -const phplint = require('./phplint'); |
| 1 | +const phplint = require("./phplint"); |
2 | 2 |
|
3 |
| -test('it returns defaults', () => { |
4 |
| - expect(phplint({}, 'web')).toEqual(['phplint', '--exclude=vendor', '--exclude=web/core', '--exclude=web/modules/contrib', '--extensions=php,module,theme,engine,inc,install']); |
| 3 | +test("it returns defaults", () => { |
| 4 | + expect(phplint({}, "web")).toEqual([ |
| 5 | + "phplint", |
| 6 | + "--exclude=vendor", |
| 7 | + "--exclude=web/core", |
| 8 | + "--exclude=web/modules/contrib", |
| 9 | + "--extensions=php", |
| 10 | + "--extensions=module", |
| 11 | + "--extensions=theme", |
| 12 | + "--extensions=engine", |
| 13 | + "--extensions=inc", |
| 14 | + "--extensions=install", |
| 15 | + ]); |
5 | 16 | });
|
6 | 17 |
|
7 |
| -test('it returns no options', () => { |
8 |
| - expect(phplint({ no_default_options: true }, 'web')).toEqual(['phplint']); |
9 |
| - expect(phplint({ |
10 |
| - no_default_options: true, |
11 |
| - exclude: 'vendor', |
12 |
| - }, 'web')).toEqual(['phplint']); |
| 18 | +test("it returns no options", () => { |
| 19 | + expect(phplint({ no_default_options: true }, "web")).toEqual(["phplint"]); |
| 20 | + expect( |
| 21 | + phplint( |
| 22 | + { |
| 23 | + no_default_options: true, |
| 24 | + exclude: "vendor", |
| 25 | + }, |
| 26 | + "web" |
| 27 | + ) |
| 28 | + ).toEqual(["phplint"]); |
13 | 29 | });
|
14 | 30 |
|
15 |
| -test('it handles partial inputs', () => { |
| 31 | +test("it handles partial inputs", () => { |
16 | 32 | let command;
|
17 |
| - command = phplint({ |
18 |
| - exclude: 'vendor,web/themes/contrib', |
19 |
| - }, 'web'); |
20 |
| - expect(command).toContain('--exclude=vendor'); |
21 |
| - expect(command).toContain('--exclude=web/themes/contrib'); |
22 |
| - expect(command).not.toContain('--exclude=web/modules/contrib'); |
| 33 | + command = phplint( |
| 34 | + { |
| 35 | + exclude: "vendor,web/themes/contrib", |
| 36 | + }, |
| 37 | + "web" |
| 38 | + ); |
| 39 | + expect(command).toContain("--exclude=vendor"); |
| 40 | + expect(command).toContain("--exclude=web/themes/contrib"); |
| 41 | + expect(command).not.toContain("--exclude=web/modules/contrib"); |
23 | 42 |
|
24 |
| - command = phplint({ |
25 |
| - extensions: 'php,inc', |
26 |
| - }, 'docroot'); |
27 |
| - expect(command).toContain('--extensions=php,inc'); |
28 |
| - expect(command).toContain('--exclude=docroot/modules/contrib'); |
| 43 | + command = phplint( |
| 44 | + { |
| 45 | + extensions: "php,inc", |
| 46 | + }, |
| 47 | + "docroot" |
| 48 | + ); |
| 49 | + expect(command).toContain("--extensions=php"); |
| 50 | + expect(command).toContain("--extensions=inc"); |
| 51 | + expect(command).not.toContain("--extensions=module"); |
| 52 | + expect(command).toContain("--exclude=docroot/modules/contrib"); |
29 | 53 |
|
30 |
| - command = phplint({ |
31 |
| - verbose: true, |
32 |
| - path: 'web/modules/custom', |
33 |
| - }, 'docroot'); |
34 |
| - expect(command).toContain('-v'); |
35 |
| - expect(command).toContain('--exclude=docroot/modules/contrib'); |
36 |
| - expect(command).toContain('web/modules/custom'); |
| 54 | + command = phplint( |
| 55 | + { |
| 56 | + verbose: true, |
| 57 | + path: "web/modules/custom", |
| 58 | + }, |
| 59 | + "docroot" |
| 60 | + ); |
| 61 | + expect(command).toContain("-v"); |
| 62 | + expect(command).toContain("--exclude=docroot/modules/contrib"); |
| 63 | + expect(command).toContain("web/modules/custom"); |
37 | 64 | });
|
0 commit comments