testomatio-reporter-cli 2.9.2 → 2.9.3-beta-vitestmeta
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/package.json +1 -1
- package/src/adapter/vitest.js +4 -1
- package/src/reporter-functions.js +13 -0
package/package.json
CHANGED
package/src/adapter/vitest.js
CHANGED
|
@@ -396,7 +396,10 @@ function normalizeVitestTest(test) {
|
|
|
396
396
|
file,
|
|
397
397
|
suiteTitle,
|
|
398
398
|
logs: '',
|
|
399
|
-
meta:
|
|
399
|
+
meta: {
|
|
400
|
+
...(test.task?.meta || {}),
|
|
401
|
+
...(typeof test.meta === 'function' ? test.meta() : test.meta || {}),
|
|
402
|
+
},
|
|
400
403
|
};
|
|
401
404
|
}
|
|
402
405
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
1
2
|
import { playwrightLogsMarkers } from './adapter/utils/playwright.js';
|
|
2
3
|
import { isPlaywright } from './helpers.js';
|
|
3
4
|
import { services } from './services/index.js';
|
|
4
5
|
import pc from 'picocolors';
|
|
5
6
|
|
|
7
|
+
const requireModule = createRequire(`${process.cwd()}/package.json`);
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* Stores path to file as artifact and uploads it to the S3 storage
|
|
8
11
|
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
@@ -67,6 +70,16 @@ function setKeyValue(keyValue, value = undefined) {
|
|
|
67
70
|
return;
|
|
68
71
|
}
|
|
69
72
|
|
|
73
|
+
if (process.env.VITEST || process.env.VITEST_WORKER_ID) {
|
|
74
|
+
try {
|
|
75
|
+
const vitestTest = requireModule('@vitest/runner').getCurrentTest?.();
|
|
76
|
+
if (vitestTest) {
|
|
77
|
+
Object.assign((vitestTest.meta ||= {}), keyValue);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
} catch {}
|
|
81
|
+
}
|
|
82
|
+
|
|
70
83
|
// in this case keyValue is expected to be an object
|
|
71
84
|
services.keyValues.put(keyValue);
|
|
72
85
|
}
|