New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pass package type to loader runner #15198
Changes from 7 commits
29bd40e
0145c43
6c03c5a
a8d7412
8d20f38
97887ab
e00d817
398dd91
98b976e
65d1742
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
it("should pass package.json type to loader", function () { | ||
expect(require("cjs/loader.js!")).toBe("commonjs"); | ||
expect(require("./loader.js!")).toBe("undefined"); | ||
}); | ||
|
||
it("should pass 'commonjs' type to loader for .cjs", function () { | ||
expect(require("cjs/loader.cjs!")).toBe("commonjs"); | ||
expect(require("./loader.cjs!")).toBe("commonjs"); | ||
expect(require("esm/loader.cjs!")).toBe("commonjs"); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import("../../../../").LoaderDefinition} */ | ||
module.exports = function loader() { | ||
return `module.exports = "${this.loaders[this.loaderIndex].type}";`; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import("../../../../").LoaderDefinition} */ | ||
module.exports = function loader() { | ||
return `module.exports = "${this.loaders[this.loaderIndex].type}";`; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
it("should pass package.json type to loader", function () { | ||
expect(require("esm/loader.js!")).toBe("module"); | ||
}); | ||
|
||
it("should pass 'module' type to loader for .mjs", function () { | ||
expect(require("cjs/loader.mjs!")).toBe("module"); | ||
expect(require("esm/loader.mjs!")).toBe("module"); | ||
expect(require("./loader.mjs!")).toBe("module"); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import("../../../../").LoaderDefinition} */ | ||
export default function loader() { | ||
return `export default "${this.loaders[this.loaderIndex].type}";`; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = function(config) { | ||
// TODO need fix in v8 https://github.com/nodejs/node/issues/35889 | ||
// TODO otherwise this test case cause segment fault | ||
return false; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could filter this spawning another
jest
process and catching exit code.. but it seems overengineering to me..There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this suspect causing the core dumps / Segfault on CI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes