verify.test.ts
This file
Path
packages/config/test/verify.test.ts
53 lines · 1.5 KiB · TypeScript
Last changed by
Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 1–53why, one step back1import { NodeServices } from "@effect/platform-node";2import { describe, expect, it } from "@effect/vitest";3import { Effect, FileSystem, Path, Schema } from "effect";45import { repoRoot } from "./root.ts";67const RootPackage = Schema.Struct({8 scripts: Schema.Record(Schema.String, Schema.String),9});1011const rootScripts = Effect.gen(function* () {12 const fs = yield* FileSystem.FileSystem;13 const path = yield* Path.Path;14 const root = yield* repoRoot;15 const text = yield* fs.readFileString(path.join(root, "package.json"));1617 return (yield* Schema.decodeEffect(Schema.fromJsonString(RootPackage))(text))18 .scripts;19});2021describe("verify", () => {22 it.live("runs the product's checks, in order", () =>23 Effect.gen(function* () {24 const scripts = yield* rootScripts;2526 expect(27 (scripts.verify ?? "")28 .split(" && ")29 .map((step) => step.replace("bun run ", ""))30 ).toStrictEqual([31 "lockfile:check",32 "check",33 "typecheck",34 "test",35 "brand:check",36 "bytes:check",37 ]);38 }).pipe(Effect.provide(NodeServices.layer))39 );4041 it.live("names only scripts the root has", () =>42 Effect.gen(function* () {43 const scripts = yield* rootScripts;4445 expect(46 (scripts.verify ?? "")47 .split(" && ")48 .map((step) => step.replace("bun run ", ""))49 .filter((step) => scripts[step] === undefined)50 ).toStrictEqual([]);51 }).pipe(Effect.provide(NodeServices.layer))52 );53});