Skip to content

Commit

Permalink
chore: silence node end of life warning in tests (#4077)
Browse files Browse the repository at this point in the history
Currently tests are failing with end of life warning messages. This PR is adding env variable for tests to silence these errors.

---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
  • Loading branch information
vinayak-kukreja committed May 4, 2023
1 parent 361428a commit cc6d294
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/@jsii/check-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ export function checkNode(envPrefix = 'JSII'): void {
'Should you encounter odd runtime issues, please try using one of the supported release before filing a bug report.';

if (nodeRelease?.endOfLife) {
const silenceVariable = `${envPrefix}_SILENCE_WARNING_END_OF_LIFE_NODE_VERSION`;
const acknowledgeNodeEol =
'Node14 is now end of life (EOL) as of April 30, 2023. Support of EOL runtimes are only guaranteed for 30 days after EOL. By silencing this warning you acknowledge that you are using an EOL version of Node and will upgrade to a supported version as soon as possible.';
const qualifier = nodeRelease.endOfLifeDate
? ` on ${nodeRelease.endOfLifeDate.toISOString().slice(0, 10)}`
: '';
veryVisibleMessage(
bgRed.white.bold,
`Node ${nodeRelease.majorVersion} has reached end-of-life${qualifier} and is not supported.`,
`Please upgrade to a supported node version as soon as possible.`,
);
if (!(process.env[silenceVariable] === acknowledgeNodeEol))
veryVisibleMessage(
bgRed.white.bold,
`Node ${nodeRelease.majorVersion} has reached end-of-life${qualifier} and is not supported.`,
`Please upgrade to a supported node version as soon as possible.`,
);
} else if (knownBroken) {
const silenceVariable = `${envPrefix}_SILENCE_WARNING_KNOWN_BROKEN_NODE_VERSION`;
if (!process.env[silenceVariable])
Expand Down
4 changes: 4 additions & 0 deletions packages/@jsii/python-runtime/tests/test_invoke_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ def silence_node_deprecation_warnings():
"JSII_SILENCE_WARNING_KNOWN_BROKEN_NODE_VERSION",
"JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION",
"JSII_SILENCE_WARNING_DEPRECATED_NODE_VERSION",
"JSII_SILENCE_WARNING_END_OF_LIFE_NODE_VERSION",
]

store = {var: environ.get(var, "") for var in variables}

for var in variables:
environ[var] = "1"

nodeEolAcknowledgement = "Node14 is now end of life (EOL) as of April 30, 2023. Support of EOL runtimes are only guaranteed for 30 days after EOL. By silencing this warning you acknowledge that you are using an EOL version of Node and will upgrade to a supported version as soon as possible."
environ["JSII_SILENCE_WARNING_END_OF_LIFE_NODE_VERSION"] = nodeEolAcknowledgement

# Execute the test
yield

Expand Down

0 comments on commit cc6d294

Please sign in to comment.