Skip to content

Commit e87cc39

Browse files
committed
Add jest config and export main.js
1 parent 97fca7f commit e87cc39

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

dist/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ module.exports._enoent = enoent;
378378
/***/ }),
379379

380380
/***/ 31:
381-
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
381+
/***/ (function(module, __unusedexports, __webpack_require__) {
382382

383383
const core = __webpack_require__(470);
384384
const { GitHub, context } = __webpack_require__(469);
@@ -426,7 +426,11 @@ async function run() {
426426
}
427427
}
428428

429-
run();
429+
module.exports = run;
430+
431+
if (require.main === require.cache[eval('__filename')]) {
432+
run();
433+
}
430434

431435

432436
/***/ }),

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,19 @@
3636
"jest": "^24.8.0",
3737
"prettier": "^1.16.4",
3838
"husky": "^3.0.5"
39+
},
40+
"jest": {
41+
"testEnvironment": "node",
42+
"collectCoverageFrom": [
43+
"src/main.js"
44+
],
45+
"coverageThreshold": {
46+
"global": {
47+
"branches": 80,
48+
"functions": 80,
49+
"lines": 80,
50+
"statements": 80
51+
}
52+
}
3953
}
4054
}

src/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ async function run() {
4444
}
4545
}
4646

47-
run();
47+
module.exports = run;
48+
49+
if (require.main === module) {
50+
run();
51+
}

tests/main.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
/* eslint-disable no-undef */
2-
test('that tests work', () => {});
2+
describe('Create release', () => {
3+
test('Create release endpoint is called', async () => {});
4+
5+
test('Outputs are set', async () => {});
6+
});

0 commit comments

Comments
 (0)