@approval-tests/approvals 7.5.8 → 7.5.9
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/bin/help.md +7 -7
- package/bin/index.js +81 -64
- package/bin/index.ts +73 -71
- package/lib/Writers/BinaryWriter.js +2 -2
- package/lib/Writers/BinaryWriter.ts +2 -2
- package/package.json +7 -16
- package/readme.md +18 -19
package/bin/help.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
`approvals testName [options]`
|
|
4
4
|
|
|
5
|
-
| Arg
|
|
6
|
-
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
5
|
+
| Arg | Description |
|
|
6
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| [-f \| --forceapproveall] | Skip the approve step and apply the results to the .approved.txt file (good for a first time run) |
|
|
8
|
+
| [--reporter difftool] | supports multiple EX: `--reporter opendiff --reporter gitdiff` |
|
|
9
|
+
| [--outdir] | dir to place approval file - defaults to current directory |
|
|
10
|
+
| [--verbose] | extra debug info |
|
|
11
|
+
| TODO: | We need to extend the supported args to include other approval options. (file an [issue](https://github.com/approvals/Approvals.NodeJS/issues) if you need one that's not here) |
|
|
12
12
|
|
|
13
13
|
# Examples
|
|
14
14
|
|
package/bin/index.js
CHANGED
|
@@ -33,6 +33,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
36
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
47
|
};
|
|
@@ -41,79 +50,87 @@ const event_stream_1 = __importDefault(require("event-stream"));
|
|
|
41
50
|
const autils = __importStar(require("../lib/AUtils"));
|
|
42
51
|
const fs_1 = __importDefault(require("fs"));
|
|
43
52
|
const path_1 = __importDefault(require("path"));
|
|
44
|
-
const marked_1 =
|
|
45
|
-
const
|
|
53
|
+
const marked_1 = require("marked");
|
|
54
|
+
const marked_terminal_renderer_1 = require("marked-terminal-renderer");
|
|
46
55
|
const minimist_1 = __importDefault(require("minimist"));
|
|
47
56
|
const Approvals_1 = require("../lib/Approvals");
|
|
48
57
|
const ConsoleUtils_1 = require("../lib/Utilities/ConsoleUtils");
|
|
49
58
|
const verbose = process.argv.includes("--verbose");
|
|
50
59
|
const printHelp = process.argv.includes("--help");
|
|
51
60
|
function printHelpMessage() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
if (verbose) {
|
|
63
|
+
console.log("printing help...");
|
|
64
|
+
}
|
|
65
|
+
const helpFile = fs_1.default.readFileSync(path_1.default.join(__dirname, "help.md"), "utf8");
|
|
66
|
+
marked_1.marked.use((0, marked_terminal_renderer_1.createTerminalRenderer)((0, marked_terminal_renderer_1.darkTheme)()));
|
|
67
|
+
console.log(yield marked_1.marked.parse(helpFile));
|
|
58
68
|
});
|
|
59
|
-
let output = marked_1.default.parse(helpFile);
|
|
60
|
-
output = output.replace(/ /g, " ");
|
|
61
|
-
console.log(output);
|
|
62
69
|
}
|
|
63
70
|
function errAndExit(msg) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
printHelpMessage();
|
|
70
|
-
process.exit();
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
yield printHelpMessage();
|
|
73
|
+
console.log((0, ConsoleUtils_1.redText)(msg));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
});
|
|
71
76
|
}
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
function main() {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
if (printHelp) {
|
|
80
|
+
yield printHelpMessage();
|
|
81
|
+
process.exit();
|
|
82
|
+
}
|
|
83
|
+
if (verbose) {
|
|
84
|
+
console.log("process.argv: ", process.argv);
|
|
85
|
+
}
|
|
86
|
+
const argv = (0, minimist_1.default)(process.argv.slice(2), {
|
|
87
|
+
alias: {
|
|
88
|
+
reporters: ["r"],
|
|
89
|
+
},
|
|
90
|
+
boolean: ["verbose"],
|
|
91
|
+
});
|
|
92
|
+
if (verbose) {
|
|
93
|
+
console.log("parsed args: ", argv);
|
|
94
|
+
}
|
|
95
|
+
let reporters = argv.reporter;
|
|
96
|
+
if (typeof reporters === "string") {
|
|
97
|
+
reporters = [reporters];
|
|
98
|
+
}
|
|
99
|
+
const testname = argv._[0];
|
|
100
|
+
if (!testname) {
|
|
101
|
+
yield errAndExit('Missing parameter: supply a test name ex: echo "hello" | approvals myFirstTest. This will become the file name myFirstTest.approved.txt in the current directory');
|
|
102
|
+
}
|
|
103
|
+
const outdir = argv.outdir || process.cwd();
|
|
104
|
+
if (!fs_1.default.existsSync(outdir)) {
|
|
105
|
+
yield errAndExit("Directory not found: " + outdir);
|
|
106
|
+
}
|
|
107
|
+
const errorOnStaleApprovedFiles = argv.errorOnStaleApprovedFiles === "true";
|
|
108
|
+
if (verbose) {
|
|
109
|
+
console.log("outdir: ", outdir);
|
|
110
|
+
console.log("errorOnStaleApprovedFiles: ", errorOnStaleApprovedFiles);
|
|
111
|
+
console.log("testname: ", testname);
|
|
112
|
+
console.log("reporters: ", reporters ||
|
|
113
|
+
"undefined (but will fallback to approvals preconfigure defaults)");
|
|
114
|
+
}
|
|
115
|
+
const opts = {};
|
|
116
|
+
if (reporters) {
|
|
117
|
+
opts.reporters = reporters;
|
|
118
|
+
}
|
|
119
|
+
opts.errorOnStaleApprovedFiles = errorOnStaleApprovedFiles;
|
|
120
|
+
if (verbose) {
|
|
121
|
+
console.log("approval opts: ", opts);
|
|
122
|
+
}
|
|
123
|
+
opts.forceApproveAll =
|
|
124
|
+
autils.hasCommandLineArgument("--forceapproveall") ||
|
|
125
|
+
autils.hasCommandLineArgument("-f");
|
|
126
|
+
process.stdin.pipe(event_stream_1.default.mapSync((data) => {
|
|
127
|
+
const dataToVerify = data.toString();
|
|
128
|
+
(0, Approvals_1.configure)(opts);
|
|
129
|
+
(0, Approvals_1.verify)(outdir, testname, dataToVerify);
|
|
130
|
+
}));
|
|
131
|
+
});
|
|
74
132
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
boolean: ["verbose"],
|
|
133
|
+
void main().catch((error) => {
|
|
134
|
+
console.error(error);
|
|
135
|
+
process.exitCode = 1;
|
|
80
136
|
});
|
|
81
|
-
if (verbose) {
|
|
82
|
-
console.log("parsed args: ", argv);
|
|
83
|
-
}
|
|
84
|
-
let reporters = argv.reporter;
|
|
85
|
-
if (typeof reporters === "string") {
|
|
86
|
-
reporters = [reporters];
|
|
87
|
-
}
|
|
88
|
-
const testname = argv._[0];
|
|
89
|
-
if (!testname) {
|
|
90
|
-
errAndExit('Missing parameter: supply a test name ex: echo "hello" | approvals myFirstTest. This will become the file name myFirstTest.approved.txt in the current directory');
|
|
91
|
-
}
|
|
92
|
-
const outdir = argv.outdir || process.cwd();
|
|
93
|
-
if (!fs_1.default.existsSync(outdir)) {
|
|
94
|
-
errAndExit("Directory not found: " + outdir);
|
|
95
|
-
}
|
|
96
|
-
const errorOnStaleApprovedFiles = argv.errorOnStaleApprovedFiles === "true";
|
|
97
|
-
if (verbose) {
|
|
98
|
-
console.log("outdir: ", outdir);
|
|
99
|
-
console.log("errorOnStaleApprovedFiles: ", errorOnStaleApprovedFiles);
|
|
100
|
-
console.log("testname: ", testname);
|
|
101
|
-
console.log("reporters: ", reporters ||
|
|
102
|
-
"undefined (but will fallback to approvals preconfigure defaults)");
|
|
103
|
-
}
|
|
104
|
-
const opts = {};
|
|
105
|
-
if (reporters) {
|
|
106
|
-
opts.reporters = reporters;
|
|
107
|
-
}
|
|
108
|
-
opts.errorOnStaleApprovedFiles = errorOnStaleApprovedFiles;
|
|
109
|
-
if (verbose) {
|
|
110
|
-
console.log("approval opts: ", opts);
|
|
111
|
-
}
|
|
112
|
-
opts.forceApproveAll =
|
|
113
|
-
autils.hasCommandLineArgument("--forceapproveall") ||
|
|
114
|
-
autils.hasCommandLineArgument("-f");
|
|
115
|
-
process.stdin.pipe(event_stream_1.default.mapSync((data) => {
|
|
116
|
-
const dataToVerify = data.toString();
|
|
117
|
-
(0, Approvals_1.configure)(opts);
|
|
118
|
-
(0, Approvals_1.verify)(outdir, testname, dataToVerify);
|
|
119
|
-
}));
|
package/bin/index.ts
CHANGED
|
@@ -3,8 +3,8 @@ import es from "event-stream";
|
|
|
3
3
|
import * as autils from "../lib/AUtils";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import path from "path";
|
|
6
|
-
import marked from "marked";
|
|
7
|
-
import
|
|
6
|
+
import { marked } from "marked";
|
|
7
|
+
import { createTerminalRenderer, darkTheme } from "marked-terminal-renderer";
|
|
8
8
|
import minimist from "minimist";
|
|
9
9
|
import { configure, verify } from "../lib/Approvals";
|
|
10
10
|
import { redText } from "../lib/Utilities/ConsoleUtils";
|
|
@@ -12,95 +12,97 @@ import { redText } from "../lib/Utilities/ConsoleUtils";
|
|
|
12
12
|
const verbose = process.argv.includes("--verbose");
|
|
13
13
|
const printHelp = process.argv.includes("--help");
|
|
14
14
|
|
|
15
|
-
function printHelpMessage() {
|
|
15
|
+
async function printHelpMessage(): Promise<void> {
|
|
16
16
|
if (verbose) {
|
|
17
17
|
console.log("printing help...");
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const helpFile = fs.readFileSync(path.join(__dirname, "help.md"), "utf8");
|
|
21
|
-
marked.
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
let output = marked.parse(helpFile) as string;
|
|
25
|
-
|
|
26
|
-
output = output.replace(/ /g, " ");
|
|
27
|
-
console.log(output);
|
|
21
|
+
marked.use(createTerminalRenderer(darkTheme()));
|
|
22
|
+
console.log(await marked.parse(helpFile));
|
|
28
23
|
}
|
|
29
24
|
|
|
30
|
-
function errAndExit(msg: string): void {
|
|
31
|
-
printHelpMessage();
|
|
25
|
+
async function errAndExit(msg: string): Promise<void> {
|
|
26
|
+
await printHelpMessage();
|
|
32
27
|
console.log(redText(msg));
|
|
33
28
|
process.exit(1);
|
|
34
29
|
}
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
async function main(): Promise<void> {
|
|
32
|
+
if (printHelp) {
|
|
33
|
+
await printHelpMessage();
|
|
34
|
+
process.exit();
|
|
35
|
+
}
|
|
40
36
|
|
|
41
|
-
if (verbose) {
|
|
42
|
-
|
|
43
|
-
}
|
|
37
|
+
if (verbose) {
|
|
38
|
+
console.log("process.argv: ", process.argv);
|
|
39
|
+
}
|
|
44
40
|
|
|
45
|
-
const argv = minimist(process.argv.slice(2), {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
41
|
+
const argv = minimist(process.argv.slice(2), {
|
|
42
|
+
alias: {
|
|
43
|
+
reporters: ["r"],
|
|
44
|
+
},
|
|
45
|
+
boolean: ["verbose"],
|
|
46
|
+
});
|
|
51
47
|
|
|
52
|
-
if (verbose) {
|
|
53
|
-
|
|
54
|
-
}
|
|
48
|
+
if (verbose) {
|
|
49
|
+
console.log("parsed args: ", argv);
|
|
50
|
+
}
|
|
55
51
|
|
|
56
|
-
let reporters = argv.reporter as string | string[];
|
|
57
|
-
if (typeof reporters === "string") {
|
|
58
|
-
|
|
59
|
-
}
|
|
52
|
+
let reporters = argv.reporter as string | string[];
|
|
53
|
+
if (typeof reporters === "string") {
|
|
54
|
+
reporters = [reporters];
|
|
55
|
+
}
|
|
60
56
|
|
|
61
|
-
const testname = argv._[0];
|
|
62
|
-
if (!testname) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
57
|
+
const testname = argv._[0];
|
|
58
|
+
if (!testname) {
|
|
59
|
+
await errAndExit(
|
|
60
|
+
'Missing parameter: supply a test name ex: echo "hello" | approvals myFirstTest. This will become the file name myFirstTest.approved.txt in the current directory',
|
|
61
|
+
);
|
|
62
|
+
}
|
|
67
63
|
|
|
68
|
-
const outdir = argv.outdir || process.cwd();
|
|
69
|
-
if (!fs.existsSync(outdir)) {
|
|
70
|
-
|
|
71
|
-
}
|
|
64
|
+
const outdir = argv.outdir || process.cwd();
|
|
65
|
+
if (!fs.existsSync(outdir)) {
|
|
66
|
+
await errAndExit("Directory not found: " + outdir);
|
|
67
|
+
}
|
|
72
68
|
|
|
73
|
-
const errorOnStaleApprovedFiles = argv.errorOnStaleApprovedFiles === "true";
|
|
69
|
+
const errorOnStaleApprovedFiles = argv.errorOnStaleApprovedFiles === "true";
|
|
74
70
|
|
|
75
|
-
if (verbose) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
71
|
+
if (verbose) {
|
|
72
|
+
console.log("outdir: ", outdir);
|
|
73
|
+
console.log("errorOnStaleApprovedFiles: ", errorOnStaleApprovedFiles);
|
|
74
|
+
console.log("testname: ", testname);
|
|
75
|
+
console.log(
|
|
76
|
+
"reporters: ",
|
|
77
|
+
reporters ||
|
|
78
|
+
"undefined (but will fallback to approvals preconfigure defaults)",
|
|
79
|
+
);
|
|
80
|
+
}
|
|
85
81
|
|
|
86
|
-
const opts: any = {};
|
|
87
|
-
if (reporters) {
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
opts.errorOnStaleApprovedFiles = errorOnStaleApprovedFiles;
|
|
82
|
+
const opts: any = {};
|
|
83
|
+
if (reporters) {
|
|
84
|
+
opts.reporters = reporters;
|
|
85
|
+
}
|
|
86
|
+
opts.errorOnStaleApprovedFiles = errorOnStaleApprovedFiles;
|
|
87
|
+
|
|
88
|
+
if (verbose) {
|
|
89
|
+
console.log("approval opts: ", opts);
|
|
90
|
+
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
opts.forceApproveAll =
|
|
93
|
+
autils.hasCommandLineArgument("--forceapproveall") ||
|
|
94
|
+
autils.hasCommandLineArgument("-f");
|
|
95
|
+
|
|
96
|
+
process.stdin.pipe(
|
|
97
|
+
es.mapSync((data: Buffer) => {
|
|
98
|
+
const dataToVerify = data.toString();
|
|
99
|
+
configure(opts);
|
|
100
|
+
verify(outdir, testname, dataToVerify);
|
|
101
|
+
}),
|
|
102
|
+
);
|
|
94
103
|
}
|
|
95
104
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
process.stdin.pipe(
|
|
101
|
-
es.mapSync((data: Buffer) => {
|
|
102
|
-
const dataToVerify = data.toString();
|
|
103
|
-
configure(opts);
|
|
104
|
-
verify(outdir, testname, dataToVerify);
|
|
105
|
-
}),
|
|
106
|
-
);
|
|
105
|
+
void main().catch((error: unknown) => {
|
|
106
|
+
console.error(error);
|
|
107
|
+
process.exitCode = 1;
|
|
108
|
+
});
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.BinaryWriter = void 0;
|
|
40
40
|
const fs = __importStar(require("fs"));
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
|
-
const mkdirp_1 =
|
|
42
|
+
const mkdirp_1 = require("mkdirp");
|
|
43
43
|
const file_type_1 = __importDefault(require("file-type")); // Assuming fileType provides synchronous methods
|
|
44
44
|
class BinaryWriter {
|
|
45
45
|
constructor(outputData) {
|
|
@@ -55,7 +55,7 @@ class BinaryWriter {
|
|
|
55
55
|
write(filePath) {
|
|
56
56
|
const dir = path.dirname(path.normalize(filePath));
|
|
57
57
|
if (!fs.existsSync(dir)) {
|
|
58
|
-
mkdirp_1.
|
|
58
|
+
(0, mkdirp_1.sync)(dir);
|
|
59
59
|
}
|
|
60
60
|
fs.writeFileSync(filePath, this.outputData);
|
|
61
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import
|
|
3
|
+
import { sync } from "mkdirp";
|
|
4
4
|
import fileType from "file-type"; // Assuming fileType provides synchronous methods
|
|
5
5
|
import { Writer } from "../Core/Writer";
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@ export class BinaryWriter implements Writer {
|
|
|
23
23
|
write(filePath: string): void {
|
|
24
24
|
const dir = path.dirname(path.normalize(filePath));
|
|
25
25
|
if (!fs.existsSync(dir)) {
|
|
26
|
-
|
|
26
|
+
sync(dir);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
fs.writeFileSync(filePath, this.outputData);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"description": "Approval Tests Library - Capturing Human Intelligence",
|
|
7
|
-
"version": "7.5.
|
|
7
|
+
"version": "7.5.9",
|
|
8
8
|
"homepage": "http://approvaltests.com",
|
|
9
9
|
"author": {
|
|
10
10
|
"name": "Jason Jarrett",
|
|
@@ -39,12 +39,11 @@
|
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc",
|
|
42
|
-
"test": "
|
|
42
|
+
"test": "npm run lint && npm run mocha && jest && vitest run",
|
|
43
43
|
"vitest": "vitest run",
|
|
44
44
|
"test2": "npm run mocha && npm run lint",
|
|
45
|
-
"lint": "eslint
|
|
46
|
-
"
|
|
47
|
-
"mocha": "mocha 'test/**/*[Tt]ests.js'",
|
|
45
|
+
"lint": "eslint lib test",
|
|
46
|
+
"mocha": "mocha",
|
|
48
47
|
"coverage": "nyc npm run mocha"
|
|
49
48
|
},
|
|
50
49
|
"dependencies": {
|
|
@@ -58,8 +57,8 @@
|
|
|
58
57
|
"jest": "^30.0.0",
|
|
59
58
|
"js-yaml": "^5.1.0",
|
|
60
59
|
"lodash": "^4.17.21",
|
|
61
|
-
"marked": "^
|
|
62
|
-
"marked-terminal": "^
|
|
60
|
+
"marked": "^18.0.14",
|
|
61
|
+
"marked-terminal-renderer": "^2.2.0",
|
|
63
62
|
"minimist": "^1.2.8",
|
|
64
63
|
"mkdirp": "^3.0.1",
|
|
65
64
|
"shelljs": "^0.10.0",
|
|
@@ -75,18 +74,10 @@
|
|
|
75
74
|
"chai": "^6.0.1",
|
|
76
75
|
"eslint": "^10.2.1",
|
|
77
76
|
"eslint-plugin-promise": "^7.2.1",
|
|
78
|
-
"gulp": "^5.0.0",
|
|
79
|
-
"gulp-eslint": "^6.0.0",
|
|
80
|
-
"gulp-istanbul": "^1.1.3",
|
|
81
|
-
"gulp-load-plugins": "^2.0.7",
|
|
82
|
-
"gulp-mocha": "^10.0.1",
|
|
83
|
-
"gulp-watch": "^5.0.1",
|
|
84
77
|
"jest-junit": "^17.0.0",
|
|
85
78
|
"jsdoc-to-markdown": "^9.1.1",
|
|
86
|
-
"mocha": "^
|
|
87
|
-
"mocha-junit-reporter": "^2.2.1",
|
|
79
|
+
"mocha": "^12.0.2",
|
|
88
80
|
"mocha-multi-reporters": "^1.5.1",
|
|
89
|
-
"np": "^12.0.0",
|
|
90
81
|
"nyc": "^18.0.0",
|
|
91
82
|
"pre-commit": "^2.0.0",
|
|
92
83
|
"prettier": "^3.4.2",
|
package/readme.md
CHANGED
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
* [CLI](#cli)
|
|
14
14
|
* [Install Approvals CLI](#install-approvals-cli)
|
|
15
15
|
* [CLI Help](#cli-help)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
* [Usage](#usage)
|
|
17
|
+
* [Examples](#examples)
|
|
18
|
+
* [Simple hello world](#simple-hello-world)
|
|
19
|
+
* [Specify diff reporter (great for C.I.)](#specify-diff-reporter-great-for-ci)
|
|
20
|
+
* [Multiple diff reporters](#multiple-diff-reporters)
|
|
19
21
|
* [Reporters](#reporters)
|
|
20
22
|
* [Built-In Reporters](#built-in-reporters)
|
|
21
23
|
* [Supported Diff Tools](#supported-diff-tools)
|
|
@@ -140,44 +142,41 @@ npm install -g @approval-tests/approvals
|
|
|
140
142
|
By running `approvals --help`
|
|
141
143
|
|
|
142
144
|
<!--BEGIN-CLI-DOCS-->
|
|
143
|
-
<!-- GENERATED - DO NOT MODIFY
|
|
145
|
+
<!-- GENERATED - DO NOT MODIFY CLI DOCS IN THIS README -->
|
|
144
146
|
<!-- Update docs in the source ./bin/help.md -->
|
|
145
|
-
```
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
#### Usage
|
|
148
149
|
|
|
149
150
|
`approvals testName [options]`
|
|
150
151
|
|
|
151
|
-
| Arg
|
|
152
|
-
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
153
|
-
|
|
|
154
|
-
| [--reporter difftool]
|
|
155
|
-
| [--outdir]
|
|
156
|
-
| [--verbose]
|
|
157
|
-
| TODO:
|
|
152
|
+
| Arg | Description |
|
|
153
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
154
|
+
| [-f \| --forceapproveall] | Skip the approve step and apply the results to the .approved.txt file (good for a first time run) |
|
|
155
|
+
| [--reporter difftool] | supports multiple EX: `--reporter opendiff --reporter gitdiff` |
|
|
156
|
+
| [--outdir] | dir to place approval file - defaults to current directory |
|
|
157
|
+
| [--verbose] | extra debug info |
|
|
158
|
+
| TODO: | We need to extend the supported args to include other approval options. (file an [issue](https://github.com/approvals/Approvals.NodeJS/issues) if you need one that's not here) |
|
|
158
159
|
|
|
159
|
-
|
|
160
|
+
#### Examples
|
|
160
161
|
|
|
161
|
-
|
|
162
|
+
##### Simple hello world
|
|
162
163
|
|
|
163
164
|
```
|
|
164
165
|
echo 'Hello World!' | approvals helloWorldTest
|
|
165
166
|
```
|
|
166
167
|
|
|
167
|
-
|
|
168
|
+
##### Specify diff reporter (great for C.I.)
|
|
168
169
|
|
|
169
170
|
```
|
|
170
171
|
echo 'Hello World!' | approvals helloWorldTest --reporter gitdiff
|
|
171
172
|
```
|
|
172
173
|
|
|
173
|
-
|
|
174
|
+
##### Multiple diff reporters
|
|
174
175
|
|
|
175
176
|
```
|
|
176
177
|
echo 'Hello World!' | approvals helloWorldTest --reporter gitdiff --reporter p4merge
|
|
177
178
|
```
|
|
178
179
|
|
|
179
|
-
```
|
|
180
|
-
|
|
181
180
|
<!--END-CLI-DOCS-->
|
|
182
181
|
|
|
183
182
|
<a name="reporters" />
|