-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move the typescript parser outside of jest-editor-support to jest-tes… #2973
Move the typescript parser outside of jest-editor-support to jest-tes… #2973
Conversation
👍 |
@@ -15,7 +15,7 @@ const ProjectWorkspace = require('./ProjectWorkspace'); | |||
const Runner = require('./Runner'); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
'use strict'; | ||
|
||
const {parse: babylonParser, ItBlock, Expect} = require('jest-editor-support'); | ||
const {parse: typeScriptParser} = require('./TypeScriptParser'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-support
to
jest-test-typescript-parser
Summary
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