Feature: hopp-cli in TypeScript (#2074)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com> Co-authored-by: liyasthomas <liyascthomas@gmail.com> Co-authored-by: Gita Alekhya Paul <gitaalekhyapaul@gmail.com>
This commit is contained in:
24
packages/hoppscotch-cli/src/commands/test.ts
Normal file
24
packages/hoppscotch-cli/src/commands/test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as TE from "fp-ts/TaskEither";
|
||||
import { pipe, flow } from "fp-ts/function";
|
||||
import {
|
||||
collectionsRunner,
|
||||
collectionsRunnerExit,
|
||||
collectionsRunnerResult,
|
||||
} from "../utils/collections";
|
||||
import { handleError } from "../handlers/error";
|
||||
import { checkFilePath } from "../utils/checks";
|
||||
import { parseCollectionData } from "../utils/mutators";
|
||||
|
||||
export const test = (path: string) => async () => {
|
||||
await pipe(
|
||||
path,
|
||||
checkFilePath,
|
||||
TE.chain(parseCollectionData),
|
||||
TE.chainTaskK(collectionsRunner),
|
||||
TE.chainW(flow(collectionsRunnerResult, collectionsRunnerExit, TE.of)),
|
||||
TE.mapLeft((e) => {
|
||||
handleError(e);
|
||||
process.exit(1);
|
||||
})
|
||||
)();
|
||||
};
|
||||
Reference in New Issue
Block a user