Skip to content

Commit 47003fd

Browse files
authored
fix: if execution id support requested for node 12, fail open and drop execution id support instead of crashing out (#618)
1 parent 96ae8aa commit 47003fd

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/options.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,13 @@ const ExecutionIdOption = new ConfigurableOption(
146146
(typeof x === 'boolean' && x) ||
147147
(typeof x === 'string' && x.toLowerCase() === 'true');
148148
if (isTrue && !isVersionSatisfied) {
149-
throw new OptionsError(
150-
`Execution id is only supported with Node.js versions ${requiredNodeJsVersionForLogExecutionID} and above. Your current version is ${nodeVersion}. Please upgrade.`
149+
console.warn(
150+
`Execution id is only supported with Node.js versions
151+
${requiredNodeJsVersionForLogExecutionID} and above. Your
152+
current version is ${nodeVersion}. Please upgrade.`
151153
);
154+
console.warn('Proceeding with execution id support disabled...');
155+
return false;
152156
}
153157
return isTrue;
154158
}

test/options.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,12 @@ describe('parseOptions', () => {
193193

194194
executionIdTestData.forEach(testCase => {
195195
it(testCase.name, () => {
196+
const options = parseOptions(testCase.cliOpts, testCase.envVars);
196197
if (
197198
semver.lt(process.versions.node, requiredNodeJsVersionForLogExecutionID)
198199
) {
199-
assert.throws(() => {
200-
parseOptions(testCase.cliOpts, testCase.envVars);
201-
});
200+
assert.strictEqual(options.enableExecutionId, false);
202201
} else {
203-
const options = parseOptions(testCase.cliOpts, testCase.envVars);
204202
assert.strictEqual(options.enableExecutionId, true);
205203
}
206204
});

0 commit comments

Comments
 (0)