Skip to content

Commit f0efb7b

Browse files
authored
Add comment support to @gate pragma (#21881)
So you can more easily comment on why a test is gated.
1 parent 8134676 commit f0efb7b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

scripts/babel/__tests__/transform-test-gate-pragma-test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ describe('transform-test-gate-pragma', () => {
160160
test('single quoted strings', () => {
161161
expect(shouldPass).toBe(true);
162162
});
163+
164+
// @gate flagThatIsOn // This is a comment
165+
test('line comment', () => {
166+
expect(shouldPass).toBe(true);
167+
});
163168
});
164169

165170
describe('transform test-gate-pragma: actual runtime', () => {

scripts/babel/transform-test-gate-pragma.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ function transform(babel) {
9393
tokens.push({type: next2});
9494
i += 2;
9595
continue;
96+
case '//':
97+
// This is the beginning of a line comment. The rest of the line
98+
// is ignored.
99+
return tokens;
96100
}
97101

98102
switch (char) {

0 commit comments

Comments
 (0)