一键导入
testing
Jest testing patterns for cli-cm-regex-validate (mocks, fixtures, no live API calls)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Jest testing patterns for cli-cm-regex-validate (mocks, fixtures, no live API calls)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
PR and release checklist for cli-cm-regex-validate (security, packaging, CI, messages)
Contentstack CLI plugin patterns for cm:stacks:validate-regex (SDK, schema, safe-regex, output)
Local and CI workflow for cli-cm-regex-validate — commands, layout, naming, hooks, and merge expectations
Reviews pull requests and risky changes for the contentstack-cli-content-type plugin. Use when reviewing diffs, security-sensitive edits, dependency upgrades, or changes to compare/diagram/temp-file behavior, ESLint, and tests.
Develops and maintains the contentstack-cli-content-type csdx plugin (content-type list, details, audit, compare, compare-remote, diagram). Use when editing this repository, ContentTypeCommand setup and flags, CMA/Management SDK usage, axios audit/references calls, diff/compare HTML output, Graphviz diagrams, or oclif readme/manifest workflows.
Local build, test, lint, coverage, TypeScript layout, ESLint, and oclif-generated docs for contentstack-cli-content-type. Use when changing package.json scripts, tsconfig, .eslintrc, Jest config, README/oclif manifest, or validating before a PR.
| name | testing |
| description | Jest testing patterns for cli-cm-regex-validate (mocks, fixtures, no live API calls) |
test/data/fs, cli-ux, or @contentstack/cli-utilitiesjest.config.ts). Use npm test as the single source of truth.test/utils/; fixtures in test/data/*.json.@contentstack/management, fs, cli-ux, @contentstack/cli-utilities as appropriate; never hit a real stack in unit tests.When using an agent or IDE that supports folder context, open skills/testing/ for test-focused guidance.
This project uses Jest and ts-jest. npm test (Jest) is the canonical test command; CI runs npm test from .github/workflows/unit-tests.yml. The mocha script in package.json is not what CI runs—do not use npm run mocha as the project test entry point.
| Area | Path |
|---|---|
| Tests | test/utils/*.test.ts |
| Fixtures | test/data/*.json |
Mirror utility names where it helps (connect-stack.test.ts vs connect-stack.ts).
npm test — runs Jest with jest.config.ts (roots, testMatch, ts-jest transform, coverage).jest.mock('@contentstack/management') and stub client, stack, and query chains as in connect-stack.test.ts.jest.mock('fs') when testing CSV path creation and writeFileSync / mkdirSync.cli.action.start / stop when asserting spinner behavior; avoid reassigning imported bindings with @ts-ignore—prefer jest.mock('cli-ux', () => ({ ... })) when needed.cliux.print and sanitizePath in output tests when asserting printed messages and paths.require('../data/...') for content type / global field documents and expected invalid-regex rows.data_type, format, nested group / blocks).toHaveBeenCalled, toHaveBeenCalledWith, toStrictEqual for objects and arrays.toHaveBeenCalled over legacy aliases).async/await for utilities that return promises; await inquireAlias / inquireModule when testing interactive flows with mocked inquirer.package.jsonjest under dependencies in package.json. Run tests via npm test and describe the framework as Jest in documentation and for agents.