From fd1b6a5caed61132964c217341ba78de2336e760 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Fri, 6 Dec 2019 12:50:23 -0500 Subject: [PATCH] Add estree plugin tests --- .../estree/dynamic-import/basic/input.js | 1 + .../estree/dynamic-import/basic/output.json | 150 ++++++++++++++++++ .../estree/dynamic-import/options.json | 6 + 3 files changed, 157 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js create mode 100644 packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json create mode 100644 packages/babel-parser/test/fixtures/estree/dynamic-import/options.json diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js new file mode 100644 index 000000000000..7fc63cc0957a --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js @@ -0,0 +1 @@ +const a = import("a"); diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json new file mode 100644 index 000000000000..b4f9e06f8a20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ImportExpression", + "start": 10, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "callee": { + "type": "Import", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "arguments": [ + { + "type": "Literal", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "value": "a", + "raw": "\"a\"" + } + ], + "source": { + "type": "Literal", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "value": "a", + "raw": "\"a\"" + } + } + } + ], + "kind": "const" + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json b/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json new file mode 100644 index 000000000000..a3c47fadb236 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "estree", + "dynamicImport" + ] +}