mirror of https://github.com/actions/toolkit
Add working Jest & TypeScript config
- Jest now uses ts-jest for transforms - TypeScript compilation via `lerna run tsc`pull/1/head
parent
97bc7918f4
commit
f026c43b81
|
@ -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
|
||||||
|
}
|
|
@ -1326,6 +1326,27 @@
|
||||||
"integrity": "sha512-eAtOAFZefEnfJiRFQBGw1eYqa5GTLCZ1y86N0XSI/D6EB+E8z6VPV/UL7Gi5UEclFqoQk+6NRqEDsfmDLXn8sg==",
|
"integrity": "sha512-eAtOAFZefEnfJiRFQBGw1eYqa5GTLCZ1y86N0XSI/D6EB+E8z6VPV/UL7Gi5UEclFqoQk+6NRqEDsfmDLXn8sg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/jest": {
|
||||||
|
"version": "24.0.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.11.tgz",
|
||||||
|
"integrity": "sha512-2kLuPC5FDnWIDvaJBzsGTBQaBbnDweznicvK7UGYzlIJP4RJR2a4A/ByLUXEyEgag6jz8eHdlWExGDtH3EYUXQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/jest-diff": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/jest-diff": {
|
||||||
|
"version": "20.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/jest-diff/-/jest-diff-20.0.1.tgz",
|
||||||
|
"integrity": "sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "11.13.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.5.tgz",
|
||||||
|
"integrity": "sha512-/OMMBnjVtDuwX1tg2pkYVSqRIDSmNTnvVvmvP/2xiMAAWf4a5+JozrApCrO4WCAILmXVxfNoQ3E+0HJbNpFVGg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/stack-utils": {
|
"@types/stack-utils": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
|
||||||
|
@ -1883,6 +1904,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"bs-logger": {
|
||||||
|
"version": "0.2.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz",
|
||||||
|
"integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"fast-json-stable-stringify": "2.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
"bser": {
|
"bser": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz",
|
||||||
|
@ -6045,6 +6075,12 @@
|
||||||
"pify": "^3.0.0"
|
"pify": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"make-error": {
|
||||||
|
"version": "1.3.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz",
|
||||||
|
"integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"make-fetch-happen": {
|
"make-fetch-happen": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz",
|
||||||
|
@ -8370,6 +8406,34 @@
|
||||||
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=",
|
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"ts-jest": {
|
||||||
|
"version": "24.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-24.0.2.tgz",
|
||||||
|
"integrity": "sha512-h6ZCZiA1EQgjczxq+uGLXQlNgeg02WWJBbeT8j6nyIBRQdglqbvzDoHahTEIiS6Eor6x8mK6PfZ7brQ9Q6tzHw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"bs-logger": "0.x",
|
||||||
|
"buffer-from": "1.x",
|
||||||
|
"fast-json-stable-stringify": "2.x",
|
||||||
|
"json5": "2.x",
|
||||||
|
"make-error": "1.x",
|
||||||
|
"mkdirp": "0.x",
|
||||||
|
"resolve": "1.x",
|
||||||
|
"semver": "^5.5",
|
||||||
|
"yargs-parser": "10.x"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"yargs-parser": {
|
||||||
|
"version": "10.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
|
||||||
|
"integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"camelcase": "^4.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"tslib": {
|
"tslib": {
|
||||||
"version": "1.9.3",
|
"version": "1.9.3",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
|
||||||
|
@ -8406,6 +8470,12 @@
|
||||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
|
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"typescript": {
|
||||||
|
"version": "3.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.4.tgz",
|
||||||
|
"integrity": "sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
"version": "3.5.5",
|
"version": "3.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.5.tgz",
|
||||||
|
|
15
package.json
15
package.json
|
@ -4,18 +4,13 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"jest": {
|
|
||||||
"clearMocks": true,
|
|
||||||
"roots": [
|
|
||||||
"<rootDir>/packages"
|
|
||||||
],
|
|
||||||
"testEnvironment": "node",
|
|
||||||
"testRunner": "jest-circus/runner",
|
|
||||||
"verbose": true
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/jest": "^24.0.11",
|
||||||
|
"@types/node": "^11.13.5",
|
||||||
"jest": "^24.7.1",
|
"jest": "^24.7.1",
|
||||||
"jest-circus": "^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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// const github = require('..');
|
|
||||||
|
|
||||||
describe('@actions/github', () => {
|
|
||||||
it('needs tests', () => {
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { github } from '../src/github';
|
||||||
|
|
||||||
|
describe('@actions/github', () => {
|
||||||
|
it('needs tests', () => {
|
||||||
|
expect(github()).toBe(true)
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,7 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = github;
|
|
||||||
|
|
||||||
function github() {
|
|
||||||
// TODO
|
|
||||||
}
|
|
|
@ -24,7 +24,8 @@
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
"url": "git+https://github.com/actions/toolkit.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
export function github() {
|
||||||
|
return true
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./",
|
||||||
|
"outDir": "./lib",
|
||||||
|
"rootDir": "./src"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"./src"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"strict": true,
|
||||||
|
"declaration": true,
|
||||||
|
"target": "es6",
|
||||||
|
"sourceMap": true,
|
||||||
|
"lib": ["es6"]
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**/*.test.ts"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue