Exclude import() tests from pubilsh build (#10995)
I really don't like this commit, but import() is currently breaking our publish script. When "normal" tests we are transpiling import() so that it works with Jest. We can't do it while publishing because we need to publish the untranspiled import() so that it can load real .mjs files. Follow up to #10903
This commit is contained in:
parent
6ad7e19a27
commit
d75652eb5e
2
Makefile
2
Makefile
@ -212,7 +212,7 @@ prepublish-build: clean-lib clean-runtime-helpers
|
|||||||
prepublish:
|
prepublish:
|
||||||
$(MAKE) bootstrap-only
|
$(MAKE) bootstrap-only
|
||||||
$(MAKE) prepublish-build
|
$(MAKE) prepublish-build
|
||||||
$(MAKE) test
|
IS_PUBLISH=true $(MAKE) test
|
||||||
|
|
||||||
new-version:
|
new-version:
|
||||||
git pull --rebase
|
git pull --rebase
|
||||||
|
|||||||
@ -1044,6 +1044,10 @@ describe("buildConfigChain", function() {
|
|||||||
);
|
);
|
||||||
const filename = tmp("src.js");
|
const filename = tmp("src.js");
|
||||||
|
|
||||||
|
// We can't transpile import() while publishing, and it isn't supported
|
||||||
|
// by jest.
|
||||||
|
if (process.env.IS_PUBLISH && name === "babel.config.mjs") return;
|
||||||
|
|
||||||
await config(name);
|
await config(name);
|
||||||
|
|
||||||
expect(await loadOptionsAsync({ filename, cwd })).toEqual({
|
expect(await loadOptionsAsync({ filename, cwd })).toEqual({
|
||||||
@ -1067,6 +1071,15 @@ describe("buildConfigChain", function() {
|
|||||||
`babel-test-dup-config-${name1}-${name2}`,
|
`babel-test-dup-config-${name1}-${name2}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// We can't transpile import() while publishing, and it isn't supported
|
||||||
|
// by jest.
|
||||||
|
if (
|
||||||
|
process.env.IS_PUBLISH &&
|
||||||
|
(name1 === "babel.config.mjs" || name2 === "babel.config.mjs")
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await Promise.all([config(name1), config(name2)]);
|
await Promise.all([config(name1), config(name2)]);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
@ -1124,6 +1137,10 @@ describe("buildConfigChain", function() {
|
|||||||
);
|
);
|
||||||
const filename = tmp("src.js");
|
const filename = tmp("src.js");
|
||||||
|
|
||||||
|
// We can't transpile import() while publishing, and it isn't supported
|
||||||
|
// by jest.
|
||||||
|
if (process.env.IS_PUBLISH && name === ".babelrc.mjs") return;
|
||||||
|
|
||||||
await config(name);
|
await config(name);
|
||||||
|
|
||||||
expect(await loadOptionsAsync({ filename, cwd })).toEqual({
|
expect(await loadOptionsAsync({ filename, cwd })).toEqual({
|
||||||
@ -1157,6 +1174,15 @@ describe("buildConfigChain", function() {
|
|||||||
`babel-test-dup-config-${name1}-${name2}`,
|
`babel-test-dup-config-${name1}-${name2}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// We can't transpile import() while publishing, and it isn't supported
|
||||||
|
// by jest.
|
||||||
|
if (
|
||||||
|
process.env.IS_PUBLISH &&
|
||||||
|
(name1 === ".babelrc.mjs" || name2 === ".babelrc.mjs")
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await Promise.all([config(name1), config(name2)]);
|
await Promise.all([config(name1), config(name2)]);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
@ -1187,6 +1213,10 @@ describe("buildConfigChain", function() {
|
|||||||
`("should show helpful errors for $config", async ({ dir, error }) => {
|
`("should show helpful errors for $config", async ({ dir, error }) => {
|
||||||
const filename = fixture("config-files", dir, "src.js");
|
const filename = fixture("config-files", dir, "src.js");
|
||||||
|
|
||||||
|
// We can't transpile import() while publishing, and it isn't supported
|
||||||
|
// by jest.
|
||||||
|
if (process.env.IS_PUBLISH && dir === "babelrc-mjs-error") return;
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
loadOptionsAsync({ filename, cwd: path.dirname(filename) }),
|
loadOptionsAsync({ filename, cwd: path.dirname(filename) }),
|
||||||
).rejects.toThrow(error);
|
).rejects.toThrow(error);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user