|
1 |
| -const fs = require('fs') |
2 |
| -const path = require('path') |
3 |
| -const child_process = require('child_process') |
4 |
| -const rescript_exe = require("../../../scripts/bin_path").rescript_exe |
| 1 | +// https://github.com/rescript-lang/rescript-compiler/pull/5703#issuecomment-1518507161 |
| 2 | +// const fs = require('fs') |
| 3 | +// const path = require('path') |
| 4 | +// const child_process = require('child_process') |
| 5 | +// const rescript_exe = require("../../../scripts/bin_path").rescript_exe |
5 | 6 |
|
6 |
| -const expectedFilePath = path.join(__dirname, 'out.expected') |
| 7 | +// const expectedFilePath = path.join(__dirname, 'out.expected') |
7 | 8 |
|
8 |
| -const updateTests = process.argv[2] === 'update' |
| 9 | +// const updateTests = process.argv[2] === 'update' |
9 | 10 |
|
10 |
| -function postProcessErrorOutput (output) { |
11 |
| - output = output.trimRight() |
12 |
| - output = output.replace(new RegExp(__dirname, 'gi'), '.') |
13 |
| - return output |
14 |
| -} |
15 |
| -child_process.execSync(`${rescript_exe} clean -with-deps`,{cwd:__dirname}) |
16 |
| -child_process.exec(rescript_exe, {cwd: __dirname}, (err, stdout, stderr) => { |
17 |
| - const actualErrorOutput = postProcessErrorOutput(stderr.toString()) |
18 |
| - if (updateTests) { |
19 |
| - fs.writeFileSync(expectedFilePath, actualErrorOutput) |
20 |
| - } else { |
21 |
| - const expectedErrorOutput = postProcessErrorOutput(fs.readFileSync(expectedFilePath, {encoding: 'utf-8'})) |
22 |
| - if (expectedErrorOutput !== actualErrorOutput) { |
23 |
| - console.error(`The old and new error output aren't the same`) |
24 |
| - console.error('\n=== Old:') |
25 |
| - console.error(expectedErrorOutput) |
26 |
| - console.error('\n=== New:') |
27 |
| - console.error(actualErrorOutput) |
28 |
| - process.exit(1) |
29 |
| - } |
30 |
| - } |
31 |
| -}) |
| 11 | +// function postProcessErrorOutput (output) { |
| 12 | +// output = output.trimRight() |
| 13 | +// output = output.replace(new RegExp(__dirname, 'gi'), '.') |
| 14 | +// return output |
| 15 | +// } |
| 16 | +// child_process.execSync(`${rescript_exe} clean -with-deps`,{cwd:__dirname}) |
| 17 | +// child_process.exec(rescript_exe, {cwd: __dirname}, (err, stdout, stderr) => { |
| 18 | +// const actualErrorOutput = postProcessErrorOutput(stderr.toString()) |
| 19 | +// if (updateTests) { |
| 20 | +// fs.writeFileSync(expectedFilePath, actualErrorOutput) |
| 21 | +// } else { |
| 22 | +// const expectedErrorOutput = postProcessErrorOutput(fs.readFileSync(expectedFilePath, {encoding: 'utf-8'})) |
| 23 | +// if (expectedErrorOutput !== actualErrorOutput) { |
| 24 | +// console.error(`The old and new error output aren't the same`) |
| 25 | +// console.error('\n=== Old:') |
| 26 | +// console.error(expectedErrorOutput) |
| 27 | +// console.error('\n=== New:') |
| 28 | +// console.error(actualErrorOutput) |
| 29 | +// process.exit(1) |
| 30 | +// } |
| 31 | +// } |
| 32 | +// }) |
32 | 33 |
|
33 | 34 |
|
0 commit comments