neater test output

pull/3943/head
Richard Harris 5 years ago
parent a7c0fc8c35
commit 39bbac4393

@ -15,17 +15,17 @@ describe("js", () => {
throw new Error("Forgot to remove `solo: true` from test"); throw new Error("Forgot to remove `solo: true` from test");
} }
dir = path.resolve(`${__dirname}/samples`, dir); const resolved = path.resolve(`${__dirname}/samples`, dir);
if (!fs.existsSync(`${dir}/input.svelte`)) { if (!fs.existsSync(`${resolved}/input.svelte`)) {
console.log(colors.red().bold(`Missing file ${dir}/input.svelte. If you recently switched branches you may need to delete this directory`)); console.log(colors.red().bold(`Missing file ${dir}/input.svelte. If you recently switched branches you may need to delete this directory`));
return; return;
} }
(solo ? it.only : it)(dir, () => { (solo ? it.only : it)(dir, () => {
const config = loadConfig(`${dir}/_config.js`); const config = loadConfig(`${resolved}/_config.js`);
const input = fs.readFileSync(`${dir}/input.svelte`, "utf-8").replace(/\s+$/, ""); const input = fs.readFileSync(`${resolved}/input.svelte`, "utf-8").replace(/\s+$/, "");
let actual; let actual;
@ -38,10 +38,10 @@ describe("js", () => {
throw err; throw err;
} }
const output = `${dir}/_actual.js`; const output = `${resolved}/_actual.js`;
fs.writeFileSync(output, actual); fs.writeFileSync(output, actual);
const expectedPath = `${dir}/expected.js`; const expectedPath = `${resolved}/expected.js`;
let expected = ''; let expected = '';
try { try {

Loading…
Cancel
Save