@applitools/eyes 1.28.0 → 1.29.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/cli/cli.js +47 -0
- package/dist/cli/load-config.js +73 -0
- package/package.json +5 -3
- package/types/cli/cli.d.ts +2 -0
- package/types/cli/load-config.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.29.0](https://github.com/Applitools-Dev/sdk/compare/js/eyes@1.28.0...js/eyes@1.29.0) (2024-11-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* offline cli with config ([#2646](https://github.com/Applitools-Dev/sdk/issues/2646)) ([0589dc4](https://github.com/Applitools-Dev/sdk/commit/0589dc429a0c94451e957932106f258dadfd88cc))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/core bumped to 4.25.0
|
|
14
|
+
#### Features
|
|
15
|
+
|
|
16
|
+
* offline cli with config ([#2646](https://github.com/Applitools-Dev/sdk/issues/2646)) ([0589dc4](https://github.com/Applitools-Dev/sdk/commit/0589dc429a0c94451e957932106f258dadfd88cc))
|
|
17
|
+
|
|
3
18
|
## [1.28.0](https://github.com/Applitools-Dev/sdk/compare/js/eyes@1.27.0...js/eyes@1.28.0) (2024-11-27)
|
|
4
19
|
|
|
5
20
|
|
package/dist/cli/cli.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
/* eslint no-console: off */
|
|
8
|
+
const core_1 = require("@applitools/core");
|
|
9
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
10
|
+
const Configuration_1 = require("../input/Configuration");
|
|
11
|
+
const load_config_1 = require("./load-config");
|
|
12
|
+
void yargs_1.default
|
|
13
|
+
.example([['eyes run-offline-snapshots', 'Run Eyes visual tests on existing snapshots']])
|
|
14
|
+
.command({
|
|
15
|
+
command: 'run-offline-snapshots',
|
|
16
|
+
builder: yargs => {
|
|
17
|
+
return yargs
|
|
18
|
+
.options({
|
|
19
|
+
offlineLocationPath: {
|
|
20
|
+
description: 'path to offline snapshots folder',
|
|
21
|
+
type: 'string',
|
|
22
|
+
},
|
|
23
|
+
failOnDiff: {
|
|
24
|
+
description: 'should exit process with non-zero exit code, thereby failing the CI job',
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
default: false,
|
|
27
|
+
},
|
|
28
|
+
configPath: {
|
|
29
|
+
description: 'path to configuration file (applitools.config.js / applitools.config.ts)',
|
|
30
|
+
type: 'string',
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
.fail((_msg, err, _yargs) => {
|
|
34
|
+
if (err) {
|
|
35
|
+
console.error(err.message);
|
|
36
|
+
// console.log(err)
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
handler: async (args) => {
|
|
42
|
+
const config = await (0, load_config_1.loadConfig)(args.configPath);
|
|
43
|
+
const options = { ...args, config: new Configuration_1.ConfigurationData(config).toJSON() };
|
|
44
|
+
await (0, core_1.runOfflineSnapshots)(options);
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
.wrap(yargs_1.default.terminalWidth()).argv;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.loadConfig = void 0;
|
|
30
|
+
/* eslint no-console: off */
|
|
31
|
+
const utils = __importStar(require("@applitools/utils"));
|
|
32
|
+
const path_1 = __importDefault(require("path"));
|
|
33
|
+
const fs_1 = __importDefault(require("fs"));
|
|
34
|
+
const chalk = __importStar(require("chalk"));
|
|
35
|
+
async function loadConfig(configPath) {
|
|
36
|
+
const configPathArr = configPath ? [configPath] : [];
|
|
37
|
+
const paths = configPathArr.concat(['applitools.config.js']);
|
|
38
|
+
let config = {};
|
|
39
|
+
try {
|
|
40
|
+
config = utils.config.getConfig({
|
|
41
|
+
paths,
|
|
42
|
+
traverse: false,
|
|
43
|
+
strict: true,
|
|
44
|
+
});
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
if (config.__esModule) {
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
config = config.default;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
if (err.code === 'ERR_REQUIRE_ESM') {
|
|
53
|
+
const resolvedPaths = paths.map(probablePath => path_1.default.resolve(process.cwd(), probablePath));
|
|
54
|
+
const foundPath = resolvedPaths.find(resolvedPath => fs_1.default.existsSync(resolvedPath));
|
|
55
|
+
if (foundPath) {
|
|
56
|
+
try {
|
|
57
|
+
config = await import(foundPath);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
console.warn(chalk.yellow(err.message));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
console.warn(chalk.yellow('Could not find configuration file.'));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.warn(chalk.yellow(err.message));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return config;
|
|
72
|
+
}
|
|
73
|
+
exports.loadConfig = loadConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"applitools",
|
|
6
6
|
"eyes",
|
|
@@ -39,15 +39,17 @@
|
|
|
39
39
|
"dist",
|
|
40
40
|
"types"
|
|
41
41
|
],
|
|
42
|
+
"bin": "./dist/cli/cli.js",
|
|
42
43
|
"scripts": {
|
|
43
44
|
"lint": "run --top-level eslint '**/*.ts'",
|
|
44
45
|
"build": "run --top-level tsc --project ./tsconfig.build.json",
|
|
45
46
|
"test": "run --top-level mocha './test/**/*.spec.ts'"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@applitools/core": "4.
|
|
49
|
+
"@applitools/core": "4.25.0",
|
|
49
50
|
"@applitools/logger": "2.0.19",
|
|
50
|
-
"@applitools/utils": "1.7.5"
|
|
51
|
+
"@applitools/utils": "1.7.5",
|
|
52
|
+
"chalk": "4.1.2"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
55
|
"@applitools/req": "^1.7.4",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadConfig(configPath: string): Promise<object>;
|