Add comment support to `@gate` pragma (#21881)
So you can more easily comment on why a test is gated.
Andrew Clark committed
Jul 14, 2021 at 13:36 UTC
f0efb7b70f9c1570b35e71a7fcc6690684fe9d08
2 files changed
+9
scripts/babel/__tests__/transform-test-gate-pragma-test.js
+5
@@ -160,6 +160,11 @@ describe('transform-test-gate-pragma', () => {
160
test('single quoted strings', () => {
161
expect(shouldPass).toBe(true);
162
});
163
+
164
+ // @gate flagThatIsOn // This is a comment
165
+ test('line comment', () => {
166
+ expect(shouldPass).toBe(true);
167
+ });
168
});
169
170
describe('transform test-gate-pragma: actual runtime', () => {
scripts/babel/transform-test-gate-pragma.js
+4
@@ -93,6 +93,10 @@ function transform(babel) {
93
tokens.push({type: next2});
94
i += 2;
95
continue;
96
+ case '//':
97
+ // This is the beginning of a line comment. The rest of the line
98
+ // is ignored.
99
+ return tokens;
100
}
101
102
switch (char) {