Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit addbda5

Browse files
committed
feat(doc): #1092 test pr
- Improve test pr documentation Signed-off-by: Daniel Salazar <podany270895@gmail.com>
1 parent b643ebd commit addbda5

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

docs/src/api/builtins/test.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using [Danger.js](https://danger.systems/js/guides/getting_started.html).
77
For more information
88
on how to use Danger.js,
99
please refer to its
10-
[Gettings started guide](https://danger.systems/js/guides/getting_started.html).
10+
[Getting started guide](https://danger.systems/js/guides/getting_started.html).
1111

1212
Types:
1313

@@ -33,6 +33,10 @@ Example:
3333
=== "makes.nix"
3434

3535
```nix
36+
{
37+
projectPath,
38+
...
39+
}:
3640
{
3741
testPullRequest = {
3842
modules = {
@@ -58,6 +62,27 @@ Example:
5862
$ m . /testPullRequest/github
5963
```
6064

65+
=== "/dangerfiles/github.ts"
66+
67+
```typescript
68+
import { argv } from "node:process";
69+
70+
import { danger, fail, warn } from "danger";
71+
72+
const nCommits = danger.git.commits.length;
73+
const strict = argv[6] === "strict";
74+
75+
if (nCommits > 1) {
76+
msg = ["Only one commit per PR:\n", `Commits: ${nCommits}`].join("\n")
77+
if (strict) {
78+
fail(msg);
79+
}
80+
else {
81+
warn(msg);
82+
}
83+
}
84+
```
85+
6186

6287
## testPython
6388

0 commit comments

Comments
 (0)