| name | testing |
|---|---|
| description | How to run tests and use env for contentstack-cli-tsgen (Jest, ESLint posttest, integration). |
| Command | What it does |
|---|---|
npm test |
Jest with --testPathPattern=tests; then posttest runs ESLint (package.json) |
npm run test:integration |
Jest only for tests/integration |
npm run prepack |
Build lib/ (required before local csdx plugins:link style workflows) |
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/node.js.yml:
npm ci, optionalnpm run build --if-present, global@contentstack/cli,csdx config:set:region,csdx auth:tokens:add(delivery),npm run prepack,csdx plugins:link,npm testwithTOKEN_ALIASsecret.