Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina committed Jan 31, 2024
1 parent 815bc98 commit 787a677
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 14 deletions.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,70 @@ Note the use of `incremental: true`, which speed up compilation massively.
* `--ignore` or `-i`, ignore a glob pattern, and not look for tests there
* `--expose-gc`, exposes the gc() function to tests
* `--pattern` or `-p`, run tests matching the given glob pattern
* `--reporter` or `-r`, set up a reporter, use a colon to set a file destination. Default: `spec`.

## Reporters

Here are the available reporters:

* `md`: creates a markdown table, useful for setting up a Summary in your GitHub Action
* `gh`: emits `::error` workflow commands for GitHub Actions to show inlined error. Enabled by default when running on GHA.
* `tap`: outputs the test results in the TAP format.
* `spec`: outputs the test results in a human-readable format.
* `dot`: outputs the test results in a compact format, where each passing test is represented by a ., and each failing test is represented by a X.
* `junit`: outputs test results in a jUnit XML format

## GitHub Action Summary

The following will automatically show the summary of the test run in the summary page of GitHub Actions.

```yaml
name: ci

on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'

jobs:
test:
runs-on: ${{matrix.os}}

strategy:
matrix:
node-version: [18.x, 20.x, 21.x]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install
run: |
npm install
- name: Lint
run: |
npm run lint
- name: Run tests
run: |
npm run unit -- --reporter spec --reporter md:report.md
- name: Upload report
shell: bash
if: success() || failure()
run: |
cat report.md >> "$GITHUB_STEP_SUMMARY"
```

## License

Expand Down
5 changes: 1 addition & 4 deletions borp.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ const args = parseArgs({
reporter: {
type: 'string',
short: 'r',
default: [
/* c8 ignore next 1 */
process.stdout.isTTY ? 'spec' : 'tap'
],
default: ['spec'],
multiple: true
}
},
Expand Down
10 changes: 0 additions & 10 deletions test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ test('ts-esm', async (t) => {
names.delete(test.name)
})

stream.on('data', (test) => {
console.log(JSON.stringify(test))
})

await completed
})

Expand Down Expand Up @@ -190,9 +186,3 @@ test('js-esm', async (t) => {

await completed
})

test('this fails on windows', async (t) => {
if (process.platform === 'win32') {
throw new Error('windows')
}
})

0 comments on commit 787a677

Please sign in to comment.