ulugbekna/fix build ctx key parsing (#174859)

* context keys: parser: fix test suite name

* context keys: parser: remove flaky tests (flaky because we output RegExp exceptions, which seemingly differ on node and browser)
This commit is contained in:
Ulugbek Abdullaev 2023-02-20 21:02:31 +01:00 committed by GitHub
parent f0ca34a612
commit 2e1c8053c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,7 +33,7 @@ function parseToStr(input: string): string {
return prints.join('');
}
suite('Context Key Scanner', () => {
suite('Context Key Parser', () => {
test(' foo', () => {
const input = ' foo';
@ -162,11 +162,6 @@ suite('Context Key Scanner', () => {
assert.deepStrictEqual(parseToStr(input), "resource =~ /((\\/scratch\\/(?!update)(.*)\\/)|((\\/src\\/).*\\/)).*$/");
});
test(`FIXME resourcePath =~ //foo/barr// || resourcePath =~ //view/(foo|frontend|base)/(foo|barr)// && resourceExtname in fooBar`, () => {
const input = `resourcePath =~ //foo/barr// || resourcePath =~ //view/(foo|frontend|base)/(foo|barr)// && resourceExtname in fooBar`;
assert.deepStrictEqual(parseToStr(input), "Lexing errors:\n\nUnexpected token '|' at offset 59. Did you mean '||'?\nUnexpected token '|' at offset 68. Did you mean '||'?\nUnexpected token '/ && resourceExtname in fooBar' at offset 86\n\n --- \nParsing errors:\n\nUnexpected error: SyntaxError: Invalid flags supplied to RegExp constructor ' && resourceExtname in fooBar' for token EOF at offset 116.\n");
});
test(`resourcePath =~ /\.md(\.yml|\.txt)*$/gim`, () => {
const input = `resourcePath =~ /\.md(\.yml|\.txt)*$/gim`;
assert.deepStrictEqual(parseToStr(input), "resourcePath =~ /.md(.yml|.txt)*$/gim");
@ -191,11 +186,6 @@ suite('Context Key Scanner', () => {
assert.deepStrictEqual(parseToStr(input), "Parsing errors:\n\nExpected 'true', 'false', '(', KEY, KEY '=~' regex, KEY [ ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value ] but got 'in' at offset 9.\n");
});
test(`view =~ '/(servers)/' && viewItem =~ /^(Starting|Started|Debugging|Stopping|Stopped|Unknown)/'`, () => {
const input = `view =~ '/(servers)/' && viewItem =~ /^(Starting|Started|Debugging|Stopping|Stopped|Unknown)/'`;
assert.deepStrictEqual(parseToStr(input), "Lexing errors:\n\nUnexpected token ''' at offset 93\n\n --- \nParsing errors:\n\nUnexpected error: SyntaxError: Invalid flags supplied to RegExp constructor ''' for token EOF at offset 94.\n");
});
test('vim<c-r> == 1 && vim<2<=3', () => {
const input = 'vim<c-r> == 1 && vim<2<=3';
assert.deepStrictEqual(parseToStr(input), "Lexing errors:\n\nUnexpected token '=' at offset 23. Did you mean '==' or '=~'?\n\n --- \nParsing errors:\n\nUnexpected '=' at offset 23.\n"); // FIXME