-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
test: add deprecation code to expectWarning #19474
Conversation
test/common/README.md
Outdated
|
||
Tests whether `name` and `expected` are part of a raised warning. | ||
Tests whether `name`, `expected`, and 'code' are part of a raised warning. If |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: 'code'
-> `code`
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will fix this.
test/common/README.md
Outdated
|
||
Tests whether `name` and `expected` are part of a raised warning. | ||
Tests whether `name`, `expected`, and 'code' are part of a raised warning. If | ||
an expected warning does not have a code then common.noWarnCode can be used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: common.noWarnCode
-> `common.noWarnCode`
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix this too, thanks.
test/common/README.md
Outdated
@@ -111,8 +111,11 @@ Indicates if there is more than 1gb of total memory. | |||
### expectWarning(name, expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code argument is missing here
test/common/README.md
Outdated
|
||
Tests whether `name` and `expected` are part of a raised warning. | ||
Tests whether `name`, `expected`, and 'code' are part of a raised warning. If | ||
an expected warning does not have a code then common.noWarnCode can be used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap common.noWarnCode
in backticks?
test/common/README.md
Outdated
|
||
Tests whether `name` and `expected` are part of a raised warning. | ||
Tests whether `name`, `expected`, and 'code' are part of a raised warning. If |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backticks for code
instead of quotes
test/common/index.js
Outdated
@@ -633,8 +645,12 @@ function expectWarningByMap(warningMap) { | |||
const catchWarning = {}; | |||
Object.keys(warningMap).forEach((name) => { | |||
let expected = warningMap[name]; | |||
if (typeof expected === 'string') { | |||
expected = [expected]; | |||
if (!(expected instanceof Array)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Array.isArray(expected)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that, will update shortly.
test/common/index.js
Outdated
throw new Error('warningMap entries must be arrays consisting of two ' + | ||
'entries: [message, warningCode]'); | ||
} | ||
if (!(expected[0] instanceof Array)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Should |
I did but then removed it as I was not sure if only functions should be documented. Happy to add it and refer to |
CI after latest updates: https://ci.nodejs.org/job/node-test-pull-request/13822/ |
I've currently looking into node-test-linux-linked-fips20 failure07:52:27 not ok 328 parallel/test-crypto-authenticated
07:52:27 ---
07:52:27 duration_ms: 0.215
07:52:27 severity: fail
07:52:27 stack: |-
07:52:27 1..0 # Skipped: IV len < 12 bytes unsupported in FIPS mode
07:52:27 1..0 # Skipped: IV len < 12 bytes unsupported in FIPS mode
07:52:27 1..0 # Skipped: IV len < 12 bytes unsupported in FIPS mode
07:52:27 Mismatched <anonymous> function calls. Expected exactly 1, actual 0.
07:52:27 at Object.exports.mustCall (/home/iojs/build/workspace/node-test-commit-linux-containered/nodes/ubuntu1604_sharedlibs_fips20_x64/test/common/index.js:427:10)
07:52:27 at expectWarning (/home/iojs/build/workspace/node-test-commit-linux-containered/nodes/ubuntu1604_sharedlibs_fips20_x64/test/common/index.js:618:18)
07:52:27 at Object.keys.forEach (/home/iojs/build/workspace/node-test-commit-linux-containered/nodes/ubuntu1604_sharedlibs_fips20_x64/test/common/index.js:655:26)
07:52:27 at Array.forEach (<anonymous>)
07:52:27 at expectWarningByMap (/home/iojs/build/workspace/node-test-commit-linux-containered/nodes/ubuntu1604_sharedlibs_fips20_x64/test/common/index.js:646:27)
07:52:27 at Object.exports.expectWarning (/home/iojs/build/workspace/node-test-commit-linux-containered/nodes/ubuntu1604_sharedlibs_fips20_x64/test/common/index.js:667:5)
07:52:27 at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-linux-containered/nodes/ubuntu1604_sharedlibs_fips20_x64/test/parallel/test-crypto-authenticated.js:350:8)
07:52:27 at Module._compile (internal/modules/cjs/loader.js:677:30)
07:52:27 at Object.Module._extensions..js (internal/modules/cjs/loader.js:688:10)
07:52:27 (node:16009) [DEP0091] DeprecationWarning: crypto.DEFAULT_ENCODING is deprecated.
07:52:27 (node:16009) [DEP0090] DeprecationWarning: Permitting authentication tag lengths of 0 bytes is deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.
07:52:27 (node:16009) [DEP0090] DeprecationWarning: Permitting authentication tag lengths of 1 bytes is deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.
07:52:27 (node:16009) [DEP0090] DeprecationWarning: Permitting authentication tag lengths of 2 bytes is deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.
07:52:27 (node:16009) [DEP0090] DeprecationWarning: Permitting authentication tag lengths of 6 bytes is deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.
07:52:27 (node:16009) [DEP0090] DeprecationWarning: Permitting authentication tag lengths of 9 bytes is deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.
07:52:27 (node:16009) [DEP0090] DeprecationWarning: Permitting authentication tag lengths of 10 bytes is deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.
07:52:27 (node:16009) [DEP0090] DeprecationWarning: Permitting authentication tag lengths of 11 bytes is deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.
07:52:27 (node:16009) [DEP0090] DeprecationWarning: Permitting authentication tag lengths of 17 bytes is deprecated. Valid GCM tag lengths are 4, 8, 12, 13, 14, 15, 16.
07:52:27 ... |
node-test-commit-aix failure looks unrelatednot ok 706 parallel/test-http-client-timeout-agent
---
duration_ms: 1.819
severity: fail
stack: |-
res#0 data:0
res#0 end
res#2 data:2
res#2 end
res#4 data:4
res#4 end
res#6 data:6
res#6 end
res#8 data:8
res#8 end
res#10 data:10
res#10 end
res#12 data:12
res#12 end
res#14 data:14
res#14 end
res#16 data:16
res#16 end
res#18 data:18
res#18 end
res#20 data:20
res#20 end
res#22 data:22
res#22 end
res#24 data:24
res#24 end
res#26 data:26
res#26 end
res#28 data:28
res#28 end
req#1 timeout
req#3 timeout
req#5 timeout
req#7 timeout
req#9 timeout
req#11 timeout
req#13 timeout
req#15 timeout
req#17 timeout
req#19 timeout
req#21 timeout
req#23 timeout
req#25 timeout
req#27 timeout
req#29 timeout
req#0 timeout
req#2 timeout
req#4 timeout
req#6 timeout
req#8 timeout
req#10 timeout
req#12 timeout
req#14 timeout
req#16 timeout
req#28 close
req#26 close
req#24 close
req#22 close
req#20 close
req#18 close
req#16 close
req#14 close
req#12 close
req#10 close
req#8 close
req#6 close
req#4 close
req#2 close
req#0 close
req#29 error
req#29 close
req#27 error
req#27 close
req#25 error
req#25 close
req#23 error
req#23 close
req#21 error
req#21 close
req#19 error
req#19 close
req#17 error
req#17 close
req#15 error
req#15 close
req#13 error
req#13 close
req#11 error
req#11 close
req#9 error
req#9 close
req#7 error
req#7 close
req#5 error
req#5 close
req#3 error
req#3 close
req#1 error
req#1 close
done=39 sent=30
assert.js:80
throw new AssertionError(obj);
^
AssertionError [ERR_ASSERTION]: timeout on http request called too much
at process.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix61-ppc64/test/parallel/test-http-client-timeout-agent.js:94:10)
at process.emit (events.js:187:15) node-test-commit-arm-fanned failure looks unrelated03:17:11 Checking ^not ok
03:28:30 Agent went offline during the build
03:28:30 ERROR: Connection was broken: java.util.concurrent.TimeoutException: Ping started at 1521789510661 hasn't completed by 1521790110665
03:28:30 at hudson.remoting.PingThread.ping(PingThread.java:134)
03:28:30 at hudson.remoting.PingThread.run(PingThread.java:90)
03:28:30 |
This commit adds a deprecation code to expectWarning and updates the function to check the passed code against the code property on the warning object. Not all warnings have a deprecation code so for those that don't an explicit code of common.noWarnCode is required. Passing this skips the assertion of the code.
dcad716
to
55a7d6a
Compare
freebsd11-x64 failure looks unrelatednot ok 42 async-hooks/test-promise.promise-before-init-hooks
---
duration_ms: 0.356
severity: crashed
stack: |-
oh no!
exit code: CRASHED (Signal: 11) |
Landed in 8fb4ea9. |
This commit adds a deprecation code to expectWarning and updates the function to check the passed code against the code property on the warning object. Not all warnings have a deprecation code so for those that don't an explicit code of common.noWarnCode is required. Passing this skips the assertion of the code. PR-URL: nodejs#19474 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit adds a deprecation code to expectWarning and updates the
function to check the passed code against the code property on the
warning object.
Not all warnings have a deprecation code so for those that don't an
explicit code of common.noWarnCode is required. Passing this skips the
assertion of the code.
This PR follows up on #19317.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes