message: test: expand testing of JSX to esprima
diff: @@ -5,19 +5,17 @@ import { Printer } from "../lib/printer";
  import * as types from "ast-types";
  const nodeMajorVersion = parseInt(process.versions.node, 10);
  -(nodeMajorVersion >= 6 ? describe : xdescribe)
  -("JSX Compatability", function() {
  +for (const { title, parser } of [
  + { title: "Babel JSX Compatibility", parser: require("../parsers/babel") },
  + { title: "Esprima JSX Compatibility", parser: require("../parsers/esprima") },
  +]) {
  + (nodeMajorVersion >= 6 ? describe : xdescribe)(title, function () {
  const printer = new Printer({ tabWidth: 2 });
  - const parseOptions = {
  - parser: require("../parsers/babel")
  - };
  + const parseOptions = { parser };
  function check(source: string) {
  const ast1 = parse(source, parseOptions);
  - const ast2 = parse(
  - printer.printGenerically(ast1).code,
  - parseOptions
  - );
  + const ast2 = parse(printer.printGenerically(ast1).code, parseOptions);
  types.astNodesAreEquivalent.assert(ast1, ast2);
  }
  @@ -32,7 +30,7 @@ const nodeMajorVersion = parseInt(process.versions.node, 10);
  });
  it("should parse and print literal attributes", function () {
  - check("<b className=\"hello\" />");
  + check('<b className="hello" />');
  });
  it("should parse and print expression attributes", function () {
  @@ -55,12 +53,11 @@ const nodeMajorVersion = parseInt(process.versions.node, 10);
  check("<Foo.Bar />");
  });
  - it("should parse and print fragments", function() {
  - check([
  - "<>",
  - " <td>Hello</td>",
  - " <td>world!</td>",
  - "</>",
  - ].join("\n"));
  + // Esprima does not parse JSX fragments: https://github.com/jquery/esprima/issues/2020
  + (/esprima/i.test(title)
  + ? xit
  + : it)("should parse and print fragments", function () {
  + check(["<>", " <td>Hello</td>", " <td>world!</td>", "</>"].join("\n"));
  });
  });
  +}
  