test: refactor fixtures

This commit is contained in:
Hiroki Osame
2023-05-03 22:55:58 +09:00
parent 9a841d946f
commit eda3462fec
15 changed files with 20 additions and 29 deletions

View File

@@ -1,4 +1,5 @@
import path from 'path';
import fs from 'fs/promises';
import { execa, execaNode, type Options } from 'execa';
import {
createFixture as createFixtureBase,
@@ -83,3 +84,9 @@ export const assertOpenAiToken = () => {
throw new Error('⚠️ process.env.OPENAI_KEY is necessary to run these tests. Skipping...');
}
};
// See ./diffs/README.md in order to generate diff files
export const getDiff = async (diffName: string): Promise<string> => fs.readFile(
new URL(`fixtures/${diffName}`, import.meta.url),
'utf8',
);