@scalvert/bin-tester 1.0.0 → 2.0.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/README.md +0 -13
- package/dist/index.cjs +10 -23
- package/dist/index.d.ts +0 -8
- package/dist/index.js +1 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -93,7 +93,6 @@ describe('Some tests', () => {
|
|
|
93
93
|
* [new BinTesterProject(name, version, cb)](#new_BinTesterProject_new)
|
|
94
94
|
* [.gitInit()](#BinTesterProject+gitInit) ⇒ <code>\*</code>
|
|
95
95
|
* [.chdir()](#BinTesterProject+chdir)
|
|
96
|
-
* [.writeDirJSON(dirJSON)](#BinTesterProject+writeDirJSON) ⇒ <code>\*</code>
|
|
97
96
|
* [.dispose()](#BinTesterProject+dispose) ⇒ <code>void</code>
|
|
98
97
|
|
|
99
98
|
<a name="new_BinTesterProject_new"></a>
|
|
@@ -121,18 +120,6 @@ describe('Some tests', () => {
|
|
|
121
120
|
<p>Changes a directory from inside the project.</p>
|
|
122
121
|
|
|
123
122
|
**Kind**: instance method of [<code>BinTesterProject</code>](#BinTesterProject)
|
|
124
|
-
<a name="BinTesterProject+writeDirJSON"></a>
|
|
125
|
-
|
|
126
|
-
### binTesterProject.writeDirJSON(dirJSON) ⇒ <code>\*</code>
|
|
127
|
-
<p>Writes a directory struture in the project directory.</p>
|
|
128
|
-
|
|
129
|
-
**Kind**: instance method of [<code>BinTesterProject</code>](#BinTesterProject)
|
|
130
|
-
**Returns**: <code>\*</code> - <p>{Promise<void>}</p>
|
|
131
|
-
|
|
132
|
-
| Param | Type | Description |
|
|
133
|
-
| --- | --- | --- |
|
|
134
|
-
| dirJSON | <code>fixturify.DirJSON</code> | <p>A JSON object representing the directory structure to create.</p> |
|
|
135
|
-
|
|
136
123
|
<a name="BinTesterProject+dispose"></a>
|
|
137
124
|
|
|
138
125
|
### binTesterProject.dispose() ⇒ <code>void</code>
|
package/dist/index.cjs
CHANGED
|
@@ -18,27 +18,20 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
21
|
var __export = (target, all) => {
|
|
23
22
|
for (var name in all)
|
|
24
23
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
24
|
};
|
|
26
|
-
var
|
|
27
|
-
if (
|
|
28
|
-
for (let key of __getOwnPropNames(
|
|
29
|
-
if (!__hasOwnProp.call(
|
|
30
|
-
__defProp(
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
30
|
}
|
|
32
|
-
return
|
|
31
|
+
return to;
|
|
33
32
|
};
|
|
34
|
-
var __toESM = (
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
38
|
-
return (module2, temp) => {
|
|
39
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
40
|
-
};
|
|
41
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
35
|
|
|
43
36
|
// src/index.ts
|
|
44
37
|
var src_exports = {};
|
|
@@ -46,6 +39,7 @@ __export(src_exports, {
|
|
|
46
39
|
BinTesterProject: () => BinTesterProject,
|
|
47
40
|
createBinTester: () => createBinTester
|
|
48
41
|
});
|
|
42
|
+
module.exports = __toCommonJS(src_exports);
|
|
49
43
|
|
|
50
44
|
// src/create-bin-tester.ts
|
|
51
45
|
var import_execa2 = __toESM(require("execa"), 1);
|
|
@@ -53,7 +47,6 @@ var import_execa2 = __toESM(require("execa"), 1);
|
|
|
53
47
|
// src/project.ts
|
|
54
48
|
var import_execa = __toESM(require("execa"), 1);
|
|
55
49
|
var import_fixturify_project = require("fixturify-project");
|
|
56
|
-
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
57
50
|
var ROOT = process.cwd();
|
|
58
51
|
var BinTesterProject = class extends import_fixturify_project.Project {
|
|
59
52
|
constructor(name = "fake-project", version, cb) {
|
|
@@ -73,10 +66,6 @@ var BinTesterProject = class extends import_fixturify_project.Project {
|
|
|
73
66
|
await this.write();
|
|
74
67
|
process.chdir(this.baseDir);
|
|
75
68
|
}
|
|
76
|
-
writeDirJSON(dirJSON) {
|
|
77
|
-
this.files = (0, import_deepmerge.default)(this.files, dirJSON);
|
|
78
|
-
return this.write();
|
|
79
|
-
}
|
|
80
69
|
dispose() {
|
|
81
70
|
if (this._dirChanged) {
|
|
82
71
|
process.chdir(ROOT);
|
|
@@ -87,8 +76,7 @@ var BinTesterProject = class extends import_fixturify_project.Project {
|
|
|
87
76
|
|
|
88
77
|
// src/create-bin-tester.ts
|
|
89
78
|
var DEFAULT_BIN_TESTER_OPTIONS = {
|
|
90
|
-
staticArgs: []
|
|
91
|
-
projectConstructor: BinTesterProject
|
|
79
|
+
staticArgs: []
|
|
92
80
|
};
|
|
93
81
|
function parseArgs(args) {
|
|
94
82
|
if (args.length > 0 && typeof args[args.length - 1] === "object") {
|
|
@@ -135,7 +123,6 @@ function createBinTester(options) {
|
|
|
135
123
|
setupTmpDir
|
|
136
124
|
};
|
|
137
125
|
}
|
|
138
|
-
module.exports = __toCommonJS(src_exports);
|
|
139
126
|
// Annotate the CommonJS export names for ESM import in node:
|
|
140
127
|
0 && (module.exports = {
|
|
141
128
|
BinTesterProject,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import execa from 'execa';
|
|
2
|
-
import fixturify from 'fixturify';
|
|
3
2
|
import { Project } from 'fixturify-project';
|
|
4
3
|
|
|
5
4
|
declare class BinTesterProject extends Project {
|
|
@@ -22,13 +21,6 @@ declare class BinTesterProject extends Project {
|
|
|
22
21
|
* Changes a directory from inside the project.
|
|
23
22
|
*/
|
|
24
23
|
chdir(): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Writes a directory struture in the project directory.
|
|
27
|
-
*
|
|
28
|
-
* @param {fixturify.DirJSON} dirJSON - A JSON object representing the directory structure to create.
|
|
29
|
-
* @returns {*} {Promise<void>}
|
|
30
|
-
*/
|
|
31
|
-
writeDirJSON(dirJSON: fixturify.DirJSON): Promise<void>;
|
|
32
24
|
/**
|
|
33
25
|
* Correctly disposes of the project, observing when the directory has been changed.
|
|
34
26
|
*
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,6 @@ import execa2 from "execa";
|
|
|
21
21
|
// src/project.ts
|
|
22
22
|
import execa from "execa";
|
|
23
23
|
import { Project } from "fixturify-project";
|
|
24
|
-
import deepmerge from "deepmerge";
|
|
25
24
|
var ROOT = process.cwd();
|
|
26
25
|
var BinTesterProject = class extends Project {
|
|
27
26
|
constructor(name = "fake-project", version, cb) {
|
|
@@ -41,10 +40,6 @@ var BinTesterProject = class extends Project {
|
|
|
41
40
|
await this.write();
|
|
42
41
|
process.chdir(this.baseDir);
|
|
43
42
|
}
|
|
44
|
-
writeDirJSON(dirJSON) {
|
|
45
|
-
this.files = deepmerge(this.files, dirJSON);
|
|
46
|
-
return this.write();
|
|
47
|
-
}
|
|
48
43
|
dispose() {
|
|
49
44
|
if (this._dirChanged) {
|
|
50
45
|
process.chdir(ROOT);
|
|
@@ -55,8 +50,7 @@ var BinTesterProject = class extends Project {
|
|
|
55
50
|
|
|
56
51
|
// src/create-bin-tester.ts
|
|
57
52
|
var DEFAULT_BIN_TESTER_OPTIONS = {
|
|
58
|
-
staticArgs: []
|
|
59
|
-
projectConstructor: BinTesterProject
|
|
53
|
+
staticArgs: []
|
|
60
54
|
};
|
|
61
55
|
function parseArgs(args) {
|
|
62
56
|
if (args.length > 0 && typeof args[args.length - 1] === "object") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalvert/bin-tester",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A test harness to invoke a CLI in a tmp directory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"docs:generate": "readme-api-generator ./src --ts",
|
|
32
32
|
"lint": "eslint .",
|
|
33
33
|
"prepublishOnly": "npm run build",
|
|
34
|
-
"test": "npm run lint &&
|
|
34
|
+
"test": "npm run lint && npm run test:vitest",
|
|
35
|
+
"test:vitest": "vitest run",
|
|
35
36
|
"test:watch": "vitest",
|
|
36
37
|
"watch": "npm run build -- --watch src"
|
|
37
38
|
},
|
|
@@ -39,9 +40,8 @@
|
|
|
39
40
|
"dist"
|
|
40
41
|
],
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"deepmerge": "^4.2.2",
|
|
43
43
|
"execa": "^5.1.1",
|
|
44
|
-
"fixturify-project": "^
|
|
44
|
+
"fixturify-project": "^5.0.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@babel/plugin-transform-typescript": "^7.16.8",
|
|
50
50
|
"@babel/preset-env": "^7.16.11",
|
|
51
51
|
"@babel/preset-typescript": "^7.16.7",
|
|
52
|
-
"@scalvert/readme-api-generator": "^0.2.
|
|
52
|
+
"@scalvert/readme-api-generator": "^0.2.4",
|
|
53
53
|
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
|
54
54
|
"@typescript-eslint/parser": "^5.14.0",
|
|
55
55
|
"eslint": "^8.10.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"type-fest": "^2.12.0",
|
|
67
67
|
"typescript": "^4.6.2",
|
|
68
68
|
"vite": "^2.8.6",
|
|
69
|
-
"vitest": "^0.
|
|
69
|
+
"vitest": "^0.9.3"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=14"
|