Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Test

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]

jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [20.x]
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test

- name: Integration test - Start node and test RPC
shell: bash
run: bash scripts/starting-node-test.sh

- name: Upload coverage to Codecov (Ubuntu only)
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ dist/
templates/temp-clone-folder
build/
package-lock.json

# Test coverage
coverage/
*.lcov
27 changes: 27 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/index.ts',
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
transform: {
'^.+\\.ts$': ['ts-jest', {
tsconfig: {
esModuleInterop: true,
allowSyntheticDefaultImports: true,
isolatedModules: true,
},
}],
},
};
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
"clean": "node scripts/clean.js",
"lint": "eslint \"src/**/*.ts\" --ignore-pattern 'node_modules/'",
"lint:fix": "eslint \"src/**/*.ts\" --ignore-pattern 'node_modules/' --fix",
"fmt": "prettier --write '{src,templates,account}/**/*.{js,jsx,ts,tsx,md,json}'"
"fmt": "prettier --write '{src,templates,account}/**/*.{js,jsx,ts,tsx,md,json}'",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
},
"husky": {
"hooks": {
Expand All @@ -54,6 +57,7 @@
},
"devDependencies": {
"@types/adm-zip": "^0.5.5",
"@types/jest": "^30.0.0",
"@types/node": "^20.17.24",
"@types/node-fetch": "^2.6.11",
"@types/semver": "^7.5.7",
Expand All @@ -63,8 +67,10 @@
"@vercel/ncc": "^0.38.3",
"eslint": "^8.57.0",
"husky": "^9.0.11",
"jest": "^30.2.0",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"ts-jest": "^29.4.6",
"ts-node-dev": "^2.0.0",
"typescript": "^5.3.3"
},
Expand Down
Loading
Loading