@wdio/reporter 8.15.6 → 8.15.7
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/build/index.d.ts.map +1 -1
- package/build/index.js +1 -3
- package/build/supportsColor.d.ts +42 -0
- package/build/supportsColor.d.ts.map +1 -0
- package/build/supportsColor.js +146 -0
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +1 -1
- package/cjs/index.js +1 -3
- package/cjs/package.json +3 -0
- package/cjs/supportsColor.js +153 -0
- package/cjs/utils.js +2 -2
- package/package.json +4 -5
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,aAAa,CAAA;AAIrD,OAAO,UAAU,MAAM,kBAAkB,CAAA;AAEzC,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,WAAW,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEjG,KAAK,iBAAiB,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAA;CAAE,CAAA;AAE7D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,YAAY;IAqB/B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;IApBtD,YAAY,EAAE,WAAW,GAAG,iBAAiB,CAAA;IAC7C,QAAQ,SAAI;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAK;IACvC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAK;IACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAI;IACpC,aAAa,EAAE,UAAU,EAAE,CAAK;IAChC,MAAM;;;;;;;MAOL;IACD,OAAO,SAAI;IACX,UAAU,CAAC,EAAE,WAAW,CAAA;IACxB,gBAAgB,UAAQ;IACxB,KAAK,EAAE,MAAM,EAAE,CAAK;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;gBAED,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;IA2LtD;;;OAGG;IACH,IAAI,cAAc,YAEjB;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,GAAG;IASlB,aAAa,CAAC,WAAW,EAAE,WAAW;IAGtC,eAAe,CAAC,WAAW,EAAE,iBAAiB;IAG9C,cAAc,CAAC,WAAW,EAAE,gBAAgB;IAG5C,YAAY,CAAC,UAAU,EAAE,UAAU;IAGnC,WAAW,CAAC,QAAQ,EAAE,SAAS;IAG/B,SAAS,CAAC,SAAS,EAAE,SAAS;IAG9B,WAAW,CAAC,SAAS,EAAE,SAAS;IAGhC,UAAU,CAAC,SAAS,EAAE,SAAS;IAG/B,UAAU,CAAC,SAAS,EAAE,SAAS;IAG/B,WAAW,CAAC,SAAS,EAAE,SAAS;IAGhC,UAAU,CAAC,SAAS,EAAE,SAAS;IAG/B,SAAS,CAAC,SAAS,EAAE,SAAS;IAG9B,UAAU,CAAC,UAAU,EAAE,UAAU;IAGjC,WAAW,CAAC,WAAW,EAAE,WAAW;CACvC;AAED,OAAO,EACH,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,iBAAiB,EACrE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAChD,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
|
-
import logger from '@wdio/logger';
|
|
4
3
|
import { getErrorsFromEvent } from './utils.js';
|
|
5
4
|
import SuiteStats from './stats/suite.js';
|
|
6
5
|
import HookStats from './stats/hook.js';
|
|
7
6
|
import TestStats from './stats/test.js';
|
|
8
7
|
import RunnerStats from './stats/runner.js';
|
|
9
|
-
const log = logger('WDIOReporter');
|
|
10
8
|
export default class WDIOReporter extends EventEmitter {
|
|
11
9
|
options;
|
|
12
10
|
outputStream;
|
|
@@ -37,7 +35,7 @@ export default class WDIOReporter extends EventEmitter {
|
|
|
37
35
|
fs.mkdirSync(this.options.outputDir, { recursive: true });
|
|
38
36
|
}
|
|
39
37
|
catch (err) {
|
|
40
|
-
|
|
38
|
+
throw new Error(`Couldn't create output directory at "${this.options.outputDir}": ${err.stack}`);
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
this.outputStream = (this.options.stdout || !this.options.logFile) && this.options.writeStream
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* original source: https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js
|
|
3
|
+
*
|
|
4
|
+
* This file was imported due to lacking support of CJS environments in the original package.
|
|
5
|
+
*/
|
|
6
|
+
declare global {
|
|
7
|
+
var Deno: any;
|
|
8
|
+
}
|
|
9
|
+
interface Options {
|
|
10
|
+
/**
|
|
11
|
+
* By default it is `true`, which instructs `supportsColor()` to sniff `process.argv`
|
|
12
|
+
* for the multitude of `--color` flags (see _Info_ below).
|
|
13
|
+
* If `false`, then `process.argv` is not considered when determining color support.
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
sniffFlags?: boolean | undefined;
|
|
17
|
+
isTTY?: boolean | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare function createSupportsColor(stream: {
|
|
20
|
+
isTTY?: boolean;
|
|
21
|
+
}, options?: Options): false | {
|
|
22
|
+
level: number;
|
|
23
|
+
hasBasic: boolean;
|
|
24
|
+
has256: boolean;
|
|
25
|
+
has16m: boolean;
|
|
26
|
+
};
|
|
27
|
+
declare const supportsColor: {
|
|
28
|
+
stdout: boolean | {
|
|
29
|
+
level: number;
|
|
30
|
+
hasBasic: boolean;
|
|
31
|
+
has256: boolean;
|
|
32
|
+
has16m: boolean;
|
|
33
|
+
};
|
|
34
|
+
stderr: boolean | {
|
|
35
|
+
level: number;
|
|
36
|
+
hasBasic: boolean;
|
|
37
|
+
has256: boolean;
|
|
38
|
+
has16m: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export default supportsColor;
|
|
42
|
+
//# sourceMappingURL=supportsColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supportsColor.d.ts","sourceRoot":"","sources":["../src/supportsColor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,CAAC,MAAM,CAAC;IAEX,IAAI,IAAI,EAAE,GAAG,CAAA;CAChB;AAWD,UAAU,OAAO;IACb;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AA4JD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,OAAO,GAAE,OAAY;;;;;EAOrF;AAED,QAAA,MAAM,aAAa;;;;;;;;;;;;;CAGlB,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* original source: https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js
|
|
3
|
+
*
|
|
4
|
+
* This file was imported due to lacking support of CJS environments in the original package.
|
|
5
|
+
*/
|
|
6
|
+
import process from 'node:process';
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import tty from 'node:tty';
|
|
9
|
+
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
|
|
10
|
+
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
|
|
11
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
|
|
12
|
+
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
13
|
+
const position = argv.indexOf(prefix + flag);
|
|
14
|
+
const terminatorPosition = argv.indexOf('--');
|
|
15
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
16
|
+
}
|
|
17
|
+
const { env } = process;
|
|
18
|
+
let flagForceColor;
|
|
19
|
+
if (hasFlag('no-color')
|
|
20
|
+
|| hasFlag('no-colors')
|
|
21
|
+
|| hasFlag('color=false')
|
|
22
|
+
|| hasFlag('color=never')) {
|
|
23
|
+
flagForceColor = 0;
|
|
24
|
+
}
|
|
25
|
+
else if (hasFlag('color')
|
|
26
|
+
|| hasFlag('colors')
|
|
27
|
+
|| hasFlag('color=true')
|
|
28
|
+
|| hasFlag('color=always')) {
|
|
29
|
+
flagForceColor = 1;
|
|
30
|
+
}
|
|
31
|
+
function envForceColor() {
|
|
32
|
+
if ('FORCE_COLOR' in env) {
|
|
33
|
+
if (env.FORCE_COLOR === 'true') {
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
if (env.FORCE_COLOR === 'false') {
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function translateLevel(level) {
|
|
43
|
+
if (level === 0) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
level,
|
|
48
|
+
hasBasic: true,
|
|
49
|
+
has256: level >= 2,
|
|
50
|
+
has16m: level >= 3,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
54
|
+
const noFlagForceColor = envForceColor();
|
|
55
|
+
if (noFlagForceColor !== undefined) {
|
|
56
|
+
flagForceColor = noFlagForceColor;
|
|
57
|
+
}
|
|
58
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
59
|
+
if (forceColor === 0) {
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
if (sniffFlags) {
|
|
63
|
+
if (hasFlag('color=16m')
|
|
64
|
+
|| hasFlag('color=full')
|
|
65
|
+
|| hasFlag('color=truecolor')) {
|
|
66
|
+
return 3;
|
|
67
|
+
}
|
|
68
|
+
if (hasFlag('color=256')) {
|
|
69
|
+
return 2;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Check for Azure DevOps pipelines.
|
|
73
|
+
// Has to be above the `!streamIsTTY` check.
|
|
74
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
|
75
|
+
return 1;
|
|
76
|
+
}
|
|
77
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
const min = forceColor || 0;
|
|
81
|
+
if (env.TERM === 'dumb') {
|
|
82
|
+
return min;
|
|
83
|
+
}
|
|
84
|
+
if (process.platform === 'win32') {
|
|
85
|
+
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
86
|
+
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
87
|
+
const osRelease = os.release().split('.');
|
|
88
|
+
if (Number(osRelease[0]) >= 10
|
|
89
|
+
&& Number(osRelease[2]) >= 10586) {
|
|
90
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
91
|
+
}
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
if ('CI' in env) {
|
|
95
|
+
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
|
|
96
|
+
return 3;
|
|
97
|
+
}
|
|
98
|
+
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
99
|
+
return 1;
|
|
100
|
+
}
|
|
101
|
+
return min;
|
|
102
|
+
}
|
|
103
|
+
if ('TEAMCITY_VERSION' in env) {
|
|
104
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
105
|
+
}
|
|
106
|
+
if (env.COLORTERM === 'truecolor') {
|
|
107
|
+
return 3;
|
|
108
|
+
}
|
|
109
|
+
if (env.TERM === 'xterm-kitty') {
|
|
110
|
+
return 3;
|
|
111
|
+
}
|
|
112
|
+
if ('TERM_PROGRAM' in env) {
|
|
113
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
114
|
+
switch (env.TERM_PROGRAM) {
|
|
115
|
+
case 'iTerm.app': {
|
|
116
|
+
return version >= 3 ? 3 : 2;
|
|
117
|
+
}
|
|
118
|
+
case 'Apple_Terminal': {
|
|
119
|
+
return 2;
|
|
120
|
+
}
|
|
121
|
+
// No default
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (env.TERM && /-256(color)?$/i.test(env.TERM)) {
|
|
125
|
+
return 2;
|
|
126
|
+
}
|
|
127
|
+
if (env.TERM && /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
128
|
+
return 1;
|
|
129
|
+
}
|
|
130
|
+
if ('COLORTERM' in env) {
|
|
131
|
+
return 1;
|
|
132
|
+
}
|
|
133
|
+
return min;
|
|
134
|
+
}
|
|
135
|
+
export function createSupportsColor(stream, options = {}) {
|
|
136
|
+
const level = _supportsColor(stream, {
|
|
137
|
+
streamIsTTY: stream && stream.isTTY,
|
|
138
|
+
...options,
|
|
139
|
+
});
|
|
140
|
+
return translateLevel(level);
|
|
141
|
+
}
|
|
142
|
+
const supportsColor = {
|
|
143
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
144
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) }),
|
|
145
|
+
};
|
|
146
|
+
export default supportsColor;
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEvC;;;;GAIG;AACH,wBAAgB,cAAc,CAAE,GAAG,CAAC,EAAE,MAAM,UAU3C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAE,IAAI,CAAC,EAAE,YAAY,CAAC,mBAAmB,UA0BpE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAA;CAAE,OAQlE;AAED;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAE5C;AAED,wBAAgB,KAAK,CAAE,IAAI,EAAE,MAAM,OAAO,MAAM,EAAE,OAAO,EAAE,MAAM,UAKhE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAE,IAAI,EAAE,MAAM,OAAO,MAAM,EAAE,GAAG,EAAE,MAAM,UAKjE"}
|
package/build/utils.js
CHANGED
package/cjs/index.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.RunnerStats = exports.TestStats = exports.HookStats = exports.SuiteStats = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_events_1 = require("node:events");
|
|
9
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
10
9
|
const utils_js_1 = require("./utils.js");
|
|
11
10
|
const suite_js_1 = __importDefault(require("./stats/suite.js"));
|
|
12
11
|
exports.SuiteStats = suite_js_1.default;
|
|
@@ -16,7 +15,6 @@ const test_js_1 = __importDefault(require("./stats/test.js"));
|
|
|
16
15
|
exports.TestStats = test_js_1.default;
|
|
17
16
|
const runner_js_1 = __importDefault(require("./stats/runner.js"));
|
|
18
17
|
exports.RunnerStats = runner_js_1.default;
|
|
19
|
-
const log = (0, logger_1.default)('WDIOReporter');
|
|
20
18
|
class WDIOReporter extends node_events_1.EventEmitter {
|
|
21
19
|
options;
|
|
22
20
|
outputStream;
|
|
@@ -47,7 +45,7 @@ class WDIOReporter extends node_events_1.EventEmitter {
|
|
|
47
45
|
node_fs_1.default.mkdirSync(this.options.outputDir, { recursive: true });
|
|
48
46
|
}
|
|
49
47
|
catch (err) {
|
|
50
|
-
|
|
48
|
+
throw new Error(`Couldn't create output directory at "${this.options.outputDir}": ${err.stack}`);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
this.outputStream = (this.options.stdout || !this.options.logFile) && this.options.writeStream
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* original source: https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js
|
|
4
|
+
*
|
|
5
|
+
* This file was imported due to lacking support of CJS environments in the original package.
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.createSupportsColor = void 0;
|
|
12
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
13
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
14
|
+
const node_tty_1 = __importDefault(require("node:tty"));
|
|
15
|
+
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
|
|
16
|
+
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
|
|
17
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process_1.default.argv) {
|
|
18
|
+
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
19
|
+
const position = argv.indexOf(prefix + flag);
|
|
20
|
+
const terminatorPosition = argv.indexOf('--');
|
|
21
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
22
|
+
}
|
|
23
|
+
const { env } = node_process_1.default;
|
|
24
|
+
let flagForceColor;
|
|
25
|
+
if (hasFlag('no-color')
|
|
26
|
+
|| hasFlag('no-colors')
|
|
27
|
+
|| hasFlag('color=false')
|
|
28
|
+
|| hasFlag('color=never')) {
|
|
29
|
+
flagForceColor = 0;
|
|
30
|
+
}
|
|
31
|
+
else if (hasFlag('color')
|
|
32
|
+
|| hasFlag('colors')
|
|
33
|
+
|| hasFlag('color=true')
|
|
34
|
+
|| hasFlag('color=always')) {
|
|
35
|
+
flagForceColor = 1;
|
|
36
|
+
}
|
|
37
|
+
function envForceColor() {
|
|
38
|
+
if ('FORCE_COLOR' in env) {
|
|
39
|
+
if (env.FORCE_COLOR === 'true') {
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
if (env.FORCE_COLOR === 'false') {
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function translateLevel(level) {
|
|
49
|
+
if (level === 0) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
level,
|
|
54
|
+
hasBasic: true,
|
|
55
|
+
has256: level >= 2,
|
|
56
|
+
has16m: level >= 3,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
60
|
+
const noFlagForceColor = envForceColor();
|
|
61
|
+
if (noFlagForceColor !== undefined) {
|
|
62
|
+
flagForceColor = noFlagForceColor;
|
|
63
|
+
}
|
|
64
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
65
|
+
if (forceColor === 0) {
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
if (sniffFlags) {
|
|
69
|
+
if (hasFlag('color=16m')
|
|
70
|
+
|| hasFlag('color=full')
|
|
71
|
+
|| hasFlag('color=truecolor')) {
|
|
72
|
+
return 3;
|
|
73
|
+
}
|
|
74
|
+
if (hasFlag('color=256')) {
|
|
75
|
+
return 2;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Check for Azure DevOps pipelines.
|
|
79
|
+
// Has to be above the `!streamIsTTY` check.
|
|
80
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
|
81
|
+
return 1;
|
|
82
|
+
}
|
|
83
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
const min = forceColor || 0;
|
|
87
|
+
if (env.TERM === 'dumb') {
|
|
88
|
+
return min;
|
|
89
|
+
}
|
|
90
|
+
if (node_process_1.default.platform === 'win32') {
|
|
91
|
+
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
92
|
+
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
93
|
+
const osRelease = node_os_1.default.release().split('.');
|
|
94
|
+
if (Number(osRelease[0]) >= 10
|
|
95
|
+
&& Number(osRelease[2]) >= 10586) {
|
|
96
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
97
|
+
}
|
|
98
|
+
return 1;
|
|
99
|
+
}
|
|
100
|
+
if ('CI' in env) {
|
|
101
|
+
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
|
|
102
|
+
return 3;
|
|
103
|
+
}
|
|
104
|
+
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
105
|
+
return 1;
|
|
106
|
+
}
|
|
107
|
+
return min;
|
|
108
|
+
}
|
|
109
|
+
if ('TEAMCITY_VERSION' in env) {
|
|
110
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
111
|
+
}
|
|
112
|
+
if (env.COLORTERM === 'truecolor') {
|
|
113
|
+
return 3;
|
|
114
|
+
}
|
|
115
|
+
if (env.TERM === 'xterm-kitty') {
|
|
116
|
+
return 3;
|
|
117
|
+
}
|
|
118
|
+
if ('TERM_PROGRAM' in env) {
|
|
119
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
120
|
+
switch (env.TERM_PROGRAM) {
|
|
121
|
+
case 'iTerm.app': {
|
|
122
|
+
return version >= 3 ? 3 : 2;
|
|
123
|
+
}
|
|
124
|
+
case 'Apple_Terminal': {
|
|
125
|
+
return 2;
|
|
126
|
+
}
|
|
127
|
+
// No default
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (env.TERM && /-256(color)?$/i.test(env.TERM)) {
|
|
131
|
+
return 2;
|
|
132
|
+
}
|
|
133
|
+
if (env.TERM && /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
134
|
+
return 1;
|
|
135
|
+
}
|
|
136
|
+
if ('COLORTERM' in env) {
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
return min;
|
|
140
|
+
}
|
|
141
|
+
function createSupportsColor(stream, options = {}) {
|
|
142
|
+
const level = _supportsColor(stream, {
|
|
143
|
+
streamIsTTY: stream && stream.isTTY,
|
|
144
|
+
...options,
|
|
145
|
+
});
|
|
146
|
+
return translateLevel(level);
|
|
147
|
+
}
|
|
148
|
+
exports.createSupportsColor = createSupportsColor;
|
|
149
|
+
const supportsColor = {
|
|
150
|
+
stdout: createSupportsColor({ isTTY: node_tty_1.default.isatty(1) }),
|
|
151
|
+
stderr: createSupportsColor({ isTTY: node_tty_1.default.isatty(2) }),
|
|
152
|
+
};
|
|
153
|
+
exports.default = supportsColor;
|
package/cjs/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.colorLines = exports.color = exports.pad = exports.getErrorsFromEvent = exports.sanitizeCaps = exports.sanitizeString = void 0;
|
|
7
|
-
const
|
|
7
|
+
const supportsColor_js_1 = __importDefault(require("./supportsColor.js"));
|
|
8
8
|
const constants_js_1 = require("./constants.js");
|
|
9
9
|
/**
|
|
10
10
|
* replaces whitespaces with underscore and removes dots
|
|
@@ -82,7 +82,7 @@ function pad(str, len) {
|
|
|
82
82
|
}
|
|
83
83
|
exports.pad = pad;
|
|
84
84
|
function color(type, content) {
|
|
85
|
-
if (!
|
|
85
|
+
if (!supportsColor_js_1.default.stdout) {
|
|
86
86
|
return String(content);
|
|
87
87
|
}
|
|
88
88
|
return `\u001b[${constants_js_1.COLORS[type]}m${content}\u001b[0m`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/reporter",
|
|
3
|
-
"version": "8.15.
|
|
3
|
+
"version": "8.15.7",
|
|
4
4
|
"description": "A WebdriverIO utility to help reporting all events",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-reporter",
|
|
@@ -43,10 +43,9 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@types/node": "^20.1.0",
|
|
45
45
|
"@wdio/logger": "8.11.0",
|
|
46
|
-
"@wdio/types": "8.15.
|
|
46
|
+
"@wdio/types": "8.15.7",
|
|
47
47
|
"diff": "^5.0.0",
|
|
48
|
-
"object-inspect": "^1.12.0"
|
|
49
|
-
"supports-color": "9.4.0"
|
|
48
|
+
"object-inspect": "^1.12.0"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"@types/diff": "^5.0.2",
|
|
@@ -55,5 +54,5 @@
|
|
|
55
54
|
"@types/tmp": "^0.2.3",
|
|
56
55
|
"tmp": "^0.2.1"
|
|
57
56
|
},
|
|
58
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "24d8f0dccf54e6e19779094d73eb90ae9086ee86"
|
|
59
58
|
}
|