Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/debugtopus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Readable } from "stream";
import { ReadableStream } from "stream/web";
import { promisify } from "util";

import ora from "ora";
import { Open } from "unzipper";

import { OCTOMIND_FOLDER_NAME } from "../constants";
Expand Down Expand Up @@ -292,6 +293,8 @@ export const executeLocalTestCases = async (
);
}

const throbber = ora("Generating code").start();

let testCases = readTestCasesFromDir(octomindRoot);
if (options.testCaseId) {
testCases = getFilteredTestCaseWithDependencies(
Expand Down Expand Up @@ -345,6 +348,8 @@ export const executeLocalTestCases = async (

writeFileSync(dirs.configFilePath, config);

throbber.succeed("Code generated");

await runTests({ ...dirs, runMode: options.headless ? "headless" : "ui" });
};

Expand Down
7 changes: 6 additions & 1 deletion src/tools/test-targets.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import path from "path";

import ora from "ora";

import { OCTOMIND_FOLDER_NAME } from "../constants";
import { findOctomindFolder } from "../helpers";
import { getUrl } from "../url";
import { client, handleError, ListOptions, logJson } from "./client";
import { push } from "./sync/push";
import { writeYaml } from "./sync/yaml";
import { readTestCasesFromDir, writeYaml } from "./sync/yaml";

export const getTestTargets = async () => {
const { data, error } = await client.GET("/apiKey/v3/test-targets");
Expand Down Expand Up @@ -87,6 +89,7 @@ export const pushTestTarget = async (
`No ${OCTOMIND_FOLDER_NAME} folder found, please pull first.`,
);
}
const throbber = ora("Pushing test cases").start();

const data = await push({
...options,
Expand All @@ -99,4 +102,6 @@ export const pushTestTarget = async (
if (options.json) {
logJson(data);
}

throbber.succeed("Test cases pushed successfully");
};
15 changes: 15 additions & 0 deletions tests/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { beforeEach, vi } from "vitest";

vi.mock("ora", () => ({
default: vi.fn(() => ({
start: vi.fn().mockReturnThis(),
succeed: vi.fn(),
fail: vi.fn(),
})),
}));

beforeEach(() => {
console.log = vi.fn();
console.warn = vi.fn();
console.error = vi.fn();
});
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export default defineConfig({
globals: true,
environment: 'node',
include: ["tests/**/*.spec.ts"],
setupFiles: ["./tests/setup.ts"],
},
})