Skip to content

fix: if execution id support requested for node 12, fail open and drop execution id support instead of crashing out #618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ const ExecutionIdOption = new ConfigurableOption(
(typeof x === 'boolean' && x) ||
(typeof x === 'string' && x.toLowerCase() === 'true');
if (isTrue && !isVersionSatisfied) {
throw new OptionsError(
`Execution id is only supported with Node.js versions ${requiredNodeJsVersionForLogExecutionID} and above. Your current version is ${nodeVersion}. Please upgrade.`
console.warn(
`Execution id is only supported with Node.js versions
${requiredNodeJsVersionForLogExecutionID} and above. Your
current version is ${nodeVersion}. Please upgrade.`
);
console.warn('Proceeding with execution id support disabled...');
return false;
}
return isTrue;
}
Expand Down
6 changes: 2 additions & 4 deletions test/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,12 @@ describe('parseOptions', () => {

executionIdTestData.forEach(testCase => {
it(testCase.name, () => {
const options = parseOptions(testCase.cliOpts, testCase.envVars);
if (
semver.lt(process.versions.node, requiredNodeJsVersionForLogExecutionID)
) {
assert.throws(() => {
parseOptions(testCase.cliOpts, testCase.envVars);
});
assert.strictEqual(options.enableExecutionId, false);
} else {
const options = parseOptions(testCase.cliOpts, testCase.envVars);
assert.strictEqual(options.enableExecutionId, true);
}
});
Expand Down
Loading