UNPKG

@factorialco/shadowdog

Version:

<img src="https://raw.githubusercontent.com/factorialco/shadowdog/refs/heads/main/logo.png" alt="drawing" width="100"/>

88 lines (87 loc) 2.62 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const vitest_1 = require("vitest"); const shadowdog_tag_1 = __importDefault(require("./shadowdog-tag")); (0, vitest_1.beforeAll)(() => { vitest_1.vi.stubEnv('SHADOWDOG_TAG', 'documentation'); }); (0, vitest_1.it)('shadowdog tag filters tasks given a tag from environment variables', () => { const task = { type: 'parallel', tasks: [ { type: 'command', config: { command: 'echo documentation', artifacts: [], tags: ['documentation'], workingDirectory: 'backend', }, files: [], invalidators: { environment: [], files: [], }, }, { type: 'command', config: { command: 'echo graphql', artifacts: [], tags: ['graphql'], workingDirectory: 'backend', }, files: [], invalidators: { environment: [], files: [], }, }, { type: 'command', config: { command: 'echo non tags', artifacts: [], tags: [''], workingDirectory: 'backend', }, files: [], invalidators: { environment: [], files: [], }, }, ], }; (0, vitest_1.expect)(shadowdog_tag_1.default.command(task)).toEqual({ type: 'parallel', tasks: [ { type: 'command', config: { command: 'echo documentation', artifacts: [], tags: ['documentation'], workingDirectory: 'backend', }, files: [], invalidators: { environment: [], files: [], }, }, { type: 'empty', }, { type: 'empty', }, ], }); }); (0, vitest_1.afterAll)(() => { vitest_1.vi.unstubAllEnvs(); });