Skip to content
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

Merged

Conversation

kentaromiura
Copy link
Contributor

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

@orta
Copy link
Member

orta commented Feb 22, 2017

👍

@@ -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');
Copy link
Member

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"
Copy link
Member

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');
Copy link
Member

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);
Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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 👍

@kentaromiura kentaromiura force-pushed the make-editor-support-parser-agnostic branch 2 times, most recently from e0dcb49 to 7bfb8e1 Compare February 22, 2017 17:44
@@ -0,0 +1,14 @@
{
Copy link
Member

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.

@kentaromiura kentaromiura force-pushed the make-editor-support-parser-agnostic branch from 7bfb8e1 to 25a665b Compare February 23, 2017 11:43
"license": "BSD-3-Clause",
"main": "build/index.js",
"dependencies": {
"jest-editor-support": "^19.0.0",
Copy link
Member

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.

@kentaromiura kentaromiura force-pushed the make-editor-support-parser-agnostic branch from 25a665b to b2f73cc Compare February 23, 2017 12:32
@cpojer cpojer merged commit f67fc6d into jestjs:master Feb 23, 2017
skovhus pushed a commit to skovhus/jest that referenced this pull request Apr 29, 2017
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.
tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
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.
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants