diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index aedeccf..4868a42 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -14,8 +14,20 @@ // //TODO: test what happens when the connection fails -describe('dummy', () => { - it('test', () => { - console.log('Dummy test') +/** + * Unit tests for the action's entrypoint, src/index.ts + */ + +import * as main from '../src/main' + +// Mock the action's entrypoint +const runMock = jest.spyOn(main, 'run').mockImplementation() + +describe('index', () => { + it('calls run when imported', async () => { + // eslint-disable-next-line @typescript-eslint/no-require-imports + require('../src/index') + + expect(runMock).toHaveBeenCalled() }) }) diff --git a/dist/index.js b/dist/index.js index e53c0d8..8a0c9bd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,22 +1,71 @@ /******/ (() => { // webpackBootstrap /******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 399: +/***/ ((__unused_webpack_module, exports) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.run = void 0; +async function run() { + console.log('PEPE'); +} +exports.run = run; + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ /******/ /* webpack/runtime/compat */ /******/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; /******/ /************************************************************************/ var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.run = void 0; -async function run() { - console.log('PEPE'); -} -exports.run = run; -run(); +/** + * The entrypoint for the action. + */ +const main_1 = __nccwpck_require__(399); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +(0, main_1.run)(); })(); diff --git a/src/index.ts b/src/index.ts index 75fa4a4..b08f970 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,7 @@ -export async function run(): Promise { - console.log('PEPE') -} +/** + * The entrypoint for the action. + */ +import { run } from './main' +// eslint-disable-next-line @typescript-eslint/no-floating-promises run() diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..3a86abc --- /dev/null +++ b/src/main.ts @@ -0,0 +1,5 @@ +import * as core from '@actions/core' + +export async function run(): Promise { + console.log('PEPE') +}