diff --git a/dist/index.js b/dist/index.js index 5435f28..4ffe0b9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5853,22 +5853,31 @@ function requirePeerDependency(dependency) { } // src/run-tester.ts -var INTERNAL_CONFIG = "eslint-remote-tester-compare-internal.config.js"; +var INTERNAL_CONFIG = "./eslint-remote-tester-runner-internal.config.js"; var RESULTS_TMP = "/tmp/results.json"; var DEFAULT_CONFIG = { cache: false, CI: true }; -var CONFIGURATION_TEMPLATE = (configuration, configurationPath) => `// Generated by eslint-remote-tester-run-action +var CONFIGURATION_TEMPLATE = (pathToUsersConfiguration) => `// Generated by eslint-remote-tester-run-action const fs = require('fs'); +// Load user's eslint-remote-tester.config.js +const usersConfig = require('${pathToUsersConfiguration}'); + module.exports = { - ...${JSON.stringify(configuration, null, 4)}, + ...usersConfig, + + // Values from eslint-remote-tester-run-action's default configuration + ...${JSON.stringify(DEFAULT_CONFIG, null, 4)}, + onComplete: async function onComplete(results, comparisonResults) { + // Write results to cache fs.writeFileSync('${RESULTS_TMP}', JSON.stringify(results || [])); - // User provided onComplete is injected here if present - ${configuration.onComplete ? `await require('${configurationPath}').onComplete(results, comparisonResults);` : "// No onComplete detected"} + if(usersConfig.onComplete) { + await usersConfig.onComplete(results, comparisonResults); + } } }; `; @@ -5880,20 +5889,16 @@ async function runTester(configLocation) { if (!import_fs.default.existsSync(usersConfigLocation)) { throw new Error(`Unable to find eslint-remote-tester config with path ${usersConfigLocation}`); } - let usersConfig; + import_fs.default.writeFileSync(INTERNAL_CONFIG, CONFIGURATION_TEMPLATE(usersConfigLocation)); + let config; try { - usersConfig = require(usersConfigLocation); + config = require(import_path2.default.resolve(INTERNAL_CONFIG)); } catch (e) { throw e; } - const config = { - ...DEFAULT_CONFIG, - ...usersConfig - }; - import_fs.default.writeFileSync(INTERNAL_CONFIG, CONFIGURATION_TEMPLATE(config, usersConfigLocation)); const {validateConfig} = requirePeerDependency("eslint-remote-tester"); await validateConfig(config, false); - await import_exec.exec(`${ESLINT_REMOTE_TESTER_BIN} --config ./${INTERNAL_CONFIG}`, [], { + await import_exec.exec(`${ESLINT_REMOTE_TESTER_BIN} --config ${INTERNAL_CONFIG}`, [], { ignoreReturnCode: true, env: {...process.env, NODE_OPTIONS: "--max_old_space_size=5120"} });