Skip to content

Commit 9cbecea

Browse files
chore: add console-fail-test to tests (JoshuaKGoldberg#386)
## PR Checklist - [x] Addresses an existing open issue: fixes JoshuaKGoldberg#306 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Brings in [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test) and mentions it alongside other testing docs. Refactors `greet` just a bit to rebind `console.log` each time the function is called. That way it doesn't mess with `console.log` before console-fail-test does.
1 parent 81950a7 commit 9cbecea

File tree

7 files changed

+97
-91
lines changed

7 files changed

+97
-91
lines changed

.github/DEVELOPMENT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ Add the `--coverage` flag to compute test coverage and place reports in the `cov
5858
```shell
5959
pnpm run test --coverage
6060
```
61+
62+
Note that [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test) is enabled for all test runs.
63+
Calls to `console.log`, `console.warn`, and other console methods will cause a test to fail.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ It sets up the following tooling for you:
4141
- [**release-it**](https://github.com/release-it/release-it): Generates changelogs, bumps the package version, and publishes to GitHub and npm based on [conventional commits](https://www.conventionalcommits.org).
4242
- [**Renovate**](https://docs.renovatebot.com): Keeps dependencies up-to-date with PRs, configured to wait a few days after each update for safety.
4343
- [**TypeScript**](https://typescriptlang.org): A typed superset of JavaScript, configured with strict compiler options.
44-
- [**Vitest**](https://vitest.dev): Fast unit tests, configured with coverage tracking.
44+
- [**Vitest**](https://vitest.dev): Fast unit tests, configured with coverage tracking and [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test).
4545

4646
## Setup
4747

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@vitest/coverage-istanbul": "^0.30.0",
4444
"all-contributors-cli": "^6.24.0",
4545
"chalk": "^5.2.0",
46+
"console-fail-test": "^0.2.0",
4647
"cspell": "^6.19.2",
4748
"eslint": "^8.32.0",
4849
"eslint-config-prettier": "^8.6.0",

0 commit comments

Comments
 (0)