Skip to content

Commit

Permalink
chore: revert task type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
luxass committed Oct 15, 2024
1 parent 0b47daa commit ca4b8b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { DirectoryJSON, TestdirLink, TestdirSymlink } from "./types";
import { readdirSync, readFileSync, rmSync, statSync } from "node:fs";
import { readdir, readFile, rm, stat } from "node:fs/promises";
import { normalize } from "node:path";
import { onTestFinished, type RunnerTask } from "vitest";
import { onTestFinished, type Task } from "vitest";
import { getCurrentTest } from "vitest/suite";
import {
FIXTURE_TYPE_LINK_SYMBOL,
Expand Down Expand Up @@ -171,7 +171,7 @@ export const DIR_REGEX = /[^\w\-]+/g;
* @param {Task} task - The task object.
* @returns {string} The directory name for the task.
*/
export function getDirNameFromTask(task: RunnerTask): string {
export function getDirNameFromTask(task: Task): string {
const fileName = (task.file?.name || "unnamed")
.split("/")
.pop()!
Expand Down
14 changes: 7 additions & 7 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
expect,
it,
onTestFinished,
type RunnerTask,
type Task,
vi,
} from "vitest";
import { getCurrentTest } from "vitest/suite";
Expand Down Expand Up @@ -66,7 +66,7 @@ describe("getDirNameFromTask", () => {
file: {},
name: "should use 'unnamed' as the file name if the task does not have a file name",
suite: { name: "utils" },
} as RunnerTask;
} as Task;

const dirName = getDirNameFromTask(task);

Expand All @@ -80,7 +80,7 @@ describe("getDirNameFromTask", () => {
file: {},
name: "should include suite name in the directory name",
suite: { name: "utils" },
} as RunnerTask;
} as Task;

const dirName = getDirNameFromTask(task);

Expand All @@ -93,7 +93,7 @@ describe("getDirNameFromTask", () => {
const task = {
file: { name: "utils.test.ts" },
name: "should remove '.test.ts' from the file name",
} as RunnerTask;
} as Task;

const dirName = getDirNameFromTask(task);

Expand All @@ -106,7 +106,7 @@ describe("getDirNameFromTask", () => {
const task = {
file: { name: "utils.test.ts" },
name: "should replace ........ æøå non-alphanumeric characters with '-'",
} as RunnerTask;
} as Task;

const dirName = getDirNameFromTask(task);

Expand All @@ -119,7 +119,7 @@ describe("getDirNameFromTask", () => {
const task = {
file: { name: "utils.test.ts" },
name: "should replace trailing hyphens with nothing-",
} as RunnerTask;
} as Task;

const dirName = getDirNameFromTask(task);

Expand All @@ -132,7 +132,7 @@ describe("getDirNameFromTask", () => {
const task = {
file: { name: "utils.test.ts" },
name: "should replace multiple---hyphens with a single hyphen---",
} as RunnerTask;
} as Task;

const dirName = getDirNameFromTask(task);

Expand Down

0 comments on commit ca4b8b2

Please sign in to comment.