@esimplicity/stack-tests 0.1.2 → 0.1.3
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 +5 -3
- package/scripts/postinstall.cjs +85 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esimplicity/stack-tests",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,11 +38,13 @@
|
|
|
38
38
|
"cli"
|
|
39
39
|
],
|
|
40
40
|
"files": [
|
|
41
|
-
"dist"
|
|
41
|
+
"dist",
|
|
42
|
+
"scripts"
|
|
42
43
|
],
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "tsup",
|
|
45
|
-
"clean": "rm -rf dist"
|
|
46
|
+
"clean": "rm -rf dist",
|
|
47
|
+
"postinstall": "node scripts/postinstall.cjs"
|
|
46
48
|
},
|
|
47
49
|
"peerDependencies": {
|
|
48
50
|
"@playwright/test": "^1.49.0",
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
|
|
6
|
+
// ANSI color codes
|
|
7
|
+
const RESET = '\x1b[0m';
|
|
8
|
+
const BOLD = '\x1b[1m';
|
|
9
|
+
const RED = '\x1b[31m';
|
|
10
|
+
const YELLOW = '\x1b[33m';
|
|
11
|
+
const GREEN = '\x1b[32m';
|
|
12
|
+
const CYAN = '\x1b[36m';
|
|
13
|
+
const BG_YELLOW = '\x1b[43m';
|
|
14
|
+
const BG_RED = '\x1b[41m';
|
|
15
|
+
const BLACK = '\x1b[30m';
|
|
16
|
+
|
|
17
|
+
function checkCommand(cmd) {
|
|
18
|
+
try {
|
|
19
|
+
execSync(`which ${cmd}`, { stdio: 'pipe' });
|
|
20
|
+
return true;
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Strip ANSI codes for length calculation
|
|
27
|
+
function stripAnsi(str) {
|
|
28
|
+
return str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function printBox(lines, color = YELLOW) {
|
|
32
|
+
const maxLen = Math.max(...lines.map(l => stripAnsi(l).length));
|
|
33
|
+
const border = '═'.repeat(maxLen + 2);
|
|
34
|
+
|
|
35
|
+
console.log(`${color}╔${border}╗${RESET}`);
|
|
36
|
+
for (const line of lines) {
|
|
37
|
+
const visibleLen = stripAnsi(line).length;
|
|
38
|
+
const padding = ' '.repeat(maxLen - visibleLen);
|
|
39
|
+
console.log(`${color}║${RESET} ${line}${padding} ${color}║${RESET}`);
|
|
40
|
+
}
|
|
41
|
+
console.log(`${color}╚${border}╝${RESET}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function main() {
|
|
45
|
+
// Allow testing with --test-warning flag
|
|
46
|
+
const testWarning = process.argv.includes('--test-warning');
|
|
47
|
+
const hasTmux = testWarning ? false : checkCommand('tmux');
|
|
48
|
+
const warnings = [];
|
|
49
|
+
|
|
50
|
+
// Check for tmux (needed for TUI testing)
|
|
51
|
+
if (!hasTmux) {
|
|
52
|
+
warnings.push({
|
|
53
|
+
title: 'tmux NOT FOUND',
|
|
54
|
+
lines: [
|
|
55
|
+
`${BOLD}TUI testing requires tmux${RESET}`,
|
|
56
|
+
'',
|
|
57
|
+
'If you plan to use @tui tests, install tmux:',
|
|
58
|
+
'',
|
|
59
|
+
` ${CYAN}macOS:${RESET} brew install tmux`,
|
|
60
|
+
` ${CYAN}Ubuntu/Debian:${RESET} sudo apt-get install tmux`,
|
|
61
|
+
` ${CYAN}Fedora/RHEL:${RESET} sudo dnf install tmux`,
|
|
62
|
+
'',
|
|
63
|
+
`${YELLOW}Skip this if you only use @api, @ui, or @hybrid tests.${RESET}`,
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Print warnings if any
|
|
69
|
+
if (warnings.length > 0) {
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log(`${BG_YELLOW}${BLACK}${BOLD} WARNING ${RESET}`);
|
|
72
|
+
console.log('');
|
|
73
|
+
|
|
74
|
+
for (const warning of warnings) {
|
|
75
|
+
printBox(warning.lines, YELLOW);
|
|
76
|
+
console.log('');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Always show success message
|
|
81
|
+
console.log(`${GREEN}${BOLD}@esimplicityinc/stack-tests${RESET} installed successfully!`);
|
|
82
|
+
console.log('');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
main();
|