Skip to content

new refactor assertions documentation for clarity#353

Open
Kah2412 wants to merge 4 commits intoaskimed:mainfrom
Kah2412:patch-2
Open

new refactor assertions documentation for clarity#353
Kah2412 wants to merge 4 commits intoaskimed:mainfrom
Kah2412:patch-2

Conversation

@Kah2412
Copy link
Copy Markdown

@Kah2412 Kah2412 commented Mar 12, 2026

I'll update the Canvas document to include this formal explanation at the beginning, which helps contextualize the review.

I've added the "Rationale for Documentation Updates" section to the top of the Canvas document. You can copy the text from that section and paste it directly into the GitHub comment for the reviewer!

Updated formatting and structure of the assertions documentation for clarity and consistency. Added sections for JSON, YAML, and GZip file comparisons.
Copy link
Copy Markdown
Collaborator

@nvnieuwk nvnieuwk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi could you please add some of the layout back to the document? I saw you removed all the headers and code blocks from the file 😁

Updated the documentation for file assertions in nf-test, improving clarity and consistency across sections.
@nvnieuwk
Copy link
Copy Markdown
Collaborator

I don't think this will work on the website. The website is built using mkdocs please take a look at the website to see what syntax is supported and which syntax isn't

Kah2412 added 2 commits April 8, 2026 21:59
Updated documentation for file assertions in nf-test, including md5, JSON, YAML, GZip, and line filtering features.
Updated examples and formatting for JSON and YAML assertions in the documentation.
Comment on lines +11 to +13
```groovy
assert path(process.out.out_ch.get(0)).md5 == "64debea5017a035ddc67c0b51fa84b16"
```
Note that for gzip compressed files, the `md5` property is calculated after gunzipping the file contents, whereas for other filetypes the `md5` property is directly
calculated on the file itself.

## JSON Files
nf-test supports comparison of JSON files and keys within JSON files.
To assert that two JSON files contain the same keys and values:
```Groovy
assert path(process.out.out_ch.get(0)).json == path('./some.json').json
```
Individual keys can also be asserted:

```Groovy
assert path(process.out.out_ch.get(0)).json.key == "value"
```

## YAML Files
nf-test supports comparison of YAML files and keys within YAML files.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This codeblock isn't closed. You can check your changes locally by running mkdocs serve if you installed mkdocs :)


To assert that two JSON files are identical:

assert path(process.out.out_ch.get(0)).json == path('./expected_output.json').json
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a codeblock

Comment on lines +27 to +31
{ "tool": "nf-test", "version": "1.0" }
// Use dot notation to access the value of a specific field by name
assert path(process.out.out_ch.get(0)).json.tool == "nf-test"
assert path(process.out.out_ch.get(0)).json.version == "1.0"
YAML Files
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this coming from? 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants