|
1 | | -const __dirname = import.meta.dirname; |
2 | | - |
3 | 1 | const config = { |
4 | 2 | order: ['declarations', 'rules'], |
5 | 3 | }; |
6 | 4 |
|
7 | 5 | test('Should not remove comments in rules if they are only children', () => |
8 | | - runTest('rules-with-comments-only', config, __dirname)); |
| 6 | + runTest('rules-with-comments-only', config)); |
9 | 7 |
|
10 | 8 | test(`Should not remove first comment in the rule if it's not on separate line (order)`, () => |
11 | | - runTest('first-comment-in-the-rule', config, __dirname)); |
| 9 | + runTest('first-comment-in-the-rule', config)); |
12 | 10 |
|
13 | | -test('Should not remove last comments in the rule', () => |
14 | | - runTest('last-comments', config, __dirname)); |
| 11 | +test('Should not remove last comments in the rule', () => runTest('last-comments', config)); |
15 | 12 |
|
16 | 13 | test('Should assign comments before and after nodes correctly (order)', () => |
17 | | - runTest( |
18 | | - 'nodes-comments.css', |
19 | | - { |
20 | | - order: ['custom-properties', 'dollar-variables', 'at-variables', 'declarations'], |
21 | | - }, |
22 | | - __dirname, |
23 | | - )); |
| 14 | + runTest('nodes-comments.css', { |
| 15 | + order: ['custom-properties', 'dollar-variables', 'at-variables', 'declarations'], |
| 16 | + })); |
24 | 17 |
|
25 | 18 | test('Should sort by keywords', () => |
26 | | - runTest( |
27 | | - 'keywords', |
28 | | - { |
29 | | - order: [ |
30 | | - 'custom-properties', |
31 | | - 'dollar-variables', |
32 | | - 'at-variables', |
33 | | - 'declarations', |
34 | | - 'rules', |
35 | | - 'at-rules', |
36 | | - ], |
37 | | - }, |
38 | | - __dirname, |
39 | | - )); |
| 19 | + runTest('keywords', { |
| 20 | + order: [ |
| 21 | + 'custom-properties', |
| 22 | + 'dollar-variables', |
| 23 | + 'at-variables', |
| 24 | + 'declarations', |
| 25 | + 'rules', |
| 26 | + 'at-rules', |
| 27 | + ], |
| 28 | + })); |
40 | 29 |
|
41 | 30 | test('At-rules combination from most specified to least specified', () => |
42 | | - runTest( |
43 | | - 'at-rules', |
44 | | - { |
45 | | - order: [ |
46 | | - { |
47 | | - type: 'at-rule', |
48 | | - name: 'include', |
49 | | - parameter: 'media', |
50 | | - hasBlock: true, |
51 | | - }, |
52 | | - { |
53 | | - type: 'at-rule', |
54 | | - name: 'include', |
55 | | - parameter: 'media', |
56 | | - }, |
57 | | - { |
58 | | - type: 'at-rule', |
59 | | - name: 'include', |
60 | | - hasBlock: true, |
61 | | - }, |
62 | | - { |
63 | | - type: 'at-rule', |
64 | | - name: 'include', |
65 | | - }, |
66 | | - { |
67 | | - type: 'at-rule', |
68 | | - hasBlock: true, |
69 | | - }, |
70 | | - { |
71 | | - type: 'at-rule', |
72 | | - }, |
73 | | - ], |
74 | | - }, |
75 | | - __dirname, |
76 | | - )); |
| 31 | + runTest('at-rules', { |
| 32 | + order: [ |
| 33 | + { |
| 34 | + type: 'at-rule', |
| 35 | + name: 'include', |
| 36 | + parameter: 'media', |
| 37 | + hasBlock: true, |
| 38 | + }, |
| 39 | + { |
| 40 | + type: 'at-rule', |
| 41 | + name: 'include', |
| 42 | + parameter: 'media', |
| 43 | + }, |
| 44 | + { |
| 45 | + type: 'at-rule', |
| 46 | + name: 'include', |
| 47 | + hasBlock: true, |
| 48 | + }, |
| 49 | + { |
| 50 | + type: 'at-rule', |
| 51 | + name: 'include', |
| 52 | + }, |
| 53 | + { |
| 54 | + type: 'at-rule', |
| 55 | + hasBlock: true, |
| 56 | + }, |
| 57 | + { |
| 58 | + type: 'at-rule', |
| 59 | + }, |
| 60 | + ], |
| 61 | + })); |
77 | 62 |
|
78 | 63 | test('At-rules mixed combination', () => |
79 | | - runTest( |
80 | | - 'at-rules-mixed', |
81 | | - { |
82 | | - order: [ |
83 | | - { |
84 | | - type: 'at-rule', |
85 | | - name: 'include', |
86 | | - hasBlock: true, |
87 | | - }, |
88 | | - { |
89 | | - type: 'at-rule', |
90 | | - name: 'include', |
91 | | - }, |
92 | | - { |
93 | | - type: 'at-rule', |
94 | | - hasBlock: true, |
95 | | - }, |
96 | | - { |
97 | | - type: 'at-rule', |
98 | | - name: 'include', |
99 | | - parameter: 'media', |
100 | | - }, |
101 | | - { |
102 | | - type: 'at-rule', |
103 | | - name: 'include', |
104 | | - parameter: 'media', |
105 | | - hasBlock: true, |
106 | | - }, |
107 | | - ], |
108 | | - }, |
109 | | - __dirname, |
110 | | - )); |
| 64 | + runTest('at-rules-mixed', { |
| 65 | + order: [ |
| 66 | + { |
| 67 | + type: 'at-rule', |
| 68 | + name: 'include', |
| 69 | + hasBlock: true, |
| 70 | + }, |
| 71 | + { |
| 72 | + type: 'at-rule', |
| 73 | + name: 'include', |
| 74 | + }, |
| 75 | + { |
| 76 | + type: 'at-rule', |
| 77 | + hasBlock: true, |
| 78 | + }, |
| 79 | + { |
| 80 | + type: 'at-rule', |
| 81 | + name: 'include', |
| 82 | + parameter: 'media', |
| 83 | + }, |
| 84 | + { |
| 85 | + type: 'at-rule', |
| 86 | + name: 'include', |
| 87 | + parameter: 'media', |
| 88 | + hasBlock: true, |
| 89 | + }, |
| 90 | + ], |
| 91 | + })); |
111 | 92 |
|
112 | 93 | test('Should sort inside nested rules', () => |
113 | | - runTest( |
114 | | - 'nested-rule', |
115 | | - { |
116 | | - order: ['custom-properties', 'declarations', 'rules'], |
117 | | - }, |
118 | | - __dirname, |
119 | | - )); |
| 94 | + runTest('nested-rule', { |
| 95 | + order: ['custom-properties', 'declarations', 'rules'], |
| 96 | + })); |
120 | 97 |
|
121 | 98 | test('Should sort inside nested at-rules', () => |
122 | | - runTest( |
123 | | - 'nested-at-rule', |
124 | | - { |
125 | | - order: ['custom-properties', 'declarations', 'at-rules'], |
126 | | - }, |
127 | | - __dirname, |
128 | | - )); |
| 99 | + runTest('nested-at-rule', { |
| 100 | + order: ['custom-properties', 'declarations', 'at-rules'], |
| 101 | + })); |
129 | 102 |
|
130 | 103 | test('Should move unspecified nodes to the bottom', () => |
131 | | - runTest( |
132 | | - 'unspecified-nodes', |
133 | | - { |
134 | | - order: ['custom-properties', 'declarations'], |
135 | | - }, |
136 | | - __dirname, |
137 | | - )); |
| 104 | + runTest('unspecified-nodes', { |
| 105 | + order: ['custom-properties', 'declarations'], |
| 106 | + })); |
138 | 107 |
|
139 | 108 | test('Should preserve indentation', () => |
140 | | - runTest( |
141 | | - 'indent', |
142 | | - { |
143 | | - order: ['declarations', 'rules', 'at-rules'], |
144 | | - }, |
145 | | - __dirname, |
146 | | - )); |
| 109 | + runTest('indent', { |
| 110 | + order: ['declarations', 'rules', 'at-rules'], |
| 111 | + })); |
147 | 112 |
|
148 | 113 | groupTest([ |
149 | 114 | { |
@@ -610,19 +575,11 @@ groupTest([ |
610 | 575 | ]); |
611 | 576 |
|
612 | 577 | test('Should sort by keywords (styled)', () => |
613 | | - runTest( |
614 | | - 'keywords.js', |
615 | | - { |
616 | | - order: ['declarations', 'rules', 'at-rules'], |
617 | | - }, |
618 | | - __dirname, |
619 | | - )); |
| 578 | + runTest('keywords.js', { |
| 579 | + order: ['declarations', 'rules', 'at-rules'], |
| 580 | + })); |
620 | 581 |
|
621 | 582 | test('Ignore nodes with template literals (styled)', () => |
622 | | - runTest( |
623 | | - 'ignore-template-literals.js', |
624 | | - { |
625 | | - order: ['declarations', 'rules', 'at-rules'], |
626 | | - }, |
627 | | - __dirname, |
628 | | - )); |
| 583 | + runTest('ignore-template-literals.js', { |
| 584 | + order: ['declarations', 'rules', 'at-rules'], |
| 585 | + })); |
0 commit comments