From 4803059925bf45a0d86f1d7fc2e9dc5448040b35 Mon Sep 17 00:00:00 2001 From: hi-ogawa <4232207+hi-ogawa@users.noreply.github.com> Date: Sun, 9 Feb 2025 04:14:36 +0000 Subject: [PATCH] test(ast): remove old ast snapshot tests (#8976) --- .../test/__snapshots__/parse.test.ts.snap | 164 ------------------ napi/parser/test/parse.test.ts | 20 --- 2 files changed, 184 deletions(-) delete mode 100644 napi/parser/test/__snapshots__/parse.test.ts.snap diff --git a/napi/parser/test/__snapshots__/parse.test.ts.snap b/napi/parser/test/__snapshots__/parse.test.ts.snap deleted file mode 100644 index 5d1561ee7c241..0000000000000 --- a/napi/parser/test/__snapshots__/parse.test.ts.snap +++ /dev/null @@ -1,164 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`parse > estree MemberExpression 1`] = ` -[ - { - "end": 15, - "expression": { - "computed": false, - "end": 14, - "object": { - "end": 3, - "name": "obj", - "start": 0, - "type": "Identifier", - }, - "optional": false, - "property": { - "end": 14, - "name": "staticProp", - "start": 4, - "type": "Identifier", - }, - "start": 0, - "type": "MemberExpression", - }, - "start": 0, - "type": "ExpressionStatement", - }, - { - "end": 36, - "expression": { - "computed": true, - "end": 35, - "object": { - "end": 19, - "name": "obj", - "start": 16, - "type": "Identifier", - }, - "optional": false, - "property": { - "end": 34, - "raw": ""computedProp"", - "start": 20, - "type": "Literal", - "value": "computedProp", - }, - "start": 16, - "type": "MemberExpression", - }, - "start": 16, - "type": "ExpressionStatement", - }, -] -`; - -exports[`parse > estree function params 1`] = ` -{ - "async": true, - "body": { - "directives": [], - "end": 48, - "start": 46, - "statements": [], - "type": "FunctionBody", - }, - "declare": false, - "end": 48, - "generator": false, - "id": { - "end": 19, - "name": "test", - "start": 15, - "type": "Identifier", - }, - "params": [ - { - "accessibility": null, - "decorators": [], - "end": 21, - "name": "x", - "optional": false, - "override": false, - "readonly": false, - "start": 20, - "type": "Identifier", - "typeAnnotation": null, - }, - { - "accessibility": null, - "decorators": [], - "end": 28, - "optional": false, - "override": false, - "properties": [ - { - "computed": false, - "end": 26, - "key": { - "end": 26, - "name": "y", - "start": 25, - "type": "Identifier", - }, - "shorthand": true, - "start": 25, - "type": "BindingProperty", - "value": { - "end": 26, - "name": "y", - "optional": false, - "start": 25, - "type": "Identifier", - "typeAnnotation": null, - }, - }, - ], - "readonly": false, - "start": 23, - "type": "ObjectPattern", - "typeAnnotation": null, - }, - { - "accessibility": null, - "decorators": [], - "elements": [ - { - "end": 33, - "name": "z", - "optional": false, - "start": 32, - "type": "Identifier", - "typeAnnotation": null, - }, - ], - "end": 35, - "optional": false, - "override": false, - "readonly": false, - "start": 30, - "type": "ArrayPattern", - "typeAnnotation": null, - }, - { - "argument": { - "end": 44, - "name": "rest", - "start": 40, - "type": "Identifier", - }, - "end": 44, - "optional": false, - "start": 37, - "type": "RestElement", - "typeAnnotation": null, - }, - ], - "returnType": null, - "start": 0, - "thisParam": null, - "type": "FunctionDeclaration", - "typeParameters": null, -} -`; diff --git a/napi/parser/test/parse.test.ts b/napi/parser/test/parse.test.ts index d5c75450bd3cb..85ba729308e30 100644 --- a/napi/parser/test/parse.test.ts +++ b/napi/parser/test/parse.test.ts @@ -26,26 +26,6 @@ describe('parse', () => { }); expect(code.substring(comment.start, comment.end)).toBe('/*' + comment.value + '*/'); }); - - it('estree function params', async () => { - const ret = await parseAsync( - 'test.js', - `async function test(x, { y }, [ z ], ...rest) {}`, - ); - expect(ret.program.body[0]).matchSnapshot(); - expect(ret.program.sourceType).toMatchInlineSnapshot(`"module"`); - }); - - it('estree MemberExpression', async () => { - const ret = await parseAsync( - 'test.js', - `\ -obj.staticProp; -obj["computedProp"]; -`, - ); - expect(ret.program.body).matchSnapshot(); - }); }); describe('error', () => {