commitizen 5.0.2 → 5.1.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/CONTRIBUTING.md +9 -0
- package/README.md +84 -5
- package/SECURITY.md +17 -0
- package/bin/git-cz.js +9 -6
- package/dist/cli/strategies/git-cz.js +1 -1
- package/dist/commitizen/adapter.js +11 -2
- package/dist/commitizen/configLoader.js +7 -7
- package/dist/commitizen/protocol.js +156 -0
- package/dist/common/util.js +0 -4
- package/junit-testresults.xml +101 -99
- package/package.json +4 -5
- package/pnpm-workspace.yaml +8 -0
- package/renovate.json +12 -0
- package/dist/configLoader/findup.js +0 -33
- package/dist/configLoader/getContent.js +0 -72
- package/dist/configLoader/getNormalizedConfig.js +0 -30
- package/dist/configLoader/loader.js +0 -59
- package/dist/configLoader.js +0 -34
package/CONTRIBUTING.md
CHANGED
|
@@ -85,3 +85,12 @@ Some tests deliberately contain lines with only whitespace, to check how
|
|
|
85
85
|
multiline commit messages behave across operating systems. If your editor
|
|
86
86
|
strips trailing whitespace on save, turn that off for `test/` before editing
|
|
87
87
|
those files, or the tests will change in ways you didn't intend.
|
|
88
|
+
|
|
89
|
+
### A commitizen config in your home directory can change test results
|
|
90
|
+
|
|
91
|
+
Config loading comes from `@commitizen/config`, which falls back to `.czrc`,
|
|
92
|
+
`.cz.json` or `package.json` in your home directory when a project has none.
|
|
93
|
+
Unlike commitizen's old built-in loader, it doesn't skip that step while tests
|
|
94
|
+
run. If you have one of those files in your home directory, the `init` tests
|
|
95
|
+
may see an adapter as already configured. Rename the file while you run the
|
|
96
|
+
tests.
|
package/README.md
CHANGED
|
@@ -26,9 +26,11 @@ Simply use `git cz` or just `cz` instead of `git commit` when committing. You ca
|
|
|
26
26
|
_Alternatively_, if you are using **npm 5.2+** you can [use `npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) instead of installing globally:
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
|
-
npx cz
|
|
29
|
+
npx --no -- cz
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
`--no` stops npx from downloading anything when commitizen isn't installed in the project. Without it, npx would fetch an unrelated npm package that is also named `cz`. With pnpm, use `pnpm exec cz`.
|
|
33
|
+
|
|
32
34
|
or as an npm script:
|
|
33
35
|
|
|
34
36
|
```json
|
|
@@ -44,7 +46,7 @@ When you're working in a Commitizen-friendly repository, you'll be prompted to f
|
|
|
44
46
|
|
|
45
47
|
### If your repo is NOT Commitizen friendly:
|
|
46
48
|
|
|
47
|
-
If you're **not** working in a Commitizen-friendly repository, then `git cz` will work just the same as `git commit
|
|
49
|
+
If you're **not** working in a Commitizen-friendly repository, then `git cz` will work just the same as `git commit`. To fix this, you need to first [make your repo Commitizen friendly](#making-your-repo-commitizen-friendly)
|
|
48
50
|
|
|
49
51
|
## Making your repo Commitizen friendly
|
|
50
52
|
|
|
@@ -162,7 +164,7 @@ For `husky` users, add the following configuration to the project's `package.jso
|
|
|
162
164
|
```json
|
|
163
165
|
"husky": {
|
|
164
166
|
"hooks": {
|
|
165
|
-
"prepare-commit-msg": "exec < /dev/tty && npx cz --hook || true"
|
|
167
|
+
"prepare-commit-msg": "exec < /dev/tty && npx --no -- cz --hook || true"
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
```
|
|
@@ -283,7 +285,84 @@ We know that every project and build process has different requirements, so we'v
|
|
|
283
285
|
- [cz-vinyl](https://github.com/Exlint/cz-vinyl)
|
|
284
286
|
- [commit-jazzer](https://github.com/Zilero232/commit-jazzer)
|
|
285
287
|
|
|
286
|
-
|
|
288
|
+
### Writing an adapter
|
|
289
|
+
|
|
290
|
+
An adapter can work in one of two ways.
|
|
291
|
+
|
|
292
|
+
**As a program (adapter protocol).** Commitizen runs your adapter as its own
|
|
293
|
+
Node.js program, so you can use any prompt library, ES modules and top-level
|
|
294
|
+
`await`, and you don't need to depend on `commitizen`. Declare it in the
|
|
295
|
+
adapter's `package.json`:
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"main": "./bin.js",
|
|
300
|
+
"commitizenAdapter": {
|
|
301
|
+
"protocol": [1],
|
|
302
|
+
"bin": "./bin.js"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Commitizen runs `bin` with the same Node.js and your terminal, and sets:
|
|
308
|
+
|
|
309
|
+
| Variable | Meaning |
|
|
310
|
+
|---|---|
|
|
311
|
+
| `CZ_PROTOCOL` | The protocol version, currently `1`. |
|
|
312
|
+
| `CZ_MESSAGE_FILE` | An empty file. Write the commit message to it. |
|
|
313
|
+
| `CZ_CONFIG_FILE` | A JSON file with the project's commitizen config (`config.commitizen`, `.czrc` or `.cz.json`). |
|
|
314
|
+
| `CZ_GIT_ROOT` | The repository root. |
|
|
315
|
+
|
|
316
|
+
Exit with 0 after writing the message and commitizen commits it, including
|
|
317
|
+
`--hook` and `--retry` support. Exit with 0 without writing anything to cancel,
|
|
318
|
+
or exit non-zero to abort; commitizen exits with the same status. `main` must
|
|
319
|
+
point at a file that exists, because commitizen resolves the adapter path the
|
|
320
|
+
same way for every adapter. See [examples/protocol-adapter](examples/protocol-adapter)
|
|
321
|
+
for a complete adapter with no dependencies.
|
|
322
|
+
|
|
323
|
+
**As a module (original API).** Export a `prompter(cz, commit)` function.
|
|
324
|
+
Commitizen loads the module with `require()` and passes an instance of
|
|
325
|
+
[Inquirer.js](https://github.com/SBoudrias/Inquirer.js/) 8, though you can
|
|
326
|
+
capture input using whatever means necessary. Call the `commit` callback with a
|
|
327
|
+
string and we'll be happy. Existing adapters keep working this way.
|
|
328
|
+
|
|
329
|
+
Publish your adapter to npm, and you'll be all set!
|
|
330
|
+
|
|
331
|
+
## Security: risks and how to reduce them
|
|
332
|
+
|
|
333
|
+
Commitizen runs code from your project's dependencies, and sometimes from the repository itself. Plain `git commit` doesn't. This section explains the risks and what you can do about each.
|
|
334
|
+
|
|
335
|
+
### Risks
|
|
336
|
+
|
|
337
|
+
- **An adapter runs with your full permissions.** Commitizen runs the adapter named in `config.commitizen.path`, either inside its own process (a `prompter` adapter) or as a separate program (a protocol adapter). Either way it runs as you. It can read your files, SSH keys and environment variables (including tokens), change your working tree and staged files, and run git. Commitizen can't limit what an adapter does.
|
|
338
|
+
- **A repository can bring its own adapter.** `config.commitizen.path` can name a file inside the repository, such as `./tools/adapter.js`. Running `git cz` in a repository you've just cloned can then run that repository's code, just as `npm test` would.
|
|
339
|
+
- **An adapter can change what gets committed.** Commitizen commits whatever is staged when the adapter finishes.
|
|
340
|
+
- **Some adapters send data elsewhere.** Adapters that integrate with issue trackers or AI services may send your branch name, staged changes or message to that service.
|
|
341
|
+
- **Commit messages are kept for `--retry`.** Commitizen saves the last message for each repository in `commitizen.json` in your user cache directory (for example `~/Library/Caches/commitizen` on macOS or `~/.cache/commitizen` on Linux).
|
|
342
|
+
- **Installing runs code.** Depending on your package manager, installing an adapter can run install scripts from the adapter and any of its dependencies. A compromised release of any of them runs on your machine before you ever use commitizen.
|
|
343
|
+
- **`npx cz` can download an unrelated package.** If commitizen isn't installed in the project, `npx cz` looks for an npm package named `cz`, which isn't commitizen.
|
|
344
|
+
|
|
345
|
+
### Reducing the risk
|
|
346
|
+
|
|
347
|
+
- **Choose adapters as carefully as any dev dependency you run**, such as a test runner or linter. Prefer widely used, maintained adapters, and read what an adapter sends to other services before giving it tokens.
|
|
348
|
+
- **Check a repository before running `git cz` in it.** Look at `config.commitizen` in its `package.json`, `.czrc` or `.cz.json`. A path starting with `./` runs code from the repository.
|
|
349
|
+
- **Check your commit** with `git show --stat HEAD` when trying out an adapter you haven't reviewed.
|
|
350
|
+
- **Keep secrets out of commit messages.** They end up in git history anyway.
|
|
351
|
+
- **Run the commitizen installed in your project**, not one npx downloads: `npx --no -- cz`, `pnpm exec cz` or `node_modules/.bin/cz`. `--no` makes npx fail instead of downloading.
|
|
352
|
+
- **Commit your lockfile and install exact versions** (`--save-exact`, as in the examples above), so everyone runs the versions you reviewed.
|
|
353
|
+
- **Delay new releases.** Most attacks through npm are found and removed within days. A minimum release age makes your package manager ignore versions newer than that, and avoid install scripts where you can:
|
|
354
|
+
|
|
355
|
+
| Package manager | `commitizen init` | Install scripts from dependencies | Minimum release age |
|
|
356
|
+
|---|---|---|---|
|
|
357
|
+
| npm | default | Run by default. Use `--ignore-scripts` or `ignore-scripts=true` in `.npmrc`. | [`min-release-age`](https://docs.npmjs.com/cli/v11/using-npm/config#min-release-age) (days), npm 11.10+ |
|
|
358
|
+
| Yarn 1 | `--yarn` | Run by default. Use `--ignore-scripts`. | Not available |
|
|
359
|
+
| Yarn 2+ | `--yarn` | Run by default. Set `enableScripts: false` in `.yarnrc.yml`. | [`npmMinimalAgeGate`](https://yarnpkg.com/configuration/yarnrc#npmMinimalAgeGate), Yarn 4.10+ |
|
|
360
|
+
| pnpm | `--pnpm` | Not run: commitizen passes `--ignore-scripts`, and pnpm 10+ runs dependency scripts only for packages you allow. | [`minimumReleaseAge`](https://pnpm.io/settings#minimumreleaseage) (minutes); on by default (1 day) in pnpm 11 |
|
|
361
|
+
| Bun | Not supported; install the adapter yourself and set `config.commitizen.path` | Run only for packages in `trustedDependencies` (and Bun's built-in list). | [`minimumReleaseAge`](https://bun.com/docs/pm/cli/install) in `bunfig.toml` (seconds) |
|
|
362
|
+
|
|
363
|
+
Commitizen itself passes the commit message to git as a single argument, never through a shell, so a message can't run commands.
|
|
364
|
+
|
|
365
|
+
To report a security problem in commitizen itself, use [GitHub's private vulnerability reporting](https://github.com/commitizen/cz-cli/security/advisories/new) rather than a public issue.
|
|
287
366
|
|
|
288
367
|
## Retrying failed commits
|
|
289
368
|
|
|
@@ -294,7 +373,7 @@ Please note that the retry cache may be cleared when upgrading Commitizen versio
|
|
|
294
373
|
It is important to note that if you are running `cz` from an npm script (let's say it is called `commit`) you will need to do one of the following:
|
|
295
374
|
|
|
296
375
|
- Pass `-- --retry` as an argument for your script. i.e: `npm run commit -- --retry`
|
|
297
|
-
- Use [npx](https://www.npmjs.com/package/npx) to find and call the `cz` executable directly. i.e: `npx cz --retry`
|
|
376
|
+
- Use [npx](https://www.npmjs.com/package/npx) to find and call the `cz` executable directly. i.e: `npx --no -- cz --retry`
|
|
298
377
|
|
|
299
378
|
Note that the last two options **do not** require you to pass `--` before the args but the first **does**.
|
|
300
379
|
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please report security problems privately through [GitHub's private vulnerability reporting](https://github.com/commitizen/cz-cli/security/advisories/new), not in a public issue or pull request.
|
|
6
|
+
|
|
7
|
+
Include what you found, the commitizen version, and steps to reproduce it if you can. We'll reply in the advisory, and credit you when the fix is published unless you'd rather not be named.
|
|
8
|
+
|
|
9
|
+
## Supported versions
|
|
10
|
+
|
|
11
|
+
Fixes are released for the latest major version only. Please upgrade before reporting a problem in an older version.
|
|
12
|
+
|
|
13
|
+
## What counts as a vulnerability
|
|
14
|
+
|
|
15
|
+
Commitizen runs the adapter your project configures, with your permissions, so an adapter doing something harmful isn't a vulnerability in commitizen itself. Report those to the adapter's maintainers. See [Security: risks and how to reduce them](README.md#security-risks-and-how-to-reduce-them) for what commitizen does and doesn't protect against.
|
|
16
|
+
|
|
17
|
+
Problems in commitizen's own code, such as running code or commands it shouldn't, are in scope.
|
package/bin/git-cz.js
CHANGED
|
@@ -5,12 +5,15 @@ process.on('uncaughtException', function (err) {
|
|
|
5
5
|
process.exit(1);
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
// catch SIGINT signal
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
// catch SIGINT signal. Only a terminal can send Ctrl-C as data; listening on a
|
|
9
|
+
// pipe would read input meant for the adapter.
|
|
10
|
+
if (process.stdin.isTTY) {
|
|
11
|
+
process.stdin.on('data', function (key) {
|
|
12
|
+
if (key == '\u0003') {
|
|
13
|
+
process.exit(130); // 128 + SIGINT
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
14
17
|
|
|
15
18
|
require('../dist/cli/git-cz.js').bootstrap({
|
|
16
19
|
cliPath: path.join(__dirname, '../')
|
|
@@ -49,7 +49,7 @@ function gitCz(rawGitArgs, environment, adapterConfig) {
|
|
|
49
49
|
let hookMode = !(typeof parsedCommitizenArgs.hook === 'undefined');
|
|
50
50
|
let resolvedAdapterConfigPath = resolveAdapterPath(adapterConfig.path);
|
|
51
51
|
let resolvedAdapterRootPath = (0, _util.findPackageRoot)(resolvedAdapterConfigPath);
|
|
52
|
-
let prompter = getPrompter(adapterConfig.path);
|
|
52
|
+
let prompter = getPrompter(adapterConfig.path, adapterConfig);
|
|
53
53
|
let shouldStageAllFiles = rawGitArgs.includes('-a') || rawGitArgs.includes('--all');
|
|
54
54
|
isClean(process.cwd(), function (error, stagingIsClean) {
|
|
55
55
|
if (error) {
|
|
@@ -16,6 +16,7 @@ var _nodePath = _interopRequireDefault(require("node:path"));
|
|
|
16
16
|
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
17
17
|
var _detectIndent = _interopRequireDefault(require("detect-indent"));
|
|
18
18
|
var _util = require("../common/util");
|
|
19
|
+
var _protocol = require("./protocol");
|
|
19
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
21
|
/**
|
|
21
22
|
* ADAPTER
|
|
@@ -141,11 +142,19 @@ function getInstallStringMappings({
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
/**
|
|
144
|
-
* Gets the prompter from an adapter given an adapter path
|
|
145
|
+
* Gets the prompter from an adapter given an adapter path.
|
|
146
|
+
*
|
|
147
|
+
* For an adapter that declares the adapter protocol in its package.json, the
|
|
148
|
+
* prompter runs the adapter's program and `config` (the commitizen config) is
|
|
149
|
+
* passed to it. Other adapters are loaded with require(), as always.
|
|
145
150
|
*/
|
|
146
|
-
function getPrompter(adapterPath) {
|
|
151
|
+
function getPrompter(adapterPath, config) {
|
|
147
152
|
// Resolve the adapter path
|
|
148
153
|
let resolvedAdapterPath = resolveAdapterPath(adapterPath);
|
|
154
|
+
let declaration = (0, _protocol.getProtocolDeclaration)(resolvedAdapterPath);
|
|
155
|
+
if (declaration) {
|
|
156
|
+
return (0, _protocol.createProtocolPrompter)(declaration, config, getGitRootPath());
|
|
157
|
+
}
|
|
149
158
|
|
|
150
159
|
// Load the adapter
|
|
151
160
|
let adapter = require(resolvedAdapterPath);
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
Object.defineProperty(exports, "load", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _config.load;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _config = require("@commitizen/config");
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SUPPORTED_PROTOCOLS = void 0;
|
|
7
|
+
exports.chooseProtocol = chooseProtocol;
|
|
8
|
+
exports.createProtocolPrompter = createProtocolPrompter;
|
|
9
|
+
exports.getProtocolDeclaration = getProtocolDeclaration;
|
|
10
|
+
var _nodeChild_process = _interopRequireDefault(require("node:child_process"));
|
|
11
|
+
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
12
|
+
var _nodeOs = _interopRequireDefault(require("node:os"));
|
|
13
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
14
|
+
var _util = require("../common/util");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
/**
|
|
17
|
+
* ADAPTER PROTOCOL
|
|
18
|
+
*
|
|
19
|
+
* A protocol adapter is a program, not a module commitizen loads. Its
|
|
20
|
+
* package.json declares:
|
|
21
|
+
*
|
|
22
|
+
* "commitizenAdapter": { "protocol": [1], "bin": "./bin.js" }
|
|
23
|
+
*
|
|
24
|
+
* commitizen runs `bin` with the same Node.js, with the terminal inherited, and
|
|
25
|
+
* these environment variables:
|
|
26
|
+
*
|
|
27
|
+
* CZ_PROTOCOL the protocol version commitizen chose
|
|
28
|
+
* CZ_MESSAGE_FILE an empty file; the adapter writes the commit message here
|
|
29
|
+
* CZ_CONFIG_FILE JSON of the commitizen config (what configLoader.load() returns)
|
|
30
|
+
* CZ_GIT_ROOT the repository root
|
|
31
|
+
*
|
|
32
|
+
* Exit 0 with a message commits it. Exit 0 with an empty message cancels.
|
|
33
|
+
* Any other exit aborts with that exit status.
|
|
34
|
+
*
|
|
35
|
+
* Adapters without the declaration are loaded with require() and called as
|
|
36
|
+
* prompter(inquirer, commit), exactly as before.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// Protocol versions this version of commitizen can run, oldest first.
|
|
40
|
+
const SUPPORTED_PROTOCOLS = exports.SUPPORTED_PROTOCOLS = [1];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns the adapter's protocol declaration ({ protocol, bin, root }), or
|
|
44
|
+
* undefined for a legacy adapter. `resolvedAdapterPath` is the file that
|
|
45
|
+
* resolveAdapterPath() found.
|
|
46
|
+
*/
|
|
47
|
+
function getProtocolDeclaration(resolvedAdapterPath) {
|
|
48
|
+
let root;
|
|
49
|
+
let packageJson;
|
|
50
|
+
try {
|
|
51
|
+
root = (0, _util.findPackageRoot)(_nodePath.default.dirname(resolvedAdapterPath));
|
|
52
|
+
packageJson = JSON.parse(_nodeFs.default.readFileSync(_nodePath.default.join(root, 'package.json'), 'utf8'));
|
|
53
|
+
} catch (error) {
|
|
54
|
+
// No readable package.json: a legacy adapter such as a single local file.
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
let declaration = packageJson.commitizenAdapter;
|
|
58
|
+
if (!declaration || typeof declaration !== 'object') {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
let name = packageJson.name || root;
|
|
62
|
+
if (!Array.isArray(declaration.protocol) || typeof declaration.bin !== 'string') {
|
|
63
|
+
throw new Error(`The adapter ${name} has an invalid "commitizenAdapter" field in its package.json. ` + 'It needs "protocol" (an array of versions) and "bin" (a path to the adapter program).');
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
name,
|
|
67
|
+
root,
|
|
68
|
+
protocol: declaration.protocol,
|
|
69
|
+
bin: declaration.bin
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Picks the highest protocol version both commitizen and the adapter support,
|
|
75
|
+
* or throws if there is none.
|
|
76
|
+
*/
|
|
77
|
+
function chooseProtocol(declaration) {
|
|
78
|
+
let shared = SUPPORTED_PROTOCOLS.filter(function (version) {
|
|
79
|
+
return declaration.protocol.includes(version);
|
|
80
|
+
});
|
|
81
|
+
if (shared.length === 0) {
|
|
82
|
+
throw new Error(`The adapter ${declaration.name} speaks protocol version(s) ${declaration.protocol.join(', ')}, ` + `but this version of commitizen supports ${SUPPORTED_PROTOCOLS.join(', ')}. ` + 'Upgrade whichever of the two is older.');
|
|
83
|
+
}
|
|
84
|
+
return shared[shared.length - 1];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Returns a prompter(inquirer, commit) that runs a protocol adapter's program.
|
|
89
|
+
* Because it has the legacy prompter shape, commit, --hook and --retry work the
|
|
90
|
+
* same for both kinds of adapter. The prompter returns a promise that resolves
|
|
91
|
+
* once the adapter has finished (commitizen itself ignores it).
|
|
92
|
+
*/
|
|
93
|
+
function createProtocolPrompter(declaration, config, gitRootPath) {
|
|
94
|
+
let version = chooseProtocol(declaration);
|
|
95
|
+
let binPath = _nodePath.default.resolve(declaration.root, declaration.bin);
|
|
96
|
+
function prompter(inquirer, commit) {
|
|
97
|
+
return new Promise(function (resolve) {
|
|
98
|
+
run(commit, resolve);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function run(commit, resolve) {
|
|
102
|
+
let workDirectory = _nodeFs.default.mkdtempSync(_nodePath.default.join(_nodeOs.default.tmpdir(), 'commitizen-'));
|
|
103
|
+
let messageFile = _nodePath.default.join(workDirectory, 'COMMIT_MESSAGE');
|
|
104
|
+
let configFile = _nodePath.default.join(workDirectory, 'config.json');
|
|
105
|
+
_nodeFs.default.writeFileSync(messageFile, '');
|
|
106
|
+
_nodeFs.default.writeFileSync(configFile, JSON.stringify(config || {}));
|
|
107
|
+
|
|
108
|
+
// The adapter owns the terminal while it runs. Stop this process reading
|
|
109
|
+
// stdin (bin/git-cz listens for Ctrl-C) so it doesn't take the input.
|
|
110
|
+
process.stdin.pause();
|
|
111
|
+
let child = _nodeChild_process.default.spawn(process.execPath, [binPath], {
|
|
112
|
+
stdio: 'inherit',
|
|
113
|
+
env: {
|
|
114
|
+
...process.env,
|
|
115
|
+
CZ_PROTOCOL: String(version),
|
|
116
|
+
CZ_MESSAGE_FILE: messageFile,
|
|
117
|
+
CZ_CONFIG_FILE: configFile,
|
|
118
|
+
CZ_GIT_ROOT: gitRootPath
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
let finished = false;
|
|
122
|
+
function finish(status, message) {
|
|
123
|
+
finished = true;
|
|
124
|
+
_nodeFs.default.rmSync(workDirectory, {
|
|
125
|
+
recursive: true,
|
|
126
|
+
force: true
|
|
127
|
+
});
|
|
128
|
+
if (status !== 0) {
|
|
129
|
+
// The adapter has already reported its own error.
|
|
130
|
+
process.exitCode = status;
|
|
131
|
+
} else if (message.trim() === '') {
|
|
132
|
+
console.log('No commit message from the adapter; nothing was committed.');
|
|
133
|
+
} else {
|
|
134
|
+
commit(message);
|
|
135
|
+
}
|
|
136
|
+
resolve();
|
|
137
|
+
}
|
|
138
|
+
child.on('error', function (error) {
|
|
139
|
+
console.error(`Could not run the adapter ${declaration.name} (${binPath}): ${error.message}`);
|
|
140
|
+
finish(1);
|
|
141
|
+
});
|
|
142
|
+
child.on('close', function (code, signal) {
|
|
143
|
+
// A child that fails to start emits 'error' and may then emit 'close'.
|
|
144
|
+
if (finished) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (signal || code !== 0) {
|
|
148
|
+
finish(code || 1);
|
|
149
|
+
} else {
|
|
150
|
+
finish(0, _nodeFs.default.readFileSync(messageFile, 'utf8'));
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
prompter.protocol = version;
|
|
155
|
+
return prompter;
|
|
156
|
+
}
|
package/dist/common/util.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.findPackageRoot = findPackageRoot;
|
|
|
8
8
|
exports.getParsedJsonFromFile = getParsedJsonFromFile;
|
|
9
9
|
exports.getParsedPackageJsonFromPath = getParsedPackageJsonFromPath;
|
|
10
10
|
exports.isFunction = isFunction;
|
|
11
|
-
exports.isInTest = isInTest;
|
|
12
11
|
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
13
12
|
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -45,9 +44,6 @@ function isFunction(functionToCheck) {
|
|
|
45
44
|
return functionToCheck && (functionType === '[object Function]' || functionType === '[object AsyncFunction]');
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
function isInTest() {
|
|
49
|
-
return typeof global.it === 'function';
|
|
50
|
-
}
|
|
51
47
|
|
|
52
48
|
/**
|
|
53
49
|
* Walks up from `start` (inclusive) to the nearest directory containing a
|
package/junit-testresults.xml
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<testsuite name="Mocha Tests" tests="
|
|
2
|
-
<testcase classname="adapter" name="resolves adapter paths" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="4.
|
|
3
|
-
<testcase classname="adapter" name="resolves scoped adapter paths" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="
|
|
1
|
+
<testsuite name="Mocha Tests" tests="152" failures="0" errors="0" skipped="1" timestamp="Sat, 05 Dec 2026 16:01:01 GMT" time="48.478">
|
|
2
|
+
<testcase classname="adapter" name="resolves adapter paths" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="4.621"/>
|
|
3
|
+
<testcase classname="adapter" name="resolves scoped adapter paths" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.881"/>
|
|
4
4
|
<testcase classname="adapter" name="gets adapter prompter functions" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"><skipped/></testcase>
|
|
5
|
-
<testcase classname="adapter" name="gets adapter prompter functions for default export adapters" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
5
|
+
<testcase classname="adapter" name="gets adapter prompter functions for default export adapters" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.716"/>
|
|
6
6
|
<testcase classname="adapter (unit) getInstallStringMappings" name="maps npm flags" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
7
7
|
<testcase classname="adapter (unit) getInstallStringMappings" name="uses --save for a prod install (save without saveDev)" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
8
8
|
<testcase classname="adapter (unit) getInstallStringMappings" name="maps yarn flags" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
9
9
|
<testcase classname="adapter (unit) getInstallStringMappings" name="maps pnpm flags and always ignores dependency build scripts" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
10
|
-
<testcase classname="adapter (unit) getInstallStringMappings" name="pnpm adds --save-exact for either `exact` or `saveExact`" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
10
|
+
<testcase classname="adapter (unit) getInstallStringMappings" name="pnpm adds --save-exact for either `exact` or `saveExact`" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
11
11
|
<testcase classname="adapter (unit) getInstallStringMappings" name="falls back to the npm mapping for an unknown package manager" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
12
12
|
<testcase classname="adapter (unit) generateInstallAdapterCommand" name="builds an npm install command by default" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
13
|
-
<testcase classname="adapter (unit) generateInstallAdapterCommand" name="builds a yarn add command" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
14
|
-
<testcase classname="adapter (unit) generateInstallAdapterCommand" name="builds a pnpm add command" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
13
|
+
<testcase classname="adapter (unit) generateInstallAdapterCommand" name="builds a yarn add command" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
14
|
+
<testcase classname="adapter (unit) generateInstallAdapterCommand" name="builds a pnpm add command" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
15
15
|
<testcase classname="adapter (unit) generateInstallAdapterCommand" name="falls back to "install" for an unrecognised package manager" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
16
|
-
<testcase classname="adapter (unit) getNearestNodeModulesDirectory" name="searches from the current directory when no options are given" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
17
|
-
<testcase classname="adapter (unit) getNearestNodeModulesDirectory" name="accepts a directory string" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
18
|
-
<testcase classname="adapter (unit) getNearestNodeModulesDirectory" name="accepts an options object with cwd" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
19
|
-
<testcase classname="adapter (unit) addPathToAdapterConfig" name="adds config.commitizen.path, preserving the detected indentation" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
20
|
-
<testcase classname="adapter (unit) addPathToAdapterConfig" name="falls back to a two-space indent when none can be detected" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
21
|
-
<testcase classname="adapter (unit) addPathToAdapterConfig" name="leaves package.json untouched when the bare adapter name is already configured" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
22
|
-
<testcase classname="adapter (unit) addPathToAdapterConfig" name="leaves package.json untouched when the ./node_modules adapter path is already configured" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
23
|
-
<testcase classname="commitizen cache" name="creates the cache file when setting a value for the first time" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
24
|
-
<testcase classname="commitizen cache" name="merges into an existing cache instead of clobbering it" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
25
|
-
<testcase classname="commitizen cache" name="overwrites the value for a key that already exists" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
16
|
+
<testcase classname="adapter (unit) getNearestNodeModulesDirectory" name="searches from the current directory when no options are given" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.019"/>
|
|
17
|
+
<testcase classname="adapter (unit) getNearestNodeModulesDirectory" name="accepts a directory string" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.016"/>
|
|
18
|
+
<testcase classname="adapter (unit) getNearestNodeModulesDirectory" name="accepts an options object with cwd" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.022"/>
|
|
19
|
+
<testcase classname="adapter (unit) addPathToAdapterConfig" name="adds config.commitizen.path, preserving the detected indentation" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.022"/>
|
|
20
|
+
<testcase classname="adapter (unit) addPathToAdapterConfig" name="falls back to a two-space indent when none can be detected" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.014"/>
|
|
21
|
+
<testcase classname="adapter (unit) addPathToAdapterConfig" name="leaves package.json untouched when the bare adapter name is already configured" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.014"/>
|
|
22
|
+
<testcase classname="adapter (unit) addPathToAdapterConfig" name="leaves package.json untouched when the ./node_modules adapter path is already configured" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.013"/>
|
|
23
|
+
<testcase classname="commitizen cache" name="creates the cache file when setting a value for the first time" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
24
|
+
<testcase classname="commitizen cache" name="merges into an existing cache instead of clobbering it" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
25
|
+
<testcase classname="commitizen cache" name="overwrites the value for a key that already exists" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
26
26
|
<testcase classname="commitizen cache" name="reads a stored value back by key" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
27
|
-
<testcase classname="commitizen cache" name="returns undefined for a missing key" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
27
|
+
<testcase classname="commitizen cache" name="returns undefined for a missing key" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
28
28
|
<testcase classname="commitizen cache" name="returns undefined (rather than throwing) when the cache file does not exist" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
29
29
|
<testcase classname="commitizen cache" name="throws from readCacheSync when the cache file does not exist" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
30
30
|
<testcase classname="cli git-cz bootstrap when config is provided" name="passes config to useGitCzStrategy" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
31
31
|
<testcase classname="cli git-cz bootstrap when config is not provided and the config is returned from configLoader.load" name="uses config from configLoader.load()" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
32
32
|
<testcase classname="cli git-cz bootstrap when config is not provided and the config is not returned from configLoader.load" name="tells commitizen to use the git strategy" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
33
33
|
<testcase classname="cli git-cz bootstrap when argv is overridden" name="uses the overridden argv" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
34
|
-
<testcase classname="cli git-cz bootstrap when called with no arguments" name="defaults environment to {} and argv to process.argv" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
35
|
-
<testcase classname="cli commitizen" name="slices argv down to the raw git args before parsing" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
36
|
-
<testcase classname="cli commitizen" name="defaults environment and argv when called with no arguments" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
34
|
+
<testcase classname="cli git-cz bootstrap when called with no arguments" name="defaults environment to {} and argv to process.argv" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
35
|
+
<testcase classname="cli commitizen" name="slices argv down to the raw git args before parsing" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
36
|
+
<testcase classname="cli commitizen" name="defaults environment and argv when called with no arguments" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
37
37
|
<testcase classname="cli commitizen init command" name="calls init() with cwd, the adapter name and the parsed args" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
38
|
-
<testcase classname="cli commitizen init command" name="logs, but does not throw, when init() fails" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
38
|
+
<testcase classname="cli commitizen init command" name="logs, but does not throw, when init() fails" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
39
39
|
<testcase classname="cli commitizen init command" name="errors when no adapter name is provided" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
40
40
|
<testcase classname="cli commitizen any other invocation" name="prints usage help and runs no command" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
41
41
|
<testcase classname="cli commitizen any other invocation" name="prints usage help for an unknown command" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
@@ -44,107 +44,109 @@
|
|
|
44
44
|
<testcase classname="cli strategies/git" name="spawns "git commit" with the raw args and inherited stdio" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
45
45
|
<testcase classname="cli strategies/git" name="rethrows when the child process emits an error" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
46
46
|
<testcase classname="cli strategies/git" name="does not spawn git in debug mode, it just logs" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
47
|
-
<testcase classname="cli strategies/git-cz" name="delegates to the plain git strategy when --amend is present" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
48
|
-
<testcase classname="cli strategies/git-cz" name="runs the commit flow, wiring the prompter and options through" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
47
|
+
<testcase classname="cli strategies/git-cz" name="delegates to the plain git strategy when --amend is present" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
48
|
+
<testcase classname="cli strategies/git-cz" name="runs the commit flow, wiring the prompter and options through" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
49
49
|
<testcase classname="cli strategies/git-cz" name="flags retryLastCommit when the first arg is --retry" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
50
|
-
<testcase classname="cli strategies/git-cz" name="flags hookMode when --hook was parsed" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
51
|
-
<testcase classname="cli strategies/git-cz" name="stages all files when -a / --all is passed" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
50
|
+
<testcase classname="cli strategies/git-cz" name="flags hookMode when --hook was parsed" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
51
|
+
<testcase classname="cli strategies/git-cz" name="stages all files when -a / --all is passed" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
52
52
|
<testcase classname="cli strategies/git-cz" name="throws when the staging area is clean and --allow-empty is absent" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
53
|
-
<testcase classname="cli strategies/git-cz" name="proceeds when the staging area is clean but --allow-empty is present" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
53
|
+
<testcase classname="cli strategies/git-cz" name="proceeds when the staging area is clean but --allow-empty is present" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
54
54
|
<testcase classname="cli strategies/git-cz" name="rethrows an error from the staging check" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
55
|
-
<testcase classname="cli strategies/git-cz" name="rethrows an error surfaced by the commit callback" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
55
|
+
<testcase classname="cli strategies/git-cz" name="rethrows an error surfaced by the commit callback" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.009"/>
|
|
56
56
|
<testcase classname="cli strategies/git-cz" name="exits with code 0 when the commit succeeds" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.012"/>
|
|
57
|
-
<testcase classname="commit" name="should commit simple messages" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
58
|
-
<testcase classname="commit" name="should commit message with quotes" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
59
|
-
<testcase classname="commit" name="should commit multiline messages" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
60
|
-
<testcase classname="commit" name="should allow to override git commit options" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
61
|
-
<testcase classname="commit" name="should respect original behavior of -a option" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
62
|
-
<testcase classname="commit" name="should save directly to .git/COMMIT_EDITMSG with --hook option" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
63
|
-
<testcase classname="commit" name="should throw error if staging area is empty" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
64
|
-
<testcase classname="commitizen commit (unit)" name="logs and bails when the cache directory cannot be created" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
57
|
+
<testcase classname="commit" name="should commit simple messages" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.581"/>
|
|
58
|
+
<testcase classname="commit" name="should commit message with quotes" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.19"/>
|
|
59
|
+
<testcase classname="commit" name="should commit multiline messages" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.82"/>
|
|
60
|
+
<testcase classname="commit" name="should allow to override git commit options" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.172"/>
|
|
61
|
+
<testcase classname="commit" name="should respect original behavior of -a option" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.173"/>
|
|
62
|
+
<testcase classname="commit" name="should save directly to .git/COMMIT_EDITMSG with --hook option" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.165"/>
|
|
63
|
+
<testcase classname="commit" name="should throw error if staging area is empty" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.182"/>
|
|
64
|
+
<testcase classname="commitizen commit (unit)" name="logs and bails when the cache directory cannot be created" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.009"/>
|
|
65
65
|
<testcase classname="commitizen commit (unit)" name="runs the prompter and commits the message it returns, caching the attempt" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.008"/>
|
|
66
66
|
<testcase classname="commitizen commit (unit)" name="propagates an Error raised by the adapter prompter without committing" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.007"/>
|
|
67
|
-
<testcase classname="commitizen commit (unit)" name="replays the previous attempt from cache when retryLastCommit is set" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
68
|
-
<testcase classname="
|
|
69
|
-
<testcase classname="
|
|
70
|
-
<testcase classname="
|
|
71
|
-
<testcase classname="
|
|
72
|
-
<testcase classname="configLoader" name="returns undefined when the config file does not exist" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
73
|
-
<testcase classname="configLoader" name="normalizes package.json configs" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
74
|
-
<testcase classname="configLoader" name="returns undefined for a package.json with neither config.commitizen nor czConfig" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
75
|
-
<testcase classname="configLoader" name="returns undefined for a package.json with no content" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
76
|
-
<testcase classname="configLoader" name="normalizes .cz.json configs" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
77
|
-
<testcase classname="configLoader" name="normalizes .czrc configs" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
78
|
-
<testcase classname="configLoader loader" name="loads an explicitly provided config path directly" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
79
|
-
<testcase classname="configLoader loader" name="discovers a config file in the given directory" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
80
|
-
<testcase classname="configLoader loader" name="returns undefined when nothing is found (and not falling through to $HOME during tests)" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
81
|
-
<testcase classname="configLoader loader" name="defaults the search directory to process.cwd()" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
82
|
-
<testcase classname="configLoader findup" name="walks up parent directories to find a matching file" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
83
|
-
<testcase classname="configLoader findup" name="returns undefined when the file is never found on the way up to the root" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
84
|
-
<testcase classname="configLoader findup" name="skips matches rejected by the filter callback" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
85
|
-
<testcase classname="git helpers log" name="passes stdout to the callback on success" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.004"/>
|
|
86
|
-
<testcase classname="git helpers log" name="throws when git errors" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.004"/>
|
|
87
|
-
<testcase classname="git helpers whatChanged" name="passes stdout to the callback on success" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.003"/>
|
|
88
|
-
<testcase classname="git helpers whatChanged" name="throws when git errors" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.003"/>
|
|
67
|
+
<testcase classname="commitizen commit (unit)" name="replays the previous attempt from cache when retryLastCommit is set" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.008"/>
|
|
68
|
+
<testcase classname="git helpers log" name="passes stdout to the callback on success" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.008"/>
|
|
69
|
+
<testcase classname="git helpers log" name="throws when git errors" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.006"/>
|
|
70
|
+
<testcase classname="git helpers whatChanged" name="passes stdout to the callback on success" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.007"/>
|
|
71
|
+
<testcase classname="git helpers whatChanged" name="throws when git errors" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.004"/>
|
|
89
72
|
<testcase classname="git helpers commit (non-hook mode)" name="spawns "git commit -m <message>" plus any extra args" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.009"/>
|
|
90
|
-
<testcase classname="git helpers commit (non-hook mode)" name="inherits stdio when not quiet" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
73
|
+
<testcase classname="git helpers commit (non-hook mode)" name="inherits stdio when not quiet" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.008"/>
|
|
91
74
|
<testcase classname="git helpers commit (non-hook mode)" name="reports child-process errors through the callback" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.01"/>
|
|
92
|
-
<testcase classname="git helpers commit (non-hook mode)" name="only calls the callback once even if error fires repeatedly and exit follows" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
93
|
-
<testcase classname="git helpers commit (non-hook mode)" name="resolves with null on a zero exit code" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
75
|
+
<testcase classname="git helpers commit (non-hook mode)" name="only calls the callback once even if error fires repeatedly and exit follows" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.009"/>
|
|
76
|
+
<testcase classname="git helpers commit (non-hook mode)" name="resolves with null on a zero exit code" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.008"/>
|
|
94
77
|
<testcase classname="git helpers commit (non-hook mode)" name="warns about git config and errors on exit code 128" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.007"/>
|
|
95
78
|
<testcase classname="git helpers commit (non-hook mode)" name="errors (without the config warning) on a non-128 non-zero exit code" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.007"/>
|
|
96
|
-
<testcase classname="git helpers commit (--hook mode)" name="writes the message to <git-dir>/COMMIT_EDITMSG" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
97
|
-
<testcase classname="git helpers commit (--hook mode)" name="falls back to "r+" when the file cannot be opened for "w" (Windows hidden files)" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
98
|
-
<testcase classname="git helpers commit (--hook mode)" name="reports the error (and still closes the fd) when the write fails" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
99
|
-
<testcase classname="git helpers commit (--hook mode)" name="reports the error when even the "r+" fallback fails" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
100
|
-
<testcase classname="init" name="installs an adapter with --save-dev" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
101
|
-
<testcase classname="init" name="installs an adapter with --save" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
102
|
-
<testcase classname="init" name="errors on previously installed adapter" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
103
|
-
<testcase classname="init" name="succeeds if force is true" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="2.
|
|
104
|
-
<testcase classname="init" name="installs an adapter without --save-exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
105
|
-
<testcase classname="init" name="installs an adapter with --save-exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
106
|
-
<testcase classname="init" name="installs an commitizen with includeCommitizen" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="2.
|
|
107
|
-
<testcase classname="init alternative package managers: yarn" name="installs an adapter with yarn" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="3.
|
|
108
|
-
<testcase classname="init alternative package managers: yarn" name="installs an adapter with yarn --dev" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
109
|
-
<testcase classname="init alternative package managers: yarn" name="errors (with yarn) on previously installed adapter" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
110
|
-
<testcase classname="init alternative package managers: yarn" name="succeeds (with yarn) if force is true" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="3.
|
|
111
|
-
<testcase classname="init alternative package managers: yarn" name="installs (with yarn) an adapter without --save-exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
112
|
-
<testcase classname="init alternative package managers: yarn" name="installs an adapter with yarn --exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.
|
|
113
|
-
<testcase classname="init alternative package managers: pnpm" name="installs an adapter with pnpm" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
114
|
-
<testcase classname="init alternative package managers: pnpm" name="installs an adapter with pnpm --dev" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
115
|
-
<testcase classname="init alternative package managers: pnpm" name="errors (with pnpm) on previously installed adapter" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
116
|
-
<testcase classname="init alternative package managers: pnpm" name="succeeds (with pnpm) if force is true" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
117
|
-
<testcase classname="init alternative package managers: pnpm" name="installs (with pnpm) an adapter without --save-exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
118
|
-
<testcase classname="init alternative package managers: pnpm" name="installs an adapter with pnpm --exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
119
|
-
<testcase classname="commitizen init (unit)" name="throws when the repo path or adapter name is missing" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
120
|
-
<testcase classname="commitizen init (unit)" name="swallows and logs an install failure instead of throwing" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
121
|
-
<testcase classname="commitizen init (unit)" name="also installs commitizen when includeCommitizen is set" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
122
|
-
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="defaults to a dev install" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
123
|
-
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="--save installs to dependencies, not devDependencies" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
79
|
+
<testcase classname="git helpers commit (--hook mode)" name="writes the message to <git-dir>/COMMIT_EDITMSG" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.007"/>
|
|
80
|
+
<testcase classname="git helpers commit (--hook mode)" name="falls back to "r+" when the file cannot be opened for "w" (Windows hidden files)" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.01"/>
|
|
81
|
+
<testcase classname="git helpers commit (--hook mode)" name="reports the error (and still closes the fd) when the write fails" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.008"/>
|
|
82
|
+
<testcase classname="git helpers commit (--hook mode)" name="reports the error when even the "r+" fallback fails" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.006"/>
|
|
83
|
+
<testcase classname="init" name="installs an adapter with --save-dev" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.812"/>
|
|
84
|
+
<testcase classname="init" name="installs an adapter with --save" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.811"/>
|
|
85
|
+
<testcase classname="init" name="errors on previously installed adapter" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.843"/>
|
|
86
|
+
<testcase classname="init" name="succeeds if force is true" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="2.976"/>
|
|
87
|
+
<testcase classname="init" name="installs an adapter without --save-exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.844"/>
|
|
88
|
+
<testcase classname="init" name="installs an adapter with --save-exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.833"/>
|
|
89
|
+
<testcase classname="init" name="installs an commitizen with includeCommitizen" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="2.488"/>
|
|
90
|
+
<testcase classname="init alternative package managers: yarn" name="installs an adapter with yarn" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="3.148"/>
|
|
91
|
+
<testcase classname="init alternative package managers: yarn" name="installs an adapter with yarn --dev" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.495"/>
|
|
92
|
+
<testcase classname="init alternative package managers: yarn" name="errors (with yarn) on previously installed adapter" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.476"/>
|
|
93
|
+
<testcase classname="init alternative package managers: yarn" name="succeeds (with yarn) if force is true" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="3.13"/>
|
|
94
|
+
<testcase classname="init alternative package managers: yarn" name="installs (with yarn) an adapter without --save-exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.478"/>
|
|
95
|
+
<testcase classname="init alternative package managers: yarn" name="installs an adapter with yarn --exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="1.472"/>
|
|
96
|
+
<testcase classname="init alternative package managers: pnpm" name="installs an adapter with pnpm" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.315"/>
|
|
97
|
+
<testcase classname="init alternative package managers: pnpm" name="installs an adapter with pnpm --dev" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.132"/>
|
|
98
|
+
<testcase classname="init alternative package managers: pnpm" name="errors (with pnpm) on previously installed adapter" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.132"/>
|
|
99
|
+
<testcase classname="init alternative package managers: pnpm" name="succeeds (with pnpm) if force is true" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.332"/>
|
|
100
|
+
<testcase classname="init alternative package managers: pnpm" name="installs (with pnpm) an adapter without --save-exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.133"/>
|
|
101
|
+
<testcase classname="init alternative package managers: pnpm" name="installs an adapter with pnpm --exact" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.128"/>
|
|
102
|
+
<testcase classname="commitizen init (unit)" name="throws when the repo path or adapter name is missing" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.011"/>
|
|
103
|
+
<testcase classname="commitizen init (unit)" name="swallows and logs an install failure instead of throwing" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.018"/>
|
|
104
|
+
<testcase classname="commitizen init (unit)" name="also installs commitizen when includeCommitizen is set" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.012"/>
|
|
105
|
+
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="defaults to a dev install" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.009"/>
|
|
106
|
+
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="--save installs to dependencies, not devDependencies" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.009"/>
|
|
124
107
|
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="--save-dev --save-exact pins an exact dev install with npm" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.009"/>
|
|
125
|
-
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="--pnpm --save-dev --save-exact pins an exact dev install with pnpm" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
126
|
-
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="--yarn --dev --exact pins an exact dev install with yarn" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.
|
|
108
|
+
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="--pnpm --save-dev --save-exact pins an exact dev install with pnpm" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.009"/>
|
|
109
|
+
<testcase classname="commitizen init (unit) install command built from real CLI arguments" name="--yarn --dev --exact pins an exact dev install with yarn" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.01"/>
|
|
127
110
|
<testcase classname="parsers git-cz" name="should parse --message "Hello, World!"" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
128
111
|
<testcase classname="parsers git-cz" name="should parse --message="Hello, World!"" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
129
112
|
<testcase classname="parsers git-cz" name="should parse -amwip" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
130
113
|
<testcase classname="parsers git-cz" name="should parse -am=wip" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
131
|
-
<testcase classname="parsers git-cz" name="should parse -am wip" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
114
|
+
<testcase classname="parsers git-cz" name="should parse -am wip" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
132
115
|
<testcase classname="parsers git-cz" name="should parse -a -m wip -n" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
133
116
|
<testcase classname="parsers git-cz" name="should parse -a -m=wip -n" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
134
117
|
<testcase classname="parsers commitizen" name="should parse out the --amend option" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
135
118
|
<testcase classname="parsers commitizen" name="should parse out the --hook option" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
136
119
|
<testcase classname="parsers commitizen" name="should expose kebab-case init flags under the camelCase names init() reads" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
137
|
-
<testcase classname="
|
|
138
|
-
<testcase classname="
|
|
139
|
-
<testcase classname="
|
|
140
|
-
<testcase classname="
|
|
120
|
+
<testcase classname="adapter protocol getProtocolDeclaration" name="reads the declaration from the adapter package.json" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
121
|
+
<testcase classname="adapter protocol getProtocolDeclaration" name="returns undefined for a legacy adapter" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
122
|
+
<testcase classname="adapter protocol getProtocolDeclaration" name="returns undefined when there is no package.json" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
123
|
+
<testcase classname="adapter protocol getProtocolDeclaration" name="ignores a commitizenAdapter field that is not an object" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
124
|
+
<testcase classname="adapter protocol getProtocolDeclaration" name="throws for an invalid declaration" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
125
|
+
<testcase classname="adapter protocol getProtocolDeclaration" name="names the adapter by its directory when package.json has no name" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
126
|
+
<testcase classname="adapter protocol chooseProtocol" name="supports protocol 1" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
127
|
+
<testcase classname="adapter protocol chooseProtocol" name="picks the highest version both sides support" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
128
|
+
<testcase classname="adapter protocol chooseProtocol" name="throws when there is no shared version" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
129
|
+
<testcase classname="adapter protocol createProtocolPrompter" name="commits the message the adapter writes" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.467"/>
|
|
130
|
+
<testcase classname="adapter protocol createProtocolPrompter" name="passes the protocol version, git root and config, and cleans up" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.464"/>
|
|
131
|
+
<testcase classname="adapter protocol createProtocolPrompter" name="passes an empty config when there is none" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.461"/>
|
|
132
|
+
<testcase classname="adapter protocol createProtocolPrompter" name="commits nothing when the adapter writes no message" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.449"/>
|
|
133
|
+
<testcase classname="adapter protocol createProtocolPrompter" name="exits with the adapter exit status when it fails" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.46"/>
|
|
134
|
+
<testcase classname="adapter protocol createProtocolPrompter" name="exits with 1 when the adapter is killed by a signal" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
135
|
+
<testcase classname="adapter protocol createProtocolPrompter" name="reports an adapter that cannot be started, once" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
136
|
+
<testcase classname="adapter protocol createProtocolPrompter" name="throws for an adapter whose protocol commitizen does not support" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
137
|
+
<testcase classname="adapter protocol getPrompter" name="returns a protocol prompter for a protocol adapter" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.006"/>
|
|
138
|
+
<testcase classname="adapter protocol getPrompter" name="still loads legacy adapters with require()" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.006"/>
|
|
139
|
+
<testcase classname="adapter protocol committing through commitizen" name="makes a git commit with the adapter message" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.472"/>
|
|
140
|
+
<testcase classname="staging" name="should determine if a repo is clean" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.018"/>
|
|
141
|
+
<testcase classname="staging" name="should determine if --all flag adds files to staging area" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.01"/>
|
|
142
|
+
<testcase classname="common util" name="isFunction determines if a function is passed" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
141
143
|
<testcase classname="common util getParsedJsonFromFile" name="parses the JSON contents of a file" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
142
144
|
<testcase classname="common util getParsedJsonFromFile" name="logs and returns undefined when the file is missing" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
143
|
-
<testcase classname="common util getParsedJsonFromFile" name="logs and returns undefined when the file is not valid JSON" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
144
|
-
<testcase classname="common util getParsedJsonFromFile" name="getParsedPackageJsonFromPath reads package.json from a directory" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
145
|
+
<testcase classname="common util getParsedJsonFromFile" name="logs and returns undefined when the file is not valid JSON" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
146
|
+
<testcase classname="common util getParsedJsonFromFile" name="getParsedPackageJsonFromPath reads package.json from a directory" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
|
145
147
|
<testcase classname="common util directory finders" name="findPackageRoot returns the starting directory when it has a package.json" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
146
148
|
<testcase classname="common util directory finders" name="findPackageRoot walks up from a file to the nearest package.json" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
147
|
-
<testcase classname="common util directory finders" name="findPackageRoot throws when no package.json exists up to the filesystem root" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0
|
|
149
|
+
<testcase classname="common util directory finders" name="findPackageRoot throws when no package.json exists up to the filesystem root" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
148
150
|
<testcase classname="common util directory finders" name="findNearestNodeModules returns node_modules in the starting directory" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
149
151
|
<testcase classname="common util directory finders" name="findNearestNodeModules walks up and returns a path relative to the start" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0"/>
|
|
150
152
|
<testcase classname="common util directory finders" name="findNearestNodeModules defaults to the current working directory" file="/home/runner/work/cz-cli/cz-cli/test/tests/index.js" time="0.001"/>
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commitizen",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Git commit, but play nice with conventions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"packageManager": "pnpm@12.
|
|
6
|
+
"packageManager": "pnpm@12.26.0",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
|
|
9
9
|
"commit": "node bin/git-cz",
|
|
@@ -66,14 +66,13 @@
|
|
|
66
66
|
"yarn-cli": "npm:yarn@1.22.22"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
+
"@commitizen/config": "1.0.1",
|
|
69
70
|
"cachedir": "2.4.0",
|
|
70
71
|
"cz-conventional-changelog": "3.3.0",
|
|
71
72
|
"dedent": "1.7.2",
|
|
72
73
|
"detect-indent": "7.0.2",
|
|
73
|
-
"glob": "15.0.0",
|
|
74
74
|
"inquirer": "8.2.7",
|
|
75
|
-
"minimist": "1.2.8"
|
|
76
|
-
"strip-json-comments": "5.1.0"
|
|
75
|
+
"minimist": "1.2.8"
|
|
77
76
|
},
|
|
78
77
|
"nyc": {
|
|
79
78
|
"extends": "@istanbuljs/nyc-config-babel",
|
package/pnpm-workspace.yaml
CHANGED
|
@@ -5,3 +5,11 @@ allowBuilds:
|
|
|
5
5
|
# yarn 1's preinstall only checks for corepack; the test suite runs the
|
|
6
6
|
# pinned yarn from node_modules/.bin and does not need it.
|
|
7
7
|
yarn: false
|
|
8
|
+
|
|
9
|
+
# Packages the commitizen maintainers publish skip pnpm's minimumReleaseAge wait
|
|
10
|
+
# (one day by default). They are released through npm staged publishing, so a
|
|
11
|
+
# maintainer approves every version with 2FA before it can be installed.
|
|
12
|
+
minimumReleaseAgeExclude:
|
|
13
|
+
- commitizen
|
|
14
|
+
- cz-conventional-changelog
|
|
15
|
+
- '@commitizen/*'
|
package/renovate.json
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": [
|
|
3
3
|
"github>commitizen/commitizen-renovate-config"
|
|
4
|
+
],
|
|
5
|
+
"packageRules": [
|
|
6
|
+
{
|
|
7
|
+
"description": "Adapters receive commitizen's inquirer 8 instance and many rely on its API, so inquirer stays on major version 8.",
|
|
8
|
+
"matchPackageNames": [
|
|
9
|
+
"inquirer"
|
|
10
|
+
],
|
|
11
|
+
"matchUpdateTypes": [
|
|
12
|
+
"major"
|
|
13
|
+
],
|
|
14
|
+
"enabled": false
|
|
15
|
+
}
|
|
4
16
|
]
|
|
5
17
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
8
|
-
var _glob = require("glob");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
var _default = exports.default = findup; // Before, "findup-sync" package was used,
|
|
11
|
-
// but it does not provide filter callback
|
|
12
|
-
function findup(patterns, options, fn) {
|
|
13
|
-
/* jshint -W083 */
|
|
14
|
-
|
|
15
|
-
var lastpath;
|
|
16
|
-
var file;
|
|
17
|
-
options = Object.create(options);
|
|
18
|
-
options.maxDepth = 1;
|
|
19
|
-
options.cwd = _nodePath.default.resolve(options.cwd);
|
|
20
|
-
do {
|
|
21
|
-
file = patterns.filter(function (pattern) {
|
|
22
|
-
var configPath = (0, _glob.globSync)(pattern, options)[0];
|
|
23
|
-
if (configPath) {
|
|
24
|
-
return fn(_nodePath.default.join(options.cwd, configPath));
|
|
25
|
-
}
|
|
26
|
-
})[0];
|
|
27
|
-
if (file) {
|
|
28
|
-
return _nodePath.default.join(options.cwd, file);
|
|
29
|
-
}
|
|
30
|
-
lastpath = options.cwd;
|
|
31
|
-
options.cwd = _nodePath.default.resolve(options.cwd, '..');
|
|
32
|
-
} while (options.cwd !== lastpath);
|
|
33
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
8
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
9
|
-
var _stripJsonComments = _interopRequireDefault(require("strip-json-comments"));
|
|
10
|
-
var _nodeBuffer = require("node:buffer");
|
|
11
|
-
var _configLoader = require("../configLoader");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
var _default = exports.default = getConfigContent;
|
|
14
|
-
/**
|
|
15
|
-
* Read the content of a configuration file
|
|
16
|
-
* - if not js or json: strip any comments
|
|
17
|
-
* - if js or json: require it
|
|
18
|
-
* @param {String} configPath - full path to configuration file
|
|
19
|
-
* @return {Object}
|
|
20
|
-
*/
|
|
21
|
-
function readConfigContent(configPath) {
|
|
22
|
-
const parsedPath = _nodePath.default.parse(configPath);
|
|
23
|
-
const isRcFile = parsedPath.ext !== '.js' && parsedPath.ext !== '.json';
|
|
24
|
-
const jsonString = readConfigFileContent(configPath);
|
|
25
|
-
const parse = isRcFile ? contents => JSON.parse((0, _stripJsonComments.default)(contents)) : contents => JSON.parse(contents);
|
|
26
|
-
try {
|
|
27
|
-
const parsed = parse(jsonString);
|
|
28
|
-
Object.defineProperty(parsed, 'configPath', {
|
|
29
|
-
value: configPath
|
|
30
|
-
});
|
|
31
|
-
return parsed;
|
|
32
|
-
} catch (error) {
|
|
33
|
-
error.message = [`Parsing JSON at ${configPath} for commitizen config failed:`, error.mesasge].join('\n');
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get content of the configuration file
|
|
40
|
-
* @param {String} configPath - partial path to configuration file
|
|
41
|
-
* @param {String} directory - directory path which will be joined with config argument
|
|
42
|
-
* @return {Object}
|
|
43
|
-
*/
|
|
44
|
-
function getConfigContent(configPath, baseDirectory) {
|
|
45
|
-
if (!configPath) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const resolvedPath = _nodePath.default.resolve(baseDirectory, configPath);
|
|
49
|
-
const configBasename = _nodePath.default.basename(resolvedPath);
|
|
50
|
-
if (!_nodeFs.default.existsSync(resolvedPath)) {
|
|
51
|
-
return (0, _configLoader.getNormalizedConfig)(resolvedPath);
|
|
52
|
-
}
|
|
53
|
-
const content = readConfigContent(resolvedPath);
|
|
54
|
-
return (0, _configLoader.getNormalizedConfig)(configBasename, content);
|
|
55
|
-
}
|
|
56
|
-
;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Read proper content from config file.
|
|
60
|
-
* If the chartset of the config file is not utf-8, one error will be thrown.
|
|
61
|
-
* @param {String} configPath
|
|
62
|
-
* @return {String}
|
|
63
|
-
*/
|
|
64
|
-
function readConfigFileContent(configPath) {
|
|
65
|
-
let rawBufContent = _nodeFs.default.readFileSync(configPath);
|
|
66
|
-
if (!(0, _nodeBuffer.isUtf8)(rawBufContent)) {
|
|
67
|
-
throw new Error(`The config file at "${configPath}" contains invalid charset, expect utf8`);
|
|
68
|
-
}
|
|
69
|
-
const content = rawBufContent.toString("utf8");
|
|
70
|
-
// Strip a UTF-8 byte order mark, if present.
|
|
71
|
-
return content.charCodeAt(0) === 0xFEFF ? content.slice(1) : content;
|
|
72
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = exports.default = getNormalizedConfig; // Given a config and content, plucks the actual
|
|
8
|
-
// settings that we're interested in
|
|
9
|
-
function getNormalizedConfig(config, content) {
|
|
10
|
-
if (content && config === 'package.json') {
|
|
11
|
-
// PACKAGE.JSON
|
|
12
|
-
|
|
13
|
-
// Use the npm config key, be good citizens
|
|
14
|
-
if (content.config && content.config.commitizen) {
|
|
15
|
-
return content.config.commitizen;
|
|
16
|
-
} else if (content.czConfig) {
|
|
17
|
-
// Old method, will be deprecated in 3.0.0
|
|
18
|
-
|
|
19
|
-
// Suppress during test
|
|
20
|
-
/* istanbul ignore if */
|
|
21
|
-
if (typeof global.it !== 'function') {
|
|
22
|
-
console.error("\n********\nWARNING: This repository's package.json is using czConfig. czConfig will be deprecated in Commitizen 3. \nPlease use this instead:\n{\n \"config\": {\n \"commitizen\": {\n \"path\": \"./path/to/adapter\"\n }\n }\n}\nFor more information, see: http://commitizen.github.io/cz-cli/\n********\n");
|
|
23
|
-
}
|
|
24
|
-
return content.czConfig;
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
// .cz.json or .czrc
|
|
28
|
-
return content;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
8
|
-
var _configLoader = require("../configLoader");
|
|
9
|
-
var _util = require("../common/util.js");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
var _default = exports.default = loader;
|
|
12
|
-
/**
|
|
13
|
-
* Command line config helpers
|
|
14
|
-
* Shamelessly ripped from with slight modifications:
|
|
15
|
-
* https://github.com/jscs-dev/node-jscs/blob/master/lib/cli-config.js
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Get content of the configuration file
|
|
19
|
-
* @param {String} config - partial path to configuration file
|
|
20
|
-
* @param {String} [cwd = process.cwd()] - directory path which will be joined with config argument
|
|
21
|
-
* @return {Object|undefined}
|
|
22
|
-
*/
|
|
23
|
-
function loader(configs, config, cwd) {
|
|
24
|
-
var content;
|
|
25
|
-
var directory = cwd || process.cwd();
|
|
26
|
-
|
|
27
|
-
// If config option is given, attempt to load it
|
|
28
|
-
if (config) {
|
|
29
|
-
return (0, _configLoader.getContent)(config, directory);
|
|
30
|
-
}
|
|
31
|
-
content = (0, _configLoader.getContent)((0, _configLoader.findup)(configs, {
|
|
32
|
-
nocase: true,
|
|
33
|
-
cwd: directory
|
|
34
|
-
}, function (configPath) {
|
|
35
|
-
if (_nodePath.default.basename(configPath) === 'package.json') {
|
|
36
|
-
// return !!this.getContent(configPath);
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}));
|
|
40
|
-
if (content) {
|
|
41
|
-
return content;
|
|
42
|
-
}
|
|
43
|
-
/* istanbul ignore if */
|
|
44
|
-
if (!(0, _util.isInTest)()) {
|
|
45
|
-
// Try to load standard configs from home dir
|
|
46
|
-
var directoryArr = [process.env.USERPROFILE, process.env.HOMEPATH, process.env.HOME];
|
|
47
|
-
for (var i = 0, dirLen = directoryArr.length; i < dirLen; i++) {
|
|
48
|
-
if (!directoryArr[i]) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
for (var j = 0, len = configs.length; j < len; j++) {
|
|
52
|
-
content = (0, _configLoader.getContent)(configs[j], directoryArr[i]);
|
|
53
|
-
if (content) {
|
|
54
|
-
return content;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
package/dist/configLoader.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "findup", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _findup.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getContent", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _getContent.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "getNormalizedConfig", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _getNormalizedConfig.default;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "loader", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _loader.default;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
var _findup = _interopRequireDefault(require("./configLoader/findup"));
|
|
31
|
-
var _getContent = _interopRequireDefault(require("./configLoader/getContent"));
|
|
32
|
-
var _getNormalizedConfig = _interopRequireDefault(require("./configLoader/getNormalizedConfig"));
|
|
33
|
-
var _loader = _interopRequireDefault(require("./configLoader/loader"));
|
|
34
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|