@applitools/core-base
Advanced tools
Comparing version 1.9.0 to 1.9.1
# Changelog | ||
## [1.9.1](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core-base@1.9.0...js/core-base@1.9.1) (2024-02-29) | ||
### Bug Fixes | ||
* fixed url concatenation logic ([#2197](https://github.com/applitools/eyes.sdk.javascript1/issues/2197)) ([c3b2e0a](https://github.com/applitools/eyes.sdk.javascript1/commit/c3b2e0ad47f002978544eaac759a80f18f7c5ee3)) | ||
### Dependencies | ||
* @applitools/req bumped to 1.6.5 | ||
#### Bug Fixes | ||
* fixed url concatenation logic ([#2197](https://github.com/applitools/eyes.sdk.javascript1/issues/2197)) ([c3b2e0a](https://github.com/applitools/eyes.sdk.javascript1/commit/c3b2e0ad47f002978544eaac759a80f18f7c5ee3)) | ||
## [1.9.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core-base@1.8.0...js/core-base@1.9.0) (2024-01-16) | ||
@@ -4,0 +19,0 @@ |
@@ -54,3 +54,8 @@ "use strict"; | ||
if (branchName && parentBranchName && branchName !== parentBranchName) { | ||
settings.gitBranchingTimestamp = await (0, extract_branching_timestamp_1.extractBranchingTimestamp)({ branchName, parentBranchName }, { cwd }); | ||
settings.gitBranchingTimestamp = await (0, extract_branching_timestamp_1.extractBranchingTimestamp)({ | ||
branchName, | ||
parentBranchName, | ||
execOptions: { cwd }, | ||
logger, | ||
}); | ||
logger.log('Branching timestamp successfully extracted', settings.gitBranchingTimestamp); | ||
@@ -57,0 +62,0 @@ } |
@@ -61,3 +61,3 @@ "use strict"; | ||
const initializedAt = new Date().toISOString(); | ||
const response = await req('/api/sessions/running', { | ||
const response = await req('./api/sessions/running', { | ||
name: 'openEyes', | ||
@@ -150,3 +150,3 @@ method: 'POST', | ||
const initializedAt = new Date().toISOString(); | ||
const response = await req('/api/sessions/running', { | ||
const response = await req('./api/sessions/running', { | ||
name: 'openFunctionalSession', | ||
@@ -220,3 +220,3 @@ method: 'POST', | ||
target.image = await upload({ name: 'image', resource: target.image }); | ||
const response = await req('/api/locators/locate', { | ||
const response = await req('./api/locators/locate', { | ||
name: 'locate', | ||
@@ -258,3 +258,3 @@ method: 'POST', | ||
]); | ||
const response = await req('/api/sessions/running/images/textregions', { | ||
const response = await req('./api/sessions/running/images/textregions', { | ||
name: 'locateText', | ||
@@ -290,3 +290,3 @@ method: 'POST', | ||
]); | ||
const response = await req('/api/sessions/running/images/text', { | ||
const response = await req('./api/sessions/running/images/text', { | ||
name: 'extractText', | ||
@@ -315,3 +315,3 @@ method: 'POST', | ||
logger.log('Request "getAccountInfo" called with settings', settings); | ||
const response = await req('/api/sessions/renderinfo', { | ||
const response = await req('./api/sessions/renderinfo', { | ||
name: 'getAccountInfo', | ||
@@ -351,3 +351,3 @@ method: 'GET', | ||
logger.log('Request "getBatchBranches" called with settings', settings); | ||
const response = await req(`/api/sessions/batches/${settings.batchId}/config/bypointerId`, { | ||
const response = await req(`./api/sessions/batches/${settings.batchId}/config/bypointerId`, { | ||
name: 'getBatchBranches', | ||
@@ -369,3 +369,3 @@ method: 'GET', | ||
logger.log('Request "closeBatch" called with settings', settings); | ||
await req(`/api/sessions/batches/${settings.batchId}/close/bypointerId`, { | ||
await req(`./api/sessions/batches/${settings.batchId}/close/bypointerId`, { | ||
name: 'closeBatch', | ||
@@ -382,3 +382,3 @@ method: 'DELETE', | ||
logger.log('Request "deleteTest" called with settings', settings); | ||
await req(`/api/sessions/batches/${settings.batchId}/${settings.testId}`, { | ||
await req(`./api/sessions/batches/${settings.batchId}/${settings.testId}`, { | ||
name: 'deleteTest', | ||
@@ -399,3 +399,3 @@ method: 'DELETE', | ||
logger.log('Request "logEvent" called with settings', settings); | ||
await req(`/api/sessions/log`, { | ||
await req(`./api/sessions/log`, { | ||
name: 'logEvent', | ||
@@ -445,3 +445,3 @@ method: 'POST', | ||
]); | ||
const response = await req(`/api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
const response = await req(`./api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
name: 'check', | ||
@@ -471,3 +471,3 @@ method: 'POST', | ||
const matchOptions = transformCheckOptions({ target, settings }); | ||
resultResponsePromise = req(`/api/sessions/running/${encodeURIComponent(test.testId)}/matchandend`, { | ||
resultResponsePromise = req(`./api/sessions/running/${encodeURIComponent(test.testId)}/matchandend`, { | ||
name: 'checkAndClose', | ||
@@ -516,3 +516,3 @@ method: 'POST', | ||
} | ||
resultResponsePromise = report({ settings, logger }).then(() => req(`/api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
resultResponsePromise = report({ settings, logger }).then(() => req(`./api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
name: 'close', | ||
@@ -541,3 +541,3 @@ method: 'DELETE', | ||
abortReason = settings === null || settings === void 0 ? void 0 : settings.reason; | ||
resultResponsePromise = report({ settings, logger }).then(() => req(`/api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
resultResponsePromise = report({ settings, logger }).then(() => req(`./api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
name: 'abort', | ||
@@ -587,3 +587,3 @@ method: 'DELETE', | ||
try { | ||
await req(`/api/sessions/running/${encodeURIComponent(test.testId)}/selfhealdata`, { | ||
await req(`./api/sessions/running/${encodeURIComponent(test.testId)}/selfhealdata`, { | ||
name: 'reportSelfHealing', | ||
@@ -628,3 +628,3 @@ method: 'PUT', | ||
var _a; | ||
return req(`/api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
return req(`./api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
name: 'close', | ||
@@ -650,3 +650,3 @@ method: 'DELETE', | ||
} | ||
resultResponsePromise = report({ settings, logger }).then(() => req(`/api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
resultResponsePromise = report({ settings, logger }).then(() => req(`./api/sessions/running/${encodeURIComponent(test.testId)}`, { | ||
name: 'abort', | ||
@@ -691,3 +691,3 @@ method: 'DELETE', | ||
try { | ||
await req(`/api/sessions/running/${encodeURIComponent(test.testId)}/selfhealdata`, { | ||
await req(`./api/sessions/running/${encodeURIComponent(test.testId)}/selfhealdata`, { | ||
name: 'reportSelfHealing', | ||
@@ -694,0 +694,0 @@ method: 'PUT', |
@@ -28,15 +28,17 @@ "use strict"; | ||
const utils = __importStar(require("@applitools/utils")); | ||
const logger_1 = require("@applitools/logger"); | ||
exports.extractBranchingTimestamp = utils.general.cachify(extractGitBranchingTimestamp); | ||
async function extractGitBranchingTimestamp({ branchName, parentBranchName }, options) { | ||
async function extractGitBranchingTimestamp({ branchName, parentBranchName, execOptions, logger = (0, logger_1.makeLogger)(), }) { | ||
var _a; | ||
logger = logger.extend({ tags: [`extract-branching-timestamp-${utils.general.shortid()}`] }); | ||
const command = `HASH=$(git merge-base ${branchName} ${parentBranchName}) && git show -q --format=%cI $HASH`; | ||
let result = await utils.process.execute(command, options); | ||
let result = await executeWithLog(command); | ||
if (result.stderr) { | ||
const [, missingBranch] = (_a = result.stderr.match(/Not a valid object name ([^\s]+)/)) !== null && _a !== void 0 ? _a : []; | ||
if (missingBranch) { | ||
result = await utils.process.execute(`git fetch origin ${missingBranch}:${missingBranch} && ${command}`, options); | ||
result = await executeWithLog(`git fetch origin ${missingBranch}:${missingBranch} && ${command}`); | ||
} | ||
} | ||
if (!result.stdout) { | ||
result = await utils.process.execute(`git fetch origin --unshallow && ${command}`, options); | ||
result = await executeWithLog(`git fetch origin --unshallow && ${command}`); | ||
} | ||
@@ -48,2 +50,9 @@ const timestamp = result.stdout.replace(/\s/g, ''); | ||
return timestamp; | ||
async function executeWithLog(command) { | ||
logger.log(`executing command: ${command}`); | ||
const result = await utils.process.execute(command, execOptions); | ||
if (result.stderr && result.code) | ||
logger.log(`exit code: ${result.code}, stderr: ${result.stderr}`); | ||
return result; | ||
} | ||
} |
{ | ||
"name": "@applitools/core-base", | ||
"version": "1.9.0", | ||
"version": "1.9.1", | ||
"homepage": "https://applitools.com", | ||
@@ -47,3 +47,3 @@ "bugs": { | ||
"@applitools/logger": "2.0.14", | ||
"@applitools/req": "1.6.4", | ||
"@applitools/req": "1.6.5", | ||
"@applitools/utils": "1.7.0", | ||
@@ -50,0 +50,0 @@ "abort-controller": "3.0.0", |
/// <reference types="node" /> | ||
import { ExecOptions } from 'child_process'; | ||
import type { ExecOptions } from 'child_process'; | ||
import { type Logger } from '@applitools/logger'; | ||
export declare const extractBranchingTimestamp: typeof extractGitBranchingTimestamp & { | ||
@@ -8,6 +9,9 @@ getCachedValues(): Promise<string>[]; | ||
}; | ||
declare function extractGitBranchingTimestamp({ branchName, parentBranchName }: { | ||
type ExtractGitBranchingTimestampOptions = { | ||
branchName: string; | ||
execOptions?: ExecOptions; | ||
logger?: Logger; | ||
parentBranchName: string; | ||
}, options?: ExecOptions): Promise<string>; | ||
}; | ||
declare function extractGitBranchingTimestamp({ branchName, parentBranchName, execOptions, logger, }: ExtractGitBranchingTimestampOptions): Promise<string>; | ||
export {}; |
157737
2670
+ Added@applitools/req@1.6.5(transitive)
- Removed@applitools/req@1.6.4(transitive)
Updated@applitools/req@1.6.5