Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/parser/test/node/getStructure.js.spec.ts
13405 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { afterAll, describe, expect, test } from 'vitest';
7
import { _dispose } from '../../node/parserImpl';
8
import { WASMLanguage } from '../../node/treeSitterLanguages';
9
import { fromFixture, srcWithAnnotatedStructure } from './getStructure.util';
10
11
describe('getStructure - js', () => {
12
afterAll(() => _dispose());
13
14
function jsStruct(source: string) {
15
return srcWithAnnotatedStructure(WASMLanguage.JavaScript, source);
16
}
17
18
test('source with different syntax constructs', async () => {
19
20
const source = await fromFixture('test.js');
21
22
expect(await jsStruct(source)).toMatchSnapshot();
23
});
24
});
25
26