From e00c3203df99949a36c2c25cb6ac1a5ff3c5aed8 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:41:03 -0400 Subject: [PATCH] toString the buffer --- tests/assertions.ts | 5 ++++- tests/smoke-tests/--typescript.test.ts | 3 ++- tests/smoke-tests/defaults.test.ts | 2 +- tests/utils.ts | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/assertions.ts b/tests/assertions.ts index f953355d..c204d68d 100644 --- a/tests/assertions.ts +++ b/tests/assertions.ts @@ -91,5 +91,8 @@ export async function matchesFixture( let sourceContents = await fs.readFile(testFilePath); let fixtureContents = await fixture(fixtureFile, { scenario }); - expect(sourceContents).to.equal(fixtureContents, `${testFilePath} matches ${fixtureFile}`); + expect(sourceContents.toString()).to.equal( + fixtureContents, + `${testFilePath} matches ${fixtureFile}` + ); } diff --git a/tests/smoke-tests/--typescript.test.ts b/tests/smoke-tests/--typescript.test.ts index b0c07c60..57328eab 100644 --- a/tests/smoke-tests/--typescript.test.ts +++ b/tests/smoke-tests/--typescript.test.ts @@ -1,3 +1,4 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; @@ -34,7 +35,7 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { }); afterAll(async () => { - // await fs.rm(tmpDir, { recursive: true, force: true }); + await fs.rm(tmpDir, { recursive: true, force: true }); }); it('was generated correctly', async () => { diff --git a/tests/smoke-tests/defaults.test.ts b/tests/smoke-tests/defaults.test.ts index 063fc9ba..79031b90 100644 --- a/tests/smoke-tests/defaults.test.ts +++ b/tests/smoke-tests/defaults.test.ts @@ -36,7 +36,7 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { }); afterAll(async () => { - fs.rm(tmpDir, { recursive: true, force: true }); + // fs.rm(tmpDir, { recursive: true, force: true }); }); it('is using the correct packager', async () => { diff --git a/tests/utils.ts b/tests/utils.ts index a73e81fe..f7473229 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -25,7 +25,7 @@ export async function fixture( } ) { let scenario = options?.scenario ?? 'default'; - let fixtureFilePath = path.join(fixturesPath, scenario, file); + let fixtureFilePath = path.isAbsolute(file) ? file : path.join(fixturesPath, scenario, file); let contents = await fs.readFile(fixtureFilePath); return contents.toString();