Skip to content

Commit

Permalink
Added jest test framework
Browse files Browse the repository at this point in the history
  • Loading branch information
spennyp committed Oct 16, 2024
1 parent 99364a7 commit 097e970
Show file tree
Hide file tree
Showing 5 changed files with 2,711 additions and 66 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Install Dependencies
pnpm i
```

Run Tests
```bash
pnpm test
```

Build
```bash
pnpm build
Expand Down
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
preset: 'ts-jest/presets/default-esm', // Preset for ESM support with ts-jest
testEnvironment: 'node', // Test environment
extensionsToTreatAsEsm: ['.ts', '.tsx'], // Treat TypeScript files as ESM
transform: {
'^.+\\.ts?$': ['ts-jest', { // Configure ts-jest directly in transform
useESM: true // Set ESM mode directly here
}]
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testMatch: ['**/__tests__/**/*.test.ts?(x)', '**/?(*.)+(test).ts?(x)']
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
},
"scripts": {
"build": "tsc",
"docgen": "typedoc"
"docgen": "typedoc",
"test": "jest"
},
"keywords": [],
"author": "Paperclip Labs",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.13",
"@types/react": "^18.3.11",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"typedoc": "^0.26.10",
"typescript": "^5.6.3"
},
Expand Down
Loading

0 comments on commit 097e970

Please sign in to comment.