2022-01-04 23:12:52 +03:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
const { readFileSync } = require("fs");
|
|
|
|
const { parse } = require("@babel/parser");
|
|
|
|
const { notDeepEqual } = require("assert");
|
2022-01-04 23:12:52 +03:00
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
let [ast1, ast2] = process.argv
|
|
|
|
.slice(2) // skip node executable and script filename
|
|
|
|
.map((file) => readFileSync(file, "utf-8")) // read given files as strings
|
|
|
|
.map((code) => {
|
|
|
|
// console.log(code);
|
|
|
|
return parse(code);
|
|
|
|
}); // parse into ASTs
|
2022-01-04 23:12:52 +03:00
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
notDeepEqual(ast1, ast2); // ensure they're still not equal
|