@alternative-path/testlens-playwright-reporter 0.4.4 → 0.4.6
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/index.d.ts +3 -0
- package/index.js +230 -102
- package/index.ts +236 -104
- package/package.json +2 -1
- package/postinstall.js +49 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alternative-path/testlens-playwright-reporter",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Universal Playwright reporter for TestLens - works with both TypeScript and JavaScript projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"dotenv": "^16.4.5",
|
|
57
57
|
"form-data": "^4.0.1",
|
|
58
58
|
"mime": "^4.0.4",
|
|
59
|
+
"pino": "^9.0.0",
|
|
59
60
|
"tslib": "^2.8.1"
|
|
60
61
|
},
|
|
61
62
|
"engines": {
|
package/postinstall.js
CHANGED
|
@@ -1,39 +1,49 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
//
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const pino = require('pino');
|
|
4
|
+
|
|
5
|
+
const logger = pino({
|
|
6
|
+
level: process.env.LOG_LEVEL || 'info',
|
|
7
|
+
base: null,
|
|
8
|
+
timestamp: false,
|
|
9
|
+
formatters: {
|
|
10
|
+
level: () => ({})
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
// Get the parent project's node_modules/.bin directory
|
|
16
|
+
// When installed, we are in: project/node_modules/testlens-playwright-reporter/
|
|
17
|
+
// We need to go to: project/node_modules/.bin/
|
|
18
|
+
const parentBinDir = path.resolve(__dirname, '..', '.bin');
|
|
19
|
+
const localBinDir = path.resolve(__dirname, 'node_modules', '.bin');
|
|
20
|
+
|
|
21
|
+
// Check if parent bin directory exists
|
|
22
|
+
if (!fs.existsSync(parentBinDir)) {
|
|
23
|
+
logger.info('Parent .bin directory not found, skipping cross-env setup');
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Check if cross-env exists in our node_modules
|
|
28
|
+
const crossEnvCmd = process.platform === 'win32' ? 'cross-env.cmd' : 'cross-env';
|
|
29
|
+
const crossEnvPs1 = 'cross-env.ps1';
|
|
30
|
+
const sourceCmdPath = path.join(localBinDir, crossEnvCmd);
|
|
31
|
+
const sourcePs1Path = path.join(localBinDir, crossEnvPs1);
|
|
32
|
+
|
|
33
|
+
if (fs.existsSync(sourceCmdPath)) {
|
|
34
|
+
const targetCmdPath = path.join(parentBinDir, crossEnvCmd);
|
|
35
|
+
|
|
36
|
+
// Copy the file
|
|
37
|
+
fs.copyFileSync(sourceCmdPath, targetCmdPath);
|
|
38
|
+
logger.info('✓ cross-env binary installed');
|
|
39
|
+
|
|
40
|
+
// Also copy PowerShell script on Windows
|
|
41
|
+
if (process.platform === 'win32' && fs.existsSync(sourcePs1Path)) {
|
|
42
|
+
const targetPs1Path = path.join(parentBinDir, crossEnvPs1);
|
|
43
|
+
fs.copyFileSync(sourcePs1Path, targetPs1Path);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
// Don't fail installation if this doesn't work
|
|
48
|
+
logger.info('Note: Could not setup cross-env automatically:', error.message);
|
|
49
|
+
}
|