Skip to content

Commit

Permalink
Add working Jest & TypeScript config
Browse files Browse the repository at this point in the history
- Jest now uses ts-jest for transforms
- TypeScript compilation via `lerna run tsc`
  • Loading branch information
jclem committed Apr 19, 2019
1 parent 97bc791 commit f026c43
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 27 deletions.
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
roots: ['<rootDir>/packages'],
testEnvironment: 'node',
testMatch: ['**/__tests__/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}
70 changes: 70 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@
"scripts": {
"test": "jest"
},
"jest": {
"clearMocks": true,
"roots": [
"<rootDir>/packages"
],
"testEnvironment": "node",
"testRunner": "jest-circus/runner",
"verbose": true
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/node": "^11.13.5",
"jest": "^24.7.1",
"jest-circus": "^24.7.1",
"lerna": "^3.13.3"
"lerna": "^3.13.3",
"ts-jest": "^24.0.2",
"typescript": "^3.4.4"
}
}
9 changes: 0 additions & 9 deletions packages/github/__tests__/github.test.js

This file was deleted.

7 changes: 7 additions & 0 deletions packages/github/__tests__/github.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { github } from '../src/github';

describe('@actions/github', () => {
it('needs tests', () => {
expect(github()).toBe(true)
});
});
7 changes: 0 additions & 7 deletions packages/github/lib/github.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"url": "git+https://github.com/actions/toolkit.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
Expand Down
3 changes: 3 additions & 0 deletions packages/github/src/github.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function github() {
return true
}
11 changes: 11 additions & 0 deletions packages/github/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./lib",
"rootDir": "./src"
},
"include": [
"./src"
]
}
14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"strict": true,
"declaration": true,
"target": "es6",
"sourceMap": true,
"lib": ["es6"]
},
"exclude": [
"node_modules",
"**/*.test.ts"
]
}

0 comments on commit f026c43

Please sign in to comment.