Skip to content

test: simplify test-async-hooks-http-parser-destroy

Simplify test-async-hooks-http-parser-destroy and improve it's reporting when failing. (Also makes it easier to run on older versions of Node.js because it doesn't rely on internal test modules that won't work there.)

Before, failures looked like this (edited slightly to conform to our commit message 72-char line length restriction):

The expression evaluated to a falsy value:
assert.ok(destroyedIds.indexOf(createdAsyncId) >= 0)

Now, you get a slightly better idea of what's up. (Is it missing one ID? More than one? All of them?):

Input A expected to strictly deep-equal input B:
+ expected - actual ... Lines skipped

  Set {
    1009,
...
    1025,
-   158,
-   159,
-   161,
-   162,
-   164,
-   165,
-   167,
-   168,
-   170,
...
+   159,
+   162,
+   165,
+   168,
+   171,
+   174,
+   177,
+   180,
+   183,

This test still fails as expected on 10.14.1 and passees on 10.14.2 (where the regression it tests for was fixed). (You will need to comment on the require('../common'); line first but that's now the only change you need to make this run in older versions.)

Refs: https://github.com/nodejs/node/issues/26610

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading