Skip to content

Commit

Permalink
feat(doc): #1092 test pr
Browse files Browse the repository at this point in the history
- Improve test pr documentation

Signed-off-by: Daniel Salazar <podany270895@gmail.com>
  • Loading branch information
dsalaza4 committed May 24, 2023
1 parent b643ebd commit addbda5
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion docs/src/api/builtins/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using [Danger.js](https://danger.systems/js/guides/getting_started.html).
For more information
on how to use Danger.js,
please refer to its
[Gettings started guide](https://danger.systems/js/guides/getting_started.html).
[Getting started guide](https://danger.systems/js/guides/getting_started.html).

Types:

Expand All @@ -33,6 +33,10 @@ Example:
=== "makes.nix"

```nix
{
projectPath,
...
}:
{
testPullRequest = {
modules = {
Expand All @@ -58,6 +62,27 @@ Example:
$ m . /testPullRequest/github
```

=== "/dangerfiles/github.ts"

```typescript
import { argv } from "node:process";

import { danger, fail, warn } from "danger";

const nCommits = danger.git.commits.length;
const strict = argv[6] === "strict";

if (nCommits > 1) {
msg = ["Only one commit per PR:\n", `Commits: ${nCommits}`].join("\n")
if (strict) {
fail(msg);
}
else {
warn(msg);
}
}
```


## testPython

Expand Down

0 comments on commit addbda5

Please sign in to comment.