Skip to content

Commit

Permalink
Fix tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Dec 1, 2020
1 parent f441b60 commit 48ed730
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/babel-core/test/api.js
Expand Up @@ -813,7 +813,7 @@ describe("api", function () {
"'plugins' section of your Babel config to enable transformation.",
);
expect(err.message).toMatch(
/You can re-run Babel with the BABEL_SHOW_CONFIG_FOR=(.*?)\/parsing-errors\/syntax-and-transform\/file.js environment variable to show the loaded configuration./,
/You can re-run Babel with the BABEL_SHOW_CONFIG_FOR=(.*?)[\\/]parsing-errors[\\/]syntax-and-transform[\\/]file.js environment variable to show the loaded configuration./,
);
done();
},
Expand Down
@@ -0,0 +1,5 @@
class A {
x = 2;

#foo() {}
}
@@ -0,0 +1,13 @@
{
"os": ["win32"],
"validateLogs": true,
"presets": [
["env", {
"targets": { "node": 10 },
"shippedProposals": true
}]
],
"plugins": [
["proposal-private-methods", { "loose": true }]
]
}
@@ -0,0 +1,17 @@
var id = 0;

function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }

var _foo = _classPrivateFieldLooseKey("foo");

class A {
constructor() {
Object.defineProperty(this, _foo, {
value: _foo2
});
this.x = 2;
}

}

var _foo2 = function _foo2() {};
@@ -0,0 +1,5 @@
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-class-properties since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-methods.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
["@babel/plugin-proposal-class-properties", { "loose": true }]
to the "plugins" section of your Babel config.
You can re-run Babel with the BABEL_SHOW_CONFIG_FOR=<CWD>\packages\babel-preset-env\test\fixtures\loose-class-features-precedence\methods-loose-preset-not-loose\input.js environment variable to show the loaded configuration.
@@ -1,4 +1,5 @@
{
"os": ["darwin", "linux"],
"validateLogs": true,
"presets": [
["env", {
Expand Down
@@ -0,0 +1,5 @@
class A {
x = 2;

#foo() {}
}
@@ -0,0 +1,13 @@
{
"os": ["win32"],
"validateLogs": true,
"presets": [
["env", {
"targets": { "node": 10 },
"shippedProposals": true
}]
],
"plugins": [
["proposal-class-properties", { "loose": true }]
]
}
@@ -0,0 +1,17 @@
var id = 0;

function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }

var _foo = _classPrivateFieldLooseKey("foo");

class A {
constructor() {
Object.defineProperty(this, _foo, {
value: _foo2
});
this.x = 2;
}

}

var _foo2 = function _foo2() {};
@@ -0,0 +1,5 @@
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
["@babel/plugin-proposal-private-methods", { "loose": true }]
to the "plugins" section of your Babel config.
You can re-run Babel with the BABEL_SHOW_CONFIG_FOR=<CWD>\packages\babel-preset-env\test\fixtures\loose-class-features-precedence\properties-loose-preset-not-loose\input.js environment variable to show the loaded configuration.
@@ -1,4 +1,5 @@
{
"os": ["darwin", "linux"],
"validateLogs": true,
"presets": [
["env", {
Expand Down
@@ -0,0 +1,5 @@
class A {
x = 2;

#foo() {}
}
@@ -0,0 +1,14 @@
{
"os": ["win32"],
"validateLogs": true,
"presets": [
["env", {
"targets": { "node": 10 },
"shippedProposals": true,
"loose": true
}]
],
"plugins": [
["proposal-class-properties", { "loose": false }]
]
}
@@ -0,0 +1,14 @@
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var _foo = new WeakSet();

class A {
constructor() {
_foo.add(this);

_defineProperty(this, "x", 2);
}

}

var _foo2 = function _foo2() {};
@@ -0,0 +1,5 @@
Though the "loose" option was set to "true" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "false" for @babel/plugin-proposal-class-properties.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
["@babel/plugin-proposal-private-methods", { "loose": false }]
to the "plugins" section of your Babel config.
You can re-run Babel with the BABEL_SHOW_CONFIG_FOR=<CWD>\packages\babel-preset-env\test\fixtures\loose-class-features-precedence\properties-not-loose-preset-loose\input.js environment variable to show the loaded configuration.
@@ -1,4 +1,5 @@
{
"os": ["darwin", "linux"],
"validateLogs": true,
"presets": [
["env", {
Expand Down

0 comments on commit 48ed730

Please sign in to comment.