Fix CRLF issues in tests; Include common tsc options in asc bundle

This commit is contained in:
dcodeIO
2018-02-10 18:34:29 +01:00
parent 9678ce839e
commit 74f8189ac1
6 changed files with 116 additions and 121 deletions

View File

@ -69,12 +69,12 @@ tests.forEach(filename => {
console.log();
if (err)
stderr.write(err + os.EOL);
var actual = stdout.toString().replace(/\r\n/g, "\n");
if (args.create) {
fs.writeFileSync(path.join(basedir, basename + ".wast"), stdout.toString(), { encoding: "utf8" });
fs.writeFileSync(path.join(basedir, basename + ".wast"), actual, { encoding: "utf8" });
console.log("- " + chalk.yellow("Created fixture"));
} else {
let actual = stdout.toString();
let expected = fs.readFileSync(path.join(basedir, basename + ".wast"), { encoding: "utf8" });
let expected = fs.readFileSync(path.join(basedir, basename + ".wast"), { encoding: "utf8" }).replace(/\r\n/g, "\n");
let diffs = diff(basename + ".wast", expected, actual);
if (diffs !== null) {
console.log(diffs);

View File

@ -27,14 +27,14 @@ glob.sync(filter, { cwd: __dirname + "/parser" }).forEach(filename => {
var sb = [];
serializeSource(parser.program.sources[0], sb);
var actual = sb.join("") + parser.diagnostics.map(diagnostic => "// " + diagnostic + "\n").join("");;
var actual = sb.join("") + parser.diagnostics.map(diagnostic => "// " + diagnostic + "\n").join("");
var fixture = filename + ".fixture.ts";
if (isCreate) {
fs.writeFileSync(__dirname + "/parser/" + fixture, actual, { encoding: "utf8" });
console.log("Created\n");
} else {
var expected = fs.readFileSync(__dirname + "/parser/" + fixture, { encoding: "utf8" });
var expected = fs.readFileSync(__dirname + "/parser/" + fixture, { encoding: "utf8" }).replace(/\r\n/g, "\n");
var diffs = diff("parser/" + fixture, expected, actual);
if (diffs !== null) {
failed = true;