@naturalcycles/dev-lib 19.6.1 → 19.7.0
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/cfg/collectReporter.js +30 -0
- package/cfg/vitest.config.d.ts +2 -0
- package/cfg/vitest.config.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class CollectReporter {
|
|
2
|
+
onTestModuleEnd(testModule) {
|
|
3
|
+
const shortModuleId = testModule.moduleId.split('/').at(-1)
|
|
4
|
+
|
|
5
|
+
console.log(shortModuleId, Math.round(testModule.diagnostic().collectDuration))
|
|
6
|
+
|
|
7
|
+
const selfTimeMap = {}
|
|
8
|
+
const totalTimeMap = {}
|
|
9
|
+
|
|
10
|
+
Object.entries(testModule.diagnostic().importDurations).forEach(([k, v]) => {
|
|
11
|
+
const short = k.split('/').at(-3) + '/' + k.split('/').at(-2) + '/' + k.split('/').at(-1)
|
|
12
|
+
// if (Math.round(v.totalTime) < 5) return // skip <0.5ms imports
|
|
13
|
+
selfTimeMap[short] = Math.round(v.selfTime)
|
|
14
|
+
totalTimeMap[short] = Math.round(v.totalTime)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const sortedSelfTimeMap = Object.fromEntries(
|
|
18
|
+
Object.entries(selfTimeMap).sort((a, b) => b[1] - a[1]),
|
|
19
|
+
)
|
|
20
|
+
const sortedTotalTimeMap = Object.fromEntries(
|
|
21
|
+
Object.entries(totalTimeMap).sort((a, b) => b[1] - a[1]),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
console.log({ sortedSelfTimeMap })
|
|
25
|
+
console.log({ sortedTotalTimeMap })
|
|
26
|
+
}
|
|
27
|
+
// onTestRunEnd() {
|
|
28
|
+
// console.log('Test run ended')
|
|
29
|
+
// }
|
|
30
|
+
}
|
package/cfg/vitest.config.d.ts
CHANGED
package/cfg/vitest.config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import { VitestAlphabeticSequencer } from './vitestAlphabeticSequencer.js'
|
|
3
3
|
import { defineConfig } from 'vitest/config'
|
|
4
|
+
export { CollectReporter } from './collectReporter.js'
|
|
4
5
|
|
|
5
6
|
const runsInIDE = doesItRunInIDE()
|
|
6
7
|
const testType = getTestType(runsInIDE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/dev-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.7.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@biomejs/biome": "^2",
|
|
7
7
|
"@commitlint/cli": "^19",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@eslint/js": "^9",
|
|
10
10
|
"@inquirer/prompts": "^7",
|
|
11
11
|
"@naturalcycles/js-lib": "^15",
|
|
12
|
-
"@naturalcycles/nodejs-lib": "^15
|
|
12
|
+
"@naturalcycles/nodejs-lib": "^15",
|
|
13
13
|
"@stylistic/eslint-plugin": "^5",
|
|
14
14
|
"@vitest/coverage-v8": "^3",
|
|
15
15
|
"@vitest/eslint-plugin": "^1",
|