diff --git a/.changeset/ten-rockets-buy.md b/.changeset/ten-rockets-buy.md new file mode 100644 index 000000000..9a2482f8a --- /dev/null +++ b/.changeset/ten-rockets-buy.md @@ -0,0 +1,5 @@ +--- +'mystmd': patch +--- + +Add end-to-end tests for various DOIs diff --git a/packages/mystmd/tests/endToEnd.spec.ts b/packages/mystmd/tests/endToEnd.spec.ts index 7b26c0f5a..651dcc352 100644 --- a/packages/mystmd/tests/endToEnd.spec.ts +++ b/packages/mystmd/tests/endToEnd.spec.ts @@ -26,28 +26,32 @@ function resolve(relative: string) { return path.resolve(__dirname, relative); } -describe('End-to-end cli export tests', () => { - const cases = loadCases('exports.yml'); - test.each(cases.map((c): [string, TestCase] => [c.title, c]))( - '%s', - async (_, { cwd, command, outputs }) => { - // Clean expected outputs if they already exist - await Promise.all( - outputs.map(async (output) => { - if (fs.existsSync(resolve(output.path))) { - await exec(`rm ${resolve(output.path)}`, { cwd: resolve(cwd) }); - } - }), - ); - // Run CLI command - await exec(command, { cwd: resolve(cwd) }); - // Expect correct output - outputs.forEach((output) => { - expect(fs.existsSync(resolve(output.path))).toBeTruthy(); - expect(fs.readFileSync(resolve(output.path), { encoding: 'utf-8' })).toEqual( - fs.readFileSync(resolve(output.content), { encoding: 'utf-8' }), +describe.concurrent( + 'End-to-end cli export tests', + () => { + const cases = loadCases('exports.yml'); + test.each(cases.map((c): [string, TestCase] => [c.title, c]))( + '%s', + async (_, { cwd, command, outputs }) => { + // Clean expected outputs if they already exist + await Promise.all( + outputs.map(async (output) => { + if (fs.existsSync(resolve(output.path))) { + await exec(`rm ${resolve(output.path)}`, { cwd: resolve(cwd) }); + } + }), ); - }); - }, - ); -}); + // Run CLI command + await exec(command, { cwd: resolve(cwd) }); + // Expect correct output + outputs.forEach((output) => { + expect(fs.existsSync(resolve(output.path))).toBeTruthy(); + expect(fs.readFileSync(resolve(output.path), { encoding: 'utf-8' })).toEqual( + fs.readFileSync(resolve(output.content), { encoding: 'utf-8' }), + ); + }); + }, + ); + }, + { timeout: 15000 }, +);