@itwin/build-tools 4.1.0-dev.56 → 4.1.0-dev.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/mocha-reporter/index.js +31 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Change Log - @itwin/build-tools
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 03 Jul 2023 15:28:41 GMT and should not be manually modified.
|
4
|
+
|
5
|
+
## 4.0.3
|
6
|
+
Mon, 03 Jul 2023 15:28:41 GMT
|
7
|
+
|
8
|
+
_Version update only_
|
4
9
|
|
5
10
|
## 4.0.2
|
6
11
|
Wed, 21 Jun 2023 22:04:43 GMT
|
package/mocha-reporter/index.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
2
|
/*---------------------------------------------------------------------------------------------
|
4
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
5
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
@@ -8,10 +7,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
7
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
9
8
|
/* eslint-disable no-console */
|
10
9
|
const debugLeaks = process.env.DEBUG_LEAKS;
|
11
|
-
|
10
|
+
let asyncResourceStats;
|
11
|
+
if (debugLeaks) {
|
12
12
|
require("wtfnode");
|
13
|
-
|
13
|
+
asyncResourceStats = new Map();
|
14
|
+
setupAsyncHooks();
|
15
|
+
}
|
16
|
+
function setupAsyncHooks() {
|
17
|
+
const async_hooks = require("node:async_hooks");
|
18
|
+
const init = (asyncId, type, triggerAsyncId, _resource) => {
|
19
|
+
const eid = async_hooks.executionAsyncId(); // (An executionAsyncId() of 0 means that it is being executed from C++ with no JavaScript stack above it.)
|
20
|
+
const stack = new Error().stack;
|
21
|
+
asyncResourceStats.set(asyncId, { type, eid, triggerAsyncId, initStack: stack });
|
22
|
+
};
|
23
|
+
const destroy = (asyncId) => {
|
24
|
+
if (asyncResourceStats.get(asyncId) === undefined) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
asyncResourceStats.delete(asyncId);
|
28
|
+
};
|
29
|
+
const asyncHook = async_hooks.createHook({ init, destroy });
|
30
|
+
asyncHook.enable();
|
31
|
+
}
|
14
32
|
const fs = require("fs-extra");
|
33
|
+
const path = require("path");
|
15
34
|
const { logBuildWarning, logBuildError, failBuild } = require("../scripts/utils/utils");
|
16
35
|
const Base = require("mocha/lib/reporters/base");
|
17
36
|
const Spec = require("mocha/lib/reporters/spec");
|
@@ -66,6 +85,15 @@ class BentleyMochaReporter extends Spec {
|
|
66
85
|
const wtf = require("wtfnode");
|
67
86
|
wtf.setLogger("info", console.error);
|
68
87
|
wtf.dump();
|
88
|
+
let activeResourcesInfo = process.getActiveResourcesInfo(); // https://nodejs.dev/en/api/v18/process#processgetactiveresourcesinfo (Not added to @types/node yet I suppose)
|
89
|
+
console.error(activeResourcesInfo);
|
90
|
+
activeResourcesInfo = activeResourcesInfo.map((value) => value.toLowerCase());
|
91
|
+
// asyncResourceStats.set(asyncId, {before: 0, after: 0, type, eid, triggerAsyncId, initStack: stack});
|
92
|
+
asyncResourceStats.forEach((value, key) => {
|
93
|
+
if (activeResourcesInfo.includes(value.type.toLowerCase())) {
|
94
|
+
console.error(`asyncId: ${key}: type: ${value.type}, eid: ${value.eid},triggerAsyncId: ${value.triggerAsyncId}, initStack: ${value.initStack}`);
|
95
|
+
}
|
96
|
+
});
|
69
97
|
}
|
70
98
|
else {
|
71
99
|
console.error("Try running with the DEBUG_LEAKS env var set to see open handles.");
|