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

fix running without options #120

Merged
merged 1 commit into from
Jan 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function parse(code, options) {
// pass through jsx option
extra.ecmaFeatures.jsx = options.ecmaFeatures.jsx;
}
}

// Even if jsx option is set in typescript compiler, filename still has to
// contain .tsx file extension
Expand Down Expand Up @@ -213,8 +214,6 @@ function parse(code, options) {

}

}

var convert = require("./lib/ast-converter");

return convert(ast, extra);
Expand Down
File renamed without changes.
15 changes: 13 additions & 2 deletions tests/lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,19 @@ function getRaw(ast) {

describe("parse()", function() {


describe("basic functionality", function() {

it("should parse an empty string", function() {
assert.deepEqual(parser.parse("").body, []);
assert.deepEqual(parser.parse("", {}).body, []);
});

});

describe("modules", function() {

it("should have correct column number when strict mode error occurs", function() {

try {
parser.parse("function fn(a, a) {\n}", { sourceType: "module" });
} catch (err) {
Expand All @@ -47,6 +56,7 @@ describe("parse()", function() {
});

describe("general", function() {

it("should output tokens, comments, locs, and ranges when called with those options", function() {
var ast = parser.parse("let foo = bar;", {
ecmaFeatures: {
Expand All @@ -61,6 +71,7 @@ describe("parse()", function() {
assert.deepEqual(getRaw(ast), require("../fixtures/parse/all-pieces.json"));
});


});


});