@naturalcycles/dev-lib 19.15.0 → 19.17.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/summaryReporter.js +26 -0
- package/cfg/vitest.config.d.ts +1 -0
- package/cfg/vitest.config.js +3 -0
- package/dist/bin/out.d.ts +2 -0
- package/dist/bin/out.js +14 -0
- package/package.json +3 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { _ms } from '@naturalcycles/js-lib/datetime'
|
|
2
|
+
|
|
3
|
+
export class SummaryReporter {
|
|
4
|
+
constructor(cfg = {}) {
|
|
5
|
+
this.cfg = cfg
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
onTestRunEnd(testModules) {
|
|
9
|
+
const { count = 5 } = this.cfg
|
|
10
|
+
|
|
11
|
+
let stats = []
|
|
12
|
+
|
|
13
|
+
for (const mod of testModules) {
|
|
14
|
+
const name = mod.moduleId.split('/').at(-1)
|
|
15
|
+
const diag = mod.diagnostic()
|
|
16
|
+
stats.push({ name, ms: diag.duration })
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
stats = stats.sort((a, b) => b.ms - a.ms).slice(0, count)
|
|
20
|
+
|
|
21
|
+
console.log(' Slowest:')
|
|
22
|
+
stats.forEach(({ name, ms }) => {
|
|
23
|
+
console.log(String(_ms(ms)).padStart(10), name)
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
}
|
package/cfg/vitest.config.d.ts
CHANGED
package/cfg/vitest.config.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import { VitestAlphabeticSequencer } from './vitestAlphabeticSequencer.js'
|
|
3
3
|
import { defineConfig } from 'vitest/config'
|
|
4
|
+
import { SummaryReporter } from './summaryReporter.js'
|
|
5
|
+
export { SummaryReporter } from './summaryReporter.js'
|
|
4
6
|
export { CollectReporter } from './collectReporter.js'
|
|
5
7
|
|
|
6
8
|
const runsInIDE = doesItRunInIDE()
|
|
@@ -90,6 +92,7 @@ export const sharedConfig = {
|
|
|
90
92
|
exclude,
|
|
91
93
|
reporters: [
|
|
92
94
|
'default',
|
|
95
|
+
new SummaryReporter(),
|
|
93
96
|
junitReporterEnabled && [
|
|
94
97
|
'junit',
|
|
95
98
|
{
|
package/dist/bin/out.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
try {
|
|
4
|
+
spawnSync('pnpm', ['outdated'], {
|
|
5
|
+
encoding: 'utf8',
|
|
6
|
+
stdio: 'inherit',
|
|
7
|
+
shell: false,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// suppress the error, since `pnpm outdated`
|
|
12
|
+
// returns non-zero exit code if any outdated deps are found,
|
|
13
|
+
// but in fact it's perfectly fine and not an error exit
|
|
14
|
+
}
|
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.17.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@biomejs/biome": "^2",
|
|
7
7
|
"@commitlint/cli": "^19",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"main": "dist/index.js",
|
|
73
73
|
"types": "dist/index.d.ts",
|
|
74
74
|
"bin": {
|
|
75
|
+
"out": "dist/bin/out.js",
|
|
75
76
|
"dev-lib": "dist/bin/dev-lib.js"
|
|
76
77
|
},
|
|
77
78
|
"engines": {
|
|
@@ -97,6 +98,7 @@
|
|
|
97
98
|
"typecheck": "tsx ./src/bin/dev-lib.ts typecheck",
|
|
98
99
|
"clean": "tsx ./src/bin/dev-lib.ts clean",
|
|
99
100
|
"build": "tsx ./src/bin/dev-lib.ts build",
|
|
101
|
+
"out": "tsx ./src/bin/out.ts",
|
|
100
102
|
"test": "tsx ./src/bin/dev-lib.ts test",
|
|
101
103
|
"test-leaks": "tsx ./src/bin/dev-lib.ts test-leaks",
|
|
102
104
|
"test-integration": "tsx ./src/bin/dev-lib.ts test-integration",
|