Skip to content

Commit

Permalink
feat: ✨ Added jest with TypeScript support
Browse files Browse the repository at this point in the history
- Added a unit test for the helloWorld function
  • Loading branch information
adevinwild committed Feb 14, 2023
1 parent 97690f7 commit e7b5027
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"build": "npm run clean && microbundle",
"dev": "microbundle watch",
"lint": "eslint ./src --ext .ts",
"clean": "rimraf dist"
"clean": "rimraf dist",
"test": "jest ./tests"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"eslint": "^8.34.0",
"jest": "^29.4.2",
"microbundle": "^0.15.1",
"prettier": "^2.8.4",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
}
Expand Down
7 changes: 7 additions & 0 deletions tests/helloWorld.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { helloWorld } from '../src'

describe('helloWorld', () => {
it('returns "Hello World!"', () => {
expect(helloWorld()).toBe('Hello World!')
})
})

0 comments on commit e7b5027

Please sign in to comment.