diff --git a/src/lib/color.ts b/src/lib/color.ts index 5efeef51..b2e61be9 100644 --- a/src/lib/color.ts +++ b/src/lib/color.ts @@ -1,10 +1,15 @@ import { stdout } from "supports-color"; +var colorEnabled = true; +export const disableColor = () => { + colorEnabled = false; +}; + // The value for the `color` parameter to the `/schema/1` endpoints. export const colorParam = (): string => { return hasColor() ? "ansi" : ""; }; export const hasColor = (): boolean => { - return stdout !== false && stdout.hasBasic; + return colorEnabled && stdout !== false && stdout.hasBasic; }; diff --git a/test/commands/schema.test.js b/test/commands/schema.test.js index 2bd2290d..73c7eb26 100644 --- a/test/commands/schema.test.js +++ b/test/commands/schema.test.js @@ -7,6 +7,7 @@ const fs = require("fs"); const path = require("path"); const { query: q } = require("faunadb"); const { withOpts, getEndpoint, matchFqlReq } = require("../helpers/utils.js"); +const { disableColor } = require("../../src/lib/color"); const main = { version: 0, @@ -40,6 +41,10 @@ const pullfiles = { const updated = { version: 1 }; describe("fauna schema diff test", () => { + before(() => { + disableColor(); + }); + it("runs schema diff", async () => { nock(getEndpoint(), { allowUnmocked: false }) .persist()