Skip to content

Commit 962db9b

Browse files
author
Csongor Zalatnai
committed
added jest
1 parent 247e89f commit 962db9b

File tree

5 files changed

+2924
-28
lines changed

5 files changed

+2924
-28
lines changed

jest.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
"roots": [
3+
"<rootDir>/src"
4+
],
5+
"transform": {
6+
"^.+\\.tsx?$": "ts-jest"
7+
},
8+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
9+
"moduleFileExtensions": [
10+
"ts",
11+
"tsx",
12+
"js",
13+
"jsx",
14+
"json",
15+
"node"
16+
],
17+
}

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "",
55
"main": "index.ts",
66
"scripts": {
7-
"start": "./node_modules/ts-node/dist/bin.js src/index.ts",
8-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"start": "ts-node src/index.ts",
8+
"test": "jest"
99
},
1010
"author": "Csongor Zalatnai",
1111
"license": "ISC",
@@ -16,7 +16,10 @@
1616
"typescript": "^3.4.3"
1717
},
1818
"devDependencies": {
19-
"@types/node": "^11.13.4"
19+
"@types/jest": "^24.0.11",
20+
"@types/node": "^11.13.4",
21+
"jest": "^24.7.1",
22+
"ts-jest": "^24.0.2"
2023
},
2124
"repository": "[email protected]:zalatnaicsongor/github-metrics-graphite-exporter.git"
2225
}

src/index.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test('test', () => {
2+
expect(true).toBe(true);
3+
});

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class PullRequestData {
1717
}
1818
}
1919

20-
async function queryDb(dbFileName: string) {
20+
async function queryDb(dbFileName: string): Promise<PullRequestData[]> {
2121
const db = await sqlite.open(dbFileName);
2222
const results = await db.all("SELECT * FROM pull_requests");
2323
return results.map((result) => {

0 commit comments

Comments
 (0)