Merge pull request #579 from hed-standard/dependabot/npm_and_yarn/mai… #200
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test TypeScript Definitions | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test-types: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22.x, lts/*] | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v5 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build the package | |
run: npm run build | |
- name: Pack the package | |
run: npm pack | |
- name: Create test directory | |
run: mkdir -p test-package | |
- name: Install packed package | |
run: | | |
cd test-package | |
npm init -y | |
npm install ../hed-validator-*.tgz | |
npm install typescript @types/node tsx | |
- name: Copy test files and tsconfig | |
run: | | |
cp types/test.ts test-package/ | |
cp types/tsconfig.json test-package/ | |
cp tsconfig.json test-package/tsconfig.base.json | |
cp scripts/runtime-test.template.ts test-package/runtime-test.ts | |
- name: Update tsconfig paths | |
run: | | |
cd test-package | |
sed -i 's|"../tsconfig.json"|"./tsconfig.base.json"|' tsconfig.json | |
sed -i 's|"baseUrl": ".."|"baseUrl": "."|' tsconfig.json | |
- name: Test TypeScript definitions | |
run: | | |
cd test-package | |
npx tsc --project tsconfig.json | |
- name: Test runtime execution (basic smoke test) | |
run: | | |
cd test-package | |
npx tsx runtime-test.ts |