Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Remove lodash dependency from tsx parser
- Loading branch information
Showing
5 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ | |
"roots": [ | ||
"src", | ||
"bin", | ||
"parser", | ||
"sample" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"globals": { | ||
"jest": true | ||
}, | ||
"env": { | ||
"jasmine": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`tsxParser parse extends the ts config with jsx support 1`] = ` | ||
Array [ | ||
"\\"mock content\\";", | ||
Object { | ||
"allowImportExportEverywhere": true, | ||
"allowReturnOutsideFunction": true, | ||
"plugins": Array [ | ||
"jsx", | ||
"asyncGenerators", | ||
"bigInt", | ||
"classPrivateMethods", | ||
"classPrivateProperties", | ||
"classProperties", | ||
"decorators-legacy", | ||
"doExpressions", | ||
"dynamicImport", | ||
"exportDefaultFrom", | ||
"exportExtensions", | ||
"exportNamespaceFrom", | ||
"functionBind", | ||
"functionSent", | ||
"importMeta", | ||
"nullishCoalescingOperator", | ||
"numericSeparator", | ||
"objectRestSpread", | ||
"optionalCatchBinding", | ||
"optionalChaining", | ||
Array [ | ||
"pipelineOperator", | ||
Object { | ||
"proposal": "minimal", | ||
}, | ||
], | ||
"throwExpressions", | ||
"typescript", | ||
], | ||
"sourceType": "module", | ||
"startLine": 1, | ||
"tokens": true, | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/*global jest, describe, it, expect*/ | ||
|
||
'use strict'; | ||
|
||
jest.mock('@babel/parser') | ||
const babylon = require('@babel/parser'); | ||
|
||
const tsxParser = require('../tsx'); | ||
|
||
describe('tsxParser', function() { | ||
describe('parse', function() { | ||
it('extends the ts config with jsx support', function() { | ||
const parser = tsxParser(); | ||
parser.parse('"mock content";'); | ||
|
||
expect(babylon.parse).toHaveBeenCalledTimes(1); | ||
expect(babylon.parse.mock.calls[0]).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters