Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Commit

Permalink
Add tests for export extensions (#127)
Browse files Browse the repository at this point in the history
The case which includes a namespaced and default import was not tested yet
  • Loading branch information
danez authored Sep 15, 2016
1 parent 0adca96 commit abf6ca8
Show file tree
Hide file tree
Showing 7 changed files with 348 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export B, * as A from 'test';
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"type": "File",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"program": {
"type": "Program",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"specifiers": [
{
"type": "ExportDefaultSpecifier",
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 8
}
},
"exported": {
"type": "Identifier",
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 8
},
"identifierName": "B"
},
"name": "B"
}
},
{
"type": "ExportNamespaceSpecifier",
"start": 10,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 16
}
},
"exported": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "A"
},
"name": "A"
}
}
],
"source": {
"type": "StringLiteral",
"start": 22,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 28
}
},
"extra": {
"rawValue": "test",
"raw": "'test'"
},
"value": "test"
}
}
],
"directives": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export A from 'test';
103 changes: 103 additions & 0 deletions test/fixtures/experimental/export-extensions/default/expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"type": "File",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"program": {
"type": "Program",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"specifiers": [
{
"type": "ExportDefaultSpecifier",
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 8
}
},
"exported": {
"type": "Identifier",
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 8
},
"identifierName": "A"
},
"name": "A"
}
}
],
"source": {
"type": "StringLiteral",
"start": 14,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 20
}
},
"extra": {
"rawValue": "test",
"raw": "'test'"
},
"value": "test"
}
}
],
"directives": []
}
}
1 change: 1 addition & 0 deletions test/fixtures/experimental/export-extensions/ns/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as A from 'test';
103 changes: 103 additions & 0 deletions test/fixtures/experimental/export-extensions/ns/expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"type": "File",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"program": {
"type": "Program",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"specifiers": [
{
"type": "ExportNamespaceSpecifier",
"start": 7,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 13
}
},
"exported": {
"type": "Identifier",
"start": 12,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "A"
},
"name": "A"
}
}
],
"source": {
"type": "StringLiteral",
"start": 19,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 25
}
},
"extra": {
"rawValue": "test",
"raw": "'test'"
},
"value": "test"
}
}
],
"directives": []
}
}
4 changes: 4 additions & 0 deletions test/fixtures/experimental/export-extensions/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["exportExtensions"],
"sourceType": "module"
}

0 comments on commit abf6ca8

Please sign in to comment.