-
Notifications
You must be signed in to change notification settings - Fork 469
Fix tests of duplicated packages in Dynamic import #6191
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
57 changes: 28 additions & 29 deletions
57
jscomp/build_tests/duplicated_symlinked_packages/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
// https://github.com/rescript-lang/rescript-compiler/pull/5703#issuecomment-1518507161 | ||
// const fs = require('fs') | ||
// const path = require('path') | ||
// const child_process = require('child_process') | ||
// const rescript_exe = require("../../../scripts/bin_path").rescript_exe | ||
const fs = require('fs') | ||
const path = require('path') | ||
const child_process = require('child_process') | ||
const rescript_exe = require("../../../scripts/bin_path").rescript_exe | ||
|
||
// const expectedFilePath = path.join(__dirname, 'out.expected') | ||
const expectedFilePath = path.join(__dirname, 'out.expected') | ||
|
||
// const updateTests = process.argv[2] === 'update' | ||
const updateTests = process.argv[2] === 'update' | ||
|
||
// function postProcessErrorOutput (output) { | ||
// output = output.trimRight() | ||
// output = output.replace(new RegExp(__dirname, 'gi'), '.') | ||
// return output | ||
// } | ||
// child_process.execSync(`${rescript_exe} clean -with-deps`,{cwd:__dirname}) | ||
// child_process.exec(rescript_exe, {cwd: __dirname}, (err, stdout, stderr) => { | ||
// const actualErrorOutput = postProcessErrorOutput(stderr.toString()) | ||
// if (updateTests) { | ||
// fs.writeFileSync(expectedFilePath, actualErrorOutput) | ||
// } else { | ||
// const expectedErrorOutput = postProcessErrorOutput(fs.readFileSync(expectedFilePath, {encoding: 'utf-8'})) | ||
// if (expectedErrorOutput !== actualErrorOutput) { | ||
// console.error(`The old and new error output aren't the same`) | ||
// console.error('\n=== Old:') | ||
// console.error(expectedErrorOutput) | ||
// console.error('\n=== New:') | ||
// console.error(actualErrorOutput) | ||
// process.exit(1) | ||
// } | ||
// } | ||
// }) | ||
function postProcessErrorOutput (output) { | ||
output = output.trimRight() | ||
output = output.replace(new RegExp(__dirname, 'gi'), '.') | ||
return output | ||
} | ||
child_process.execSync(`${rescript_exe} clean -with-deps`,{cwd:__dirname}) | ||
child_process.exec(rescript_exe, {cwd: __dirname}, (err, stdout, stderr) => { | ||
const actualErrorOutput = postProcessErrorOutput(stderr.toString()) | ||
if (updateTests) { | ||
fs.writeFileSync(expectedFilePath, actualErrorOutput) | ||
} else { | ||
const expectedErrorOutput = postProcessErrorOutput(fs.readFileSync(expectedFilePath, {encoding: 'utf-8'})) | ||
if (expectedErrorOutput !== actualErrorOutput) { | ||
console.error(`The old and new error output aren't the same`) | ||
console.error('\n=== Old:') | ||
console.error(expectedErrorOutput) | ||
console.error('\n=== New:') | ||
console.error(actualErrorOutput) | ||
process.exit(1) | ||
} | ||
} | ||
}) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
// https://github.com/rescript-lang/rescript-compiler/pull/5703#issuecomment-1518507161 | ||
// //@ts-check | ||
// var child_process = require("child_process"); | ||
// var assert = require("assert"); | ||
// var fs = require("fs") | ||
// var rescript_exe = require("../../../scripts/bin_path").rescript_exe; | ||
//@ts-check | ||
var child_process = require("child_process"); | ||
var assert = require("assert"); | ||
var fs = require("fs") | ||
var rescript_exe = require("../../../scripts/bin_path").rescript_exe; | ||
|
||
// console.log(child_process.execSync(rescript_exe, { encoding: "utf8", cwd: "./a" })); | ||
console.log(child_process.execSync(rescript_exe, { encoding: "utf8", cwd: "./a" })); | ||
|
||
// assert(fs.existsSync("./node_modules/c/lib/js/tests/test.mjs"), "dev files of module 'c' were not built by 'a' even though 'c' is a transitive pinned dependency of 'a' through 'b'") | ||
assert(fs.existsSync("./node_modules/c/lib/js/tests/test.mjs"), "dev files of module 'c' were not built by 'a' even though 'c' is a transitive pinned dependency of 'a' through 'b'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
// https://github.com/rescript-lang/rescript-compiler/pull/5703#issuecomment-1518507161 | ||
// //@ts-check | ||
// var child_process = require("child_process"); | ||
// var assert = require("assert"); | ||
// var fs = require("fs") | ||
// var rescript_exe = require("../../../scripts/bin_path").rescript_exe; | ||
//@ts-check | ||
var child_process = require("child_process"); | ||
var assert = require("assert"); | ||
var fs = require("fs") | ||
var rescript_exe = require("../../../scripts/bin_path").rescript_exe; | ||
|
||
// console.log(child_process.execSync(rescript_exe, { encoding: "utf8", cwd: "./a" })); | ||
console.log(child_process.execSync(rescript_exe, { encoding: "utf8", cwd: "./a" })); | ||
|
||
// assert(!fs.existsSync("./node_modules/c/lib/js/tests/test.mjs"), "dev files of module 'c' were built by 'a' even though 'c' is not a pinned dependency of 'a'") | ||
assert(!fs.existsSync("./node_modules/c/lib/js/tests/test.mjs"), "dev files of module 'c' were built by 'a' even though 'c' is not a pinned dependency of 'a'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Temporarily I removed the argument
module_system
to do eager evaluation here and passNodeJS
instead, then tests are passed.This is not the cure for the root cause, Lam_compile.compile needs to know the module_system info.