docs: fix path #1557
This file contains 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: Unit Tests | |
on: | |
push: | |
branches: | |
- 'main' | |
tags-ignore: | |
- '*.*.*' | |
pull_request: | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x, 18.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Transpile for Node.js ${{ matrix.node-version }} | |
run: | | |
./node_modules/.bin/lerna exec --bail --concurrency 2 -- ../../node_modules/.bin/swc --config-file ../../swc.cjs.config.json --source-maps false index.js --out-file index.cjs | |
./node_modules/.bin/lerna exec --bail --concurrency 2 -- sed -i.bak 's/exports,\ \"default\"/module,\ \"exports\"/g' index.cjs # Fix CommonJS default import | |
sed -i.bak 's/awsEmbeddedMetrics.default.createMetricsLogger/awsEmbeddedMetrics.createMetricsLogger/g' packages/cloudwatch-metrics/index.cjs # Fix CommonJS default import | |
./node_modules/.bin/lerna exec --bail --concurrency 2 -- ../../node_modules/.bin/swc --config-file ../../swc.esm.config.json --source-maps false index.js --out-file index.js | |
./node_modules/.bin/swc --config-file ./swc.cjs.config.json --source-maps false packages/validator/transpile.js --out-file packages/validator/transpile.cjs | |
sed -i.bak 's/exports,\ \"default\"/module,\ \"exports\"/g' packages/validator/transpile.cjs # Fix CommonJS default import | |
./node_modules/.bin/swc --config-file ./swc.esm.config.json --source-maps false packages/validator/transpile.js --out-file packages/validator/transpile.js | |
- name: Unit tests | |
run: | | |
npm run test:packages:unit | |
- name: Test cjs can be required | |
run: | | |
node -e 'const middy = require("./packages/core/index.cjs"); middy()' | |
node -e 'const httpRouterHandler = require("./packages/http-router/index.cjs"); httpRouterHandler([])' | |
node -e 'const {transpileSchema, transpileLocale} = require("./packages/validator/transpile.cjs"); transpileSchema({}); transpileLocale("")' |