From 0f87498fae47150d4dabd4e6cd6a845a0b577bd2 Mon Sep 17 00:00:00 2001 From: epszaw Date: Fri, 24 May 2024 13:01:56 +0200 Subject: [PATCH] update file system writer test --- .../test/spec/FileSystemAllureWriter.spec.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/allure-js-commons/test/spec/FileSystemAllureWriter.spec.ts b/packages/allure-js-commons/test/spec/FileSystemAllureWriter.spec.ts index 94c6edee6..dd7c75580 100644 --- a/packages/allure-js-commons/test/spec/FileSystemAllureWriter.spec.ts +++ b/packages/allure-js-commons/test/spec/FileSystemAllureWriter.spec.ts @@ -1,7 +1,7 @@ -import { randomUUID } from "crypto"; -import { existsSync, mkdtempSync, readFileSync, readdirSync, writeFileSync } from "fs"; -import * as os from "os"; -import path from "path"; +import { randomUUID } from "node:crypto"; +import { existsSync, mkdtempSync, readFileSync, readdirSync, writeFileSync, rmSync } from "node:fs"; +import * as os from "node:os"; +import path from "node:path"; import { describe, expect, it } from "vitest"; import { AllureNodeReporterRuntime, Config, ContentType, FileSystemAllureWriter } from "../../src/sdk/node/index.js"; @@ -39,7 +39,7 @@ describe("FileSystemAllureWriter", () => { expect(actualContent.toString("utf8")).toBe(data); }); - it("creates allure-report nested path every time writer write something", () => { + it("creates allure-report nested path every time writer write something", async () => { const tmpReportPath = path.join(os.tmpdir(), `./allure-testing-dir/${randomUUID()}`); const config: Config = { writer: new FileSystemAllureWriter({ @@ -48,6 +48,10 @@ describe("FileSystemAllureWriter", () => { }; const runtime = new AllureNodeReporterRuntime(config); + runtime.startTest({}); + runtime.stopTest(); + runtime.writeTest(); + rmSync(tmpReportPath, { recursive: true }); runtime.startTest({}); runtime.stopTest(); runtime.writeTest();