@applitools/core 4.73.3 → 4.74.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/CHANGELOG.md +15 -0
- package/dist/core.js +2 -0
- package/dist/utils/log-env-snapshot.js +214 -0
- package/package.json +2 -2
- package/types/utils/log-env-snapshot.d.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.74.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.73.3...js/core@4.74.0) (2026-11-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* log allowlisted environment variables once at SDK initialization for diagnostics | AD-14135 ([#3883](https://github.com/Applitools-Dev/sdk/issues/3883)) ([f7d04b1](https://github.com/Applitools-Dev/sdk/commit/f7d04b19b016ce2dcd656ca543a30128f3b4b309))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/ufg-client bumped to 1.25.0
|
|
14
|
+
#### Features
|
|
15
|
+
|
|
16
|
+
* update iOS device names for the iOS 27 UFG upgrade | AD-17131 ([#4401](https://github.com/Applitools-Dev/sdk/issues/4401)) ([22ea8f6](https://github.com/Applitools-Dev/sdk/commit/22ea8f6d57d812f8bc1563c6fb459fabfaca38df))
|
|
17
|
+
|
|
3
18
|
## [4.73.3](https://github.com/Applitools-Dev/sdk/compare/js/core@4.73.2...js/core@4.73.3) (2026-10-29)
|
|
4
19
|
|
|
5
20
|
|
package/dist/core.js
CHANGED
|
@@ -45,10 +45,12 @@ const extract_test_environment_1 = require("./utils/extract-test-environment");
|
|
|
45
45
|
const ensure_offline_folder_1 = require("./utils/ensure-offline-folder");
|
|
46
46
|
const validate_sdk_version_1 = require("./utils/validate-sdk-version");
|
|
47
47
|
const memory_usage_logging_1 = require("./utils/memory-usage-logging");
|
|
48
|
+
const log_env_snapshot_1 = require("./utils/log-env-snapshot");
|
|
48
49
|
const take_snapshots_1 = require("./ufg/take-snapshots");
|
|
49
50
|
function makeCore({ spec, clients, base: defaultBase, concurrency = utils.general.getEnvValue('CONCURRENCY', 'number'), environment: defaultEnvironment, agentId = 'core', cwd = process.cwd(), maskLog = false, logger: defaultLogger, asyncCache, } = {}) {
|
|
50
51
|
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core' }, maskLog });
|
|
51
52
|
(0, memory_usage_logging_1.startMemoryUsageLogging)({ logger });
|
|
53
|
+
(0, log_env_snapshot_1.logEnvSnapshot)({ logger });
|
|
52
54
|
const environment = (0, extract_test_environment_1.extractTestEnvironment)(defaultEnvironment);
|
|
53
55
|
const offlineLocationPath = (0, ensure_offline_folder_1.ensureOfflineFolder)();
|
|
54
56
|
logger.log(`[pid=${process.pid} Core is initialized ${defaultBase ? 'with' : 'without'} custom base core ${offlineLocationPath ? `and offline location ${offlineLocationPath} ` : ''}and environment `, environment);
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__resetLogEnvSnapshotForTests = exports.logEnvSnapshot = void 0;
|
|
4
|
+
// Module-level flag: persists for the lifetime of the Node process across multiple makeCore() calls — once-per-process by design.
|
|
5
|
+
let hasLogged = false;
|
|
6
|
+
const APPLITOOLS_DIAGNOSTIC_VARS = [
|
|
7
|
+
'APPLITOOLS_SERVER_URL',
|
|
8
|
+
'APPLITOOLS_BATCH_ID',
|
|
9
|
+
'APPLITOOLS_BATCH_NAME',
|
|
10
|
+
'APPLITOOLS_BATCH_SEQUENCE_NAME',
|
|
11
|
+
'APPLITOOLS_APP_NAME',
|
|
12
|
+
'APPLITOOLS_BUILD_MODE',
|
|
13
|
+
'APPLITOOLS_IS_DISABLED',
|
|
14
|
+
'APPLITOOLS_DONT_CLOSE_BATCHES',
|
|
15
|
+
'APPLITOOLS_BATCH_NOTIFY',
|
|
16
|
+
'APPLITOOLS_CONCURRENCY',
|
|
17
|
+
'APPLITOOLS_CONCURRENT_TABS',
|
|
18
|
+
'APPLITOOLS_RENDER_CONCURRENCY',
|
|
19
|
+
'APPLITOOLS_HTTP_VERSION',
|
|
20
|
+
'APPLITOOLS_LOG_DIR',
|
|
21
|
+
'APPLITOOLS_LOG_FILE',
|
|
22
|
+
'APPLITOOLS_LOG_LEVEL',
|
|
23
|
+
'APPLITOOLS_SHOW_LOGS',
|
|
24
|
+
'APPLITOOLS_LOG_COLORS',
|
|
25
|
+
'APPLITOOLS_MASK_LOG',
|
|
26
|
+
'APPLITOOLS_DEBUG_SCREENSHOTS_DIR',
|
|
27
|
+
'APPLITOOLS_DISABLE_AGENT_CACHIFY',
|
|
28
|
+
'APPLITOOLS_NAMESPACE',
|
|
29
|
+
'APPLITOOLS_FRAMEWORK_PROTOCOL',
|
|
30
|
+
'APPLITOOLS_FRAMEWORK_VERSION',
|
|
31
|
+
'APPLITOOLS_FRAMEWORK_MAJOR_VERSION',
|
|
32
|
+
'APPLITOOLS_USE_DNS_CACHE',
|
|
33
|
+
'APPLITOOLS_USE_SELF_HEALING',
|
|
34
|
+
'APPLITOOLS_SKIP_BRANCH_LOOKUP_IN_SHALLOW_CLONE',
|
|
35
|
+
'APPLITOOLS_ENABLE_BRANCH_LOOKUP_FALLBACK_LIST',
|
|
36
|
+
'APPLITOOLS_BASELINE_BRANCH',
|
|
37
|
+
'APPLITOOLS_PARENT_BRANCH',
|
|
38
|
+
'APPLITOOLS_BASELINE_BRANCH_NAME',
|
|
39
|
+
'APPLITOOLS_PARENT_BRANCH_NAME',
|
|
40
|
+
'APPLITOOLS_BRANCH',
|
|
41
|
+
'APPLITOOLS_BRANCH_NAME',
|
|
42
|
+
'APPLITOOLS_OFFLINE_LOCATION_PATH',
|
|
43
|
+
'APPLITOOLS_OFFLINE_LOG_LIMIT',
|
|
44
|
+
'APPLITOOLS_EYES_SERVER_URL',
|
|
45
|
+
'APPLITOOLS_UFG_SERVER_URL',
|
|
46
|
+
'APPLITOOLS_EXECUTION_CLOUD_URL',
|
|
47
|
+
'APPLITOOLS_EXECUTION_CLOUD_REGION',
|
|
48
|
+
'APPLITOOLS_EG_SERVER_URL',
|
|
49
|
+
'APPLITOOLS_EG_INACTIVITY_TIMEOUT',
|
|
50
|
+
'APPLITOOLS_EG_TIMEOUT',
|
|
51
|
+
'APPLITOOLS_EC_TUNNEL_USE_FRP',
|
|
52
|
+
'APPLITOOLS_TUNNEL_MANAGER_SOCK',
|
|
53
|
+
'APPLITOOLS_EG_TUNNEL_LOG_LEVEL',
|
|
54
|
+
'APPLITOOLS_HEARTBEAT_INTERVAL',
|
|
55
|
+
];
|
|
56
|
+
const APPLITOOLS_SENSITIVE_VARS = [
|
|
57
|
+
'APPLITOOLS_API_KEY',
|
|
58
|
+
'APPLITOOLS_API_KEY_READ',
|
|
59
|
+
'APPLITOOLS_PROXY',
|
|
60
|
+
'APPLITOOLS_PROXY_URL',
|
|
61
|
+
];
|
|
62
|
+
const GIT_CI_VARS = [
|
|
63
|
+
'GITHUB_ACTIONS',
|
|
64
|
+
'GITHUB_HEAD_REF',
|
|
65
|
+
'GITHUB_REF',
|
|
66
|
+
'GITHUB_RUN_ID',
|
|
67
|
+
'CI_COMMIT_REF_NAME',
|
|
68
|
+
'CI_JOB_ID',
|
|
69
|
+
'CIRCLE_BRANCH',
|
|
70
|
+
'CIRCLE_BUILD_NUM',
|
|
71
|
+
'BRANCH_NAME',
|
|
72
|
+
'GIT_BRANCH',
|
|
73
|
+
'BUILD_SOURCEBRANCHNAME',
|
|
74
|
+
'BUILD_BUILDID',
|
|
75
|
+
'BITBUCKET_BRANCH',
|
|
76
|
+
'BITBUCKET_BUILD_NUMBER',
|
|
77
|
+
'TRAVIS_BRANCH',
|
|
78
|
+
'TRAVIS_BUILD_ID',
|
|
79
|
+
'BUILDKITE_BRANCH',
|
|
80
|
+
'BUILDKITE_BUILD_ID',
|
|
81
|
+
'CODEBUILD_WEBHOOK_HEAD_REF',
|
|
82
|
+
'CODEBUILD_BUILD_ID',
|
|
83
|
+
'BUILD_ID',
|
|
84
|
+
'BUILD_NUMBER',
|
|
85
|
+
'BAMBOO',
|
|
86
|
+
];
|
|
87
|
+
const CI_MARKER_VARS = [
|
|
88
|
+
'CI',
|
|
89
|
+
'CONTINUOUS_INTEGRATION',
|
|
90
|
+
'JENKINS_URL',
|
|
91
|
+
'TEAMCITY_VERSION',
|
|
92
|
+
'TF_BUILD',
|
|
93
|
+
'GITLAB_CI',
|
|
94
|
+
];
|
|
95
|
+
const FRAMEWORK_VARS = [
|
|
96
|
+
'PLAYWRIGHT_BROWSERS_PATH',
|
|
97
|
+
'PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD',
|
|
98
|
+
'PLAYWRIGHT_SKIP_BROWSER_GC',
|
|
99
|
+
'PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS',
|
|
100
|
+
'PLAYWRIGHT_HOST_PLATFORM_OVERRIDE',
|
|
101
|
+
'PLAYWRIGHT_DOWNLOAD_HOST',
|
|
102
|
+
'PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST',
|
|
103
|
+
'PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST',
|
|
104
|
+
'PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST',
|
|
105
|
+
'PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT',
|
|
106
|
+
'PLAYWRIGHT_TEST_BASE_URL',
|
|
107
|
+
'PLAYWRIGHT_FORCE_TTY',
|
|
108
|
+
'PLAYWRIGHT_HTML_REPORT',
|
|
109
|
+
'PLAYWRIGHT_HTML_OUTPUT_DIR',
|
|
110
|
+
'PLAYWRIGHT_HTML_OPEN',
|
|
111
|
+
'PWDEBUG',
|
|
112
|
+
'PWTEST_CHILD_PROCESS_TIMEOUT',
|
|
113
|
+
'PWTEST_FORCE_EXIT_TIMEOUT',
|
|
114
|
+
'PWTEST_WATCH',
|
|
115
|
+
'PW_TEST_REPORTER',
|
|
116
|
+
'PW_TEST_REUSE_CONTEXT',
|
|
117
|
+
'PW_TEST_SOURCE_TRANSFORM',
|
|
118
|
+
'PW_TEST_HTML_REPORT_OPEN',
|
|
119
|
+
'PW_TEST_CONNECT_EXPOSE_NETWORK',
|
|
120
|
+
'PW_DISABLE_TS_ESM',
|
|
121
|
+
'PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS',
|
|
122
|
+
'CYPRESS_VERSION',
|
|
123
|
+
'CYPRESS_INSTALL_BINARY',
|
|
124
|
+
'CYPRESS_CACHE_FOLDER',
|
|
125
|
+
'CYPRESS_RUN_BINARY',
|
|
126
|
+
'PUPPETEER_DISABLE_HEADLESS_WARNING',
|
|
127
|
+
'PUPPETEER_EXECUTABLE_PATH',
|
|
128
|
+
'PUPPETEER_SKIP_DOWNLOAD',
|
|
129
|
+
'SELENIUM_REMOTE_URL',
|
|
130
|
+
'SELENIUM_BROWSER',
|
|
131
|
+
'SELENIUM_SERVER_JAR',
|
|
132
|
+
];
|
|
133
|
+
// Remote-browser connect settings routinely embed cloud-grid credentials (tokens in the URL or headers).
|
|
134
|
+
const FRAMEWORK_SENSITIVE_VARS = ['PW_TEST_CONNECT_WS_ENDPOINT', 'PW_TEST_CONNECT_HEADERS'];
|
|
135
|
+
const KNOWN_APPLITOOLS_VARS = new Set([...APPLITOOLS_DIAGNOSTIC_VARS, ...APPLITOOLS_SENSITIVE_VARS]);
|
|
136
|
+
const SENSITIVE_NAME_PATTERN = /KEY|TOKEN|SECRET|PASS|AUTH|PROXY|CREDENTIAL/;
|
|
137
|
+
const MAX_VALUE_LENGTH = 10000;
|
|
138
|
+
function logEnvSnapshot({ logger, env = process.env }) {
|
|
139
|
+
if (hasLogged)
|
|
140
|
+
return;
|
|
141
|
+
hasLogged = true;
|
|
142
|
+
try {
|
|
143
|
+
// Force maskLog: true as defense-in-depth for the env-snapshot block, regardless of the consumer's logger setting.
|
|
144
|
+
const childLogger = logger.extend({ tags: ['env-snapshot'], maskLog: true });
|
|
145
|
+
const groups = [
|
|
146
|
+
{ label: 'applitools', names: APPLITOOLS_DIAGNOSTIC_VARS },
|
|
147
|
+
{ label: 'applitools-sensitive', names: APPLITOOLS_SENSITIVE_VARS, sensitive: true },
|
|
148
|
+
{ label: 'git-ci', names: GIT_CI_VARS },
|
|
149
|
+
{ label: 'ci-markers', names: CI_MARKER_VARS },
|
|
150
|
+
{ label: 'framework', names: FRAMEWORK_VARS },
|
|
151
|
+
{ label: 'framework-sensitive', names: FRAMEWORK_SENSITIVE_VARS, sensitive: true },
|
|
152
|
+
];
|
|
153
|
+
// With masking off the user already accepts raw values in the log, so widen to every
|
|
154
|
+
// APPLITOOLS_* var — this surfaces typos such as APPLITOOLS_LOGS_DIR.
|
|
155
|
+
if (isMaskLogDisabled(env)) {
|
|
156
|
+
const names = Object.keys(env)
|
|
157
|
+
.filter(name => name.startsWith('APPLITOOLS_') && !KNOWN_APPLITOOLS_VARS.has(name))
|
|
158
|
+
.sort();
|
|
159
|
+
groups.push({ label: 'applitools-other', names });
|
|
160
|
+
}
|
|
161
|
+
const isSensitive = (group, name) => group.sensitive || SENSITIVE_NAME_PATTERN.test(name);
|
|
162
|
+
// Two-pass: register every sensitive value with the logger mask set before
|
|
163
|
+
// emitting any line — masking only applies to values registered before the log call.
|
|
164
|
+
for (const group of groups) {
|
|
165
|
+
for (const name of group.names) {
|
|
166
|
+
if (!isSensitive(group, name))
|
|
167
|
+
continue;
|
|
168
|
+
const value = safeRead(env, name);
|
|
169
|
+
if (value)
|
|
170
|
+
childLogger.mask(value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
for (const group of groups) {
|
|
174
|
+
const entries = [];
|
|
175
|
+
for (const name of group.names) {
|
|
176
|
+
const raw = safeRead(env, name);
|
|
177
|
+
if (raw === undefined || raw === '')
|
|
178
|
+
continue;
|
|
179
|
+
// Presence only for secrets, so the snapshot never carries one even when masking is off.
|
|
180
|
+
entries.push([name, isSensitive(group, name) ? '<set>' : trim(raw)]);
|
|
181
|
+
}
|
|
182
|
+
if (entries.length === 0)
|
|
183
|
+
continue;
|
|
184
|
+
childLogger.log(`[env-snapshot:${group.label}] ` + entries.map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(' '));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
// Best-effort diagnostics; never propagate. No re-log here — if `logger` is the
|
|
189
|
+
// source of the throw, calling it again just loops.
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.logEnvSnapshot = logEnvSnapshot;
|
|
193
|
+
function safeRead(env, name) {
|
|
194
|
+
try {
|
|
195
|
+
const v = env[name];
|
|
196
|
+
return typeof v === 'string' ? v : undefined;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Same rule the formatter applies via getEnvValue('MASK_LOG', 'boolean'): any value other than true/1 turns masking off.
|
|
203
|
+
function isMaskLogDisabled(env) {
|
|
204
|
+
const value = safeRead(env, 'APPLITOOLS_MASK_LOG');
|
|
205
|
+
return value !== undefined && value !== 'null' && !['true', '1'].includes(value);
|
|
206
|
+
}
|
|
207
|
+
function trim(value) {
|
|
208
|
+
return value.length <= MAX_VALUE_LENGTH ? value : value.slice(0, MAX_VALUE_LENGTH);
|
|
209
|
+
}
|
|
210
|
+
/** @internal */
|
|
211
|
+
function __resetLogEnvSnapshotForTests() {
|
|
212
|
+
hasLogged = false;
|
|
213
|
+
}
|
|
214
|
+
exports.__resetLogEnvSnapshotForTests = __resetLogEnvSnapshotForTests;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.74.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@applitools/screenshoter": "3.12.36",
|
|
68
68
|
"@applitools/snippets": "2.9.10",
|
|
69
69
|
"@applitools/socket": "1.3.18",
|
|
70
|
-
"@applitools/ufg-client": "1.
|
|
70
|
+
"@applitools/ufg-client": "1.25.0",
|
|
71
71
|
"@applitools/utils": "1.15.3",
|
|
72
72
|
"abort-controller": "3.0.0",
|
|
73
73
|
"chalk": "4.1.2",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
export declare function logEnvSnapshot({ logger, env }: {
|
|
4
|
+
logger: Logger;
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
}): void;
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare function __resetLogEnvSnapshotForTests(): void;
|