Move the typescript parser outside of jest-editor-support to jest-tes…#2973
Conversation
|
👍 |
| const Settings = require('./Settings'); | ||
| const {Expect, ItBlock, Node} = require('./parsers/ParserNodes'); | ||
| const {parse} = require('./ScriptParser'); | ||
| const {babylonParser: parse} = require('./parsers/BabylonParser'); |
There was a problem hiding this comment.
can we rename the thing it exports to parse so we don't have to alias it? It makes sense to me to call it BabylonParser.parse.
| "main": "build/index.js", | ||
| "dependencies": { | ||
| "jest-editor-support": "19.0.1", | ||
| "typescript": "^2.0.10" |
| 'use strict'; | ||
|
|
||
| const {parse: babylonParser, ItBlock, Expect} = require('jest-editor-support'); | ||
| const {parse: typeScriptParser} = require('./TypeScriptParser'); |
There was a problem hiding this comment.
same here, it should be TypeScriptParser.parse.
| if (file.match(/\.tsx?$/)) { | ||
| return typeScriptParser(file); | ||
| } else { | ||
| return babylonParser(file); |
There was a problem hiding this comment.
Since this is in the typescript parser package, I don't think there's any advantage to using babylon here?
There was a problem hiding this comment.
I think the idea here is that you can use the typescript parser if you think you are supporting a typescript project but it will continue to work for non ts files whereas jest-editor-support will work only for JS files.
There was a problem hiding this comment.
@bookman25 this was the previous behaviour, I just moved the file in a different package, I'll export TypeScriptParser from index so that should cover all the situations.
There was a problem hiding this comment.
I saw the move, but I didn't put 2 and 2 together 👍
e0dcb49 to
7bfb8e1
Compare
| @@ -0,0 +1,14 @@ | |||
| { | |||
There was a problem hiding this comment.
This package needs an npmignore.
7bfb8e1 to
25a665b
Compare
| "license": "BSD-3-Clause", | ||
| "main": "build/index.js", | ||
| "dependencies": { | ||
| "jest-editor-support": "^19.0.0", |
There was a problem hiding this comment.
this is not the correct version of this package.
25a665b to
b2f73cc
Compare
jestjs#2973) * Move the typescript parser outside of jest-editor-support to jest-test-typescript-parser * Move the fixture folder on the top level * rename babylonParser to parse and export TypeScript from jest-test-typescript-parser index.js * make node 4 happy.
jestjs#2973) * Move the typescript parser outside of jest-editor-support to jest-test-typescript-parser * Move the fixture folder on the top level * rename babylonParser to parse and export TypeScript from jest-test-typescript-parser index.js * make node 4 happy.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Move the typescript parser outside of
jest-editor-supportto
jest-test-typescript-parserSummary
Makes babylon parser the default for jest-editor-support, create a second package that contains the code for the typescript parser
Test plan
Tests pass