Skip to content

Commit

Permalink
Split tests between parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalduez committed Aug 2, 2024
1 parent 025d733 commit 43a8fce
Show file tree
Hide file tree
Showing 141 changed files with 615 additions and 244 deletions.
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defaults
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## [Unreleased]
### Added
* Make the Hermes parser optional and disabled by default.
It can now be activated by setting hte `parser` option
`[["@gandi/gandi", { "parser": "hermes" }]]`.

## 6.1.0 - 2024-07-29
### Changed
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = (context, options = {}) => {
];

let plugins = [
...(parser === 'hermes' ? 'babel-plugin-syntax-hermes-parser' : []),
...(parser === 'hermes' ? ['babel-plugin-syntax-hermes-parser'] : []),
['@babel/plugin-transform-runtime', runtimeOpts],
];

Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions test/__file_snapshots__/babel-cjsm---ES--optional-chaining-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

let obj = {
foo: {
bar: {
baz: 42
}
}
};
let baz = obj?.foo?.bar?.baz; // 42

let safe = obj?.qux?.baz; // undefined
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/interopRequireWildcard"));
Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require( /* webpackChunkName: foo */'bar')));
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"use strict";

// @component
function Foo() {}
File renamed without changes.
10 changes: 10 additions & 0 deletions test/__file_snapshots__/babel-esm---ES--optional-chaining-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let obj = {
foo: {
bar: {
baz: 42
}
}
};
let baz = obj?.foo?.bar?.baz; // 42

let safe = obj?.qux?.baz; // undefined
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import( /* webpackChunkName: foo */'bar');
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// @component
function Foo() {}
File renamed without changes.
12 changes: 12 additions & 0 deletions test/__file_snapshots__/babel-node---ES--optional-chaining-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

let obj = {
foo: {
bar: {
baz: 42
}
}
};
let baz = obj?.foo?.bar?.baz; // 42

let safe = obj?.qux?.baz; // undefined
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/interopRequireWildcard"));
Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require( /* webpackChunkName: foo */'bar')));
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"use strict";

// @component
function Foo() {}
2 changes: 0 additions & 2 deletions test/__file_snapshots__/esmodules--Flow-Conditional-Types-0

This file was deleted.

1 change: 0 additions & 1 deletion test/__file_snapshots__/esmodules--Flow-Type-Guards-0

This file was deleted.

9 changes: 0 additions & 9 deletions test/__file_snapshots__/esmodules--optional-chaining-0

This file was deleted.

3 changes: 3 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---ES--Array.flatMap-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

[1, 2].flatMap(x => [x * 2]);
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---ES--Object.entries-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

Object.entries({
a: 1
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

Promise.allSettled([Promise.resolve(1), Promise.resolve(2)]).then(rs => rs.forEach(r => console.log(r.status)));
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---ES--Runtime-ponyfills-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

new Map();
new Set();
new Promise();
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---ES--async-await-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

(async function () {
await foo();
})();
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---ES--class-properties-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

class A {
a = () => 'hello';
}
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---ES--dynamic-imports-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/interopRequireWildcard"));
Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require('./a')));
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"use strict";

let obj = {};
let foo = obj.foo ?? 'default';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

let b = {
...a
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

class A {
static a = 'hello';
}
1 change: 1 addition & 0 deletions test/__file_snapshots__/hermes-cjsm---Flow--Mapped-Types-0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"use strict";
7 changes: 7 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---Flow--Type-Casting-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use strict";

let val = value;
let obj = {
prop: value
};
let arr = [value, value];
3 changes: 3 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---Flow--Types-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

let a = 'hello';
23 changes: 23 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---React--class-component-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";

var _react = require("react");
var _jsxRuntime = require("react/jsx-runtime");
class Button extends _react.Component {
handleClick = async evt => {
evt.preventDefault();
await fetch('/foo');
};
render() {
const {
type = 'button',
children,
...extraProps
} = this.props;
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
type: type,
onClick: this.handleClick,
...extraProps,
children: children
});
}
}
14 changes: 14 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---React--function-component-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";

var _jsxRuntime = require("react/jsx-runtime");
function Button({
type = 'button',
children,
...extraProps
}) {
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
type: type,
...extraProps,
children: children
});
}
6 changes: 6 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---React--jsx-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use strict";

var _jsxRuntime = require("react/jsx-runtime");
let A = () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: "hello"
});
8 changes: 8 additions & 0 deletions test/__file_snapshots__/hermes-cjsm---React--jsx-spread-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use strict";

var _jsxRuntime = require("react/jsx-runtime");
/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
a: true,
...b,
children: "hello"
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

class C {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/interopRequireWildcard"));
Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require('bar')));
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

function Foo() {}
Empty file.
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-esm---Flow--Type-Casting-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let val = value;
let obj = {
prop: value
};
let arr = [value, value];
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import('bar');
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function Foo() {}
3 changes: 3 additions & 0 deletions test/__file_snapshots__/hermes-node---ES--Array.flatMap-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

[1, 2].flatMap(x => [x * 2]);
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-node---ES--Object.entries-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

Object.entries({
a: 1
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

Promise.allSettled([Promise.resolve(1), Promise.resolve(2)]).then(rs => rs.forEach(r => console.log(r.status)));
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-node---ES--Runtime-ponyfills-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

new Map();
new Set();
new Promise();
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-node---ES--async-await-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

(async function () {
await foo();
})();
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-node---ES--class-properties-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

class A {
a = () => 'hello';
}
5 changes: 5 additions & 0 deletions test/__file_snapshots__/hermes-node---ES--dynamic-imports-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/interopRequireWildcard"));
Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require('./a')));
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"use strict";

let obj = {};
let foo = obj.foo ?? 'default';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

let b = {
...a
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

class A {
static a = 'hello';
}
1 change: 1 addition & 0 deletions test/__file_snapshots__/hermes-node---Flow--Mapped-Types-0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"use strict";
7 changes: 7 additions & 0 deletions test/__file_snapshots__/hermes-node---Flow--Type-Casting-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use strict";

let val = value;
let obj = {
prop: value
};
let arr = [value, value];
3 changes: 3 additions & 0 deletions test/__file_snapshots__/hermes-node---Flow--Types-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

let a = 'hello';
23 changes: 23 additions & 0 deletions test/__file_snapshots__/hermes-node---React--class-component-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";

var _react = require("react");
var _jsxRuntime = require("react/jsx-runtime");
class Button extends _react.Component {
handleClick = async evt => {
evt.preventDefault();
await fetch('/foo');
};
render() {
const {
type = 'button',
children,
...extraProps
} = this.props;
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
type: type,
onClick: this.handleClick,
...extraProps,
children: children
});
}
}
Loading

0 comments on commit 43a8fce

Please sign in to comment.