Skip to content

Commit

Permalink
comment out duplicated symlinked, transitive package tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mununki committed Apr 23, 2023
1 parent feeaa73 commit faf65be
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
57 changes: 29 additions & 28 deletions jscomp/build_tests/duplicated_symlinked_packages/input.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
const fs = require('fs')
const path = require('path')
const child_process = require('child_process')
const rescript_exe = require("../../../scripts/bin_path").rescript_exe
// 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 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)
// }
// }
// })


15 changes: 8 additions & 7 deletions jscomp/build_tests/transitive_pinned_dependency1/input.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//@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;
// 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;

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'")
15 changes: 8 additions & 7 deletions jscomp/build_tests/transitive_pinned_dependency2/input.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//@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;
// 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;

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'")

0 comments on commit faf65be

Please sign in to comment.