diff --git a/__tests__/testResultsProcessor.ts b/__tests__/testResultsProcessor.js similarity index 79% rename from __tests__/testResultsProcessor.ts rename to __tests__/testResultsProcessor.js index 60ef63e..bef04b5 100644 --- a/__tests__/testResultsProcessor.ts +++ b/__tests__/testResultsProcessor.js @@ -14,15 +14,14 @@ * limitations under the License. */ -import fs = require('fs'); +/* eslint-disable @typescript-eslint/no-require-imports */ +const fs = require('fs'); module.exports = results => { - const allSkipped = results.testResults.every(result => { - return result.skipped; - }); + const allSkipped = results.testResults.every(result => result.skipped); if (allSkipped) { console.log('All tests were skipped!'); - // create an empty file to signal that all tests were skipped for CI + fs.mkdirSync('./coverage', {recursive: true}); fs.closeSync(fs.openSync('./coverage/allSkipped.txt', 'w')); } return results; diff --git a/jest.config.itg.ts b/jest.config.itg.js similarity index 93% rename from jest.config.itg.ts rename to jest.config.itg.js index 75eb102..a05e702 100644 --- a/jest.config.itg.ts +++ b/jest.config.itg.js @@ -26,6 +26,6 @@ module.exports = { moduleNameMapper: { '^csv-parse/sync': '/node_modules/csv-parse/dist/cjs/sync.cjs' }, - testResultsProcessor: './__tests__/testResultsProcessor.ts', + testResultsProcessor: '/__tests__/testResultsProcessor.js', verbose: false }; diff --git a/jest.config.ts b/jest.config.js similarity index 87% rename from jest.config.ts rename to jest.config.js index bfb1da5..2a4a458 100644 --- a/jest.config.ts +++ b/jest.config.js @@ -14,9 +14,10 @@ * limitations under the License. */ -import fs = require('fs'); -import os = require('os'); -import path = require('path'); +/* eslint-disable @typescript-eslint/no-require-imports */ +const fs = require('fs'); +const os = require('os'); +const path = require('path'); const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-actions-toolkit-')); @@ -28,9 +29,7 @@ process.env = Object.assign({}, process.env, { GITHUB_RUN_NUMBER: 15, RUNNER_TEMP: path.join(tmpDir, 'runner-temp'), RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache') -}) as { - [key: string]: string; -}; +}); module.exports = { clearMocks: true, @@ -46,6 +45,6 @@ module.exports = { }, collectCoverageFrom: ['src/**/{!(index.ts),}.ts'], coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'], - testResultsProcessor: './__tests__/testResultsProcessor.ts', + testResultsProcessor: '/__tests__/testResultsProcessor.js', verbose: true }; diff --git a/package.json b/package.json index 3689f6c..f24e1f0 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ "prettier:fix": "prettier --write \"./**/*.ts\"", "test": "jest", "test:coverage": "jest --coverage", - "test:itg": "jest -c jest.config.itg.ts --runInBand --detectOpenHandles", - "test:itg-list": "jest -c jest.config.itg.ts --listTests", - "test:itg-coverage": "jest --coverage -c jest.config.itg.ts --runInBand --detectOpenHandles" + "test:itg": "jest -c jest.config.itg.js --runInBand", + "test:itg-list": "jest -c jest.config.itg.js --listTests", + "test:itg-coverage": "jest -c jest.config.itg.js --coverage --runInBand" }, "repository": { "type": "git",