| name | testing |
|---|---|
| description | How to run tests and use env for contentstack-cli-tsgen (Jest, ESLint posttest, integration). |
This package is the only cli-plugins package that uses Jest (other plugins use Mocha).
| Command | What it does |
|---|---|
pnpm test |
Jest with --testPathPattern=tests; then posttest runs ESLint |
pnpm run test:integration |
Jest only for tests/integration |
pnpm run build |
Build lib/ (required before local csdx plugins:link) |
From repo root, prefix with pnpm --filter contentstack-cli-tsgen.
jest.config.js: ts-jest,testEnvironment: node.
- tests/integration/tsgen.integration.test.ts spawns
csdx tsgenwithTOKEN_ALIAS. - Loads
.envfrom package root viadotenv(pathrelative to test file).TOKEN_ALIASmust be defined or the suite throws at load time.
.github/workflows/tsgen-integration-test.yml:pnpm install,pnpm --filter contentstack-cli-tsgen run build, global@contentstack/cli@beta,csdx config:set:region,csdx auth:tokens:add(delivery),csdx plugins:link,pnpm --filter contentstack-cli-tsgen run test:integrationwithTOKEN_ALIASsecret.- Lint on PR:
.github/workflows/unit-test.yml→pnpm run lintin this package.