diff --git a/tests/assertions.ts b/tests/assertions.ts index f1461ed4..94783f4b 100644 --- a/tests/assertions.ts +++ b/tests/assertions.ts @@ -3,7 +3,7 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import { expect } from 'vitest'; -import { fixture, packageJsonAt } from './utils.js'; +import { packageJsonAt, readFixture } from './utils.js'; interface AssertGeneratedOptions { projectRoot: string; @@ -88,7 +88,7 @@ export async function matchesFixture( } let sourceContents = (await fs.readFile(testFilePath)).toString(); - let fixtureContents = await fixture(fixtureFile, { scenario }); + let fixtureContents = await readFixture(fixtureFile, { scenario }); /** * We trim because whether or not the source or fixture has diff --git a/tests/utils.ts b/tests/utils.ts index 9c0341d3..69b32aab 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -13,7 +13,15 @@ const fixturesPath = path.join(__dirname, 'fixtures'); export const SUPPORTED_PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm'] as const; -export async function fixture( +/** + * Returns the contents of a file from the "tests/fixtures" directory. + * The "tests/fixtures" directory contains sub-directories, "scenarios". + * This is we can have different sets of fixtures, depending on what we're testing. + * + * The default scenario is "default", and represents the the file contents when we provide + * no arguments to the blueprint + */ +export async function readFixture( /** * Which file within in the fixture-set / scenario to read */