Skip to content

Commit

Permalink
Fixed templating and some linting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed May 22, 2023
1 parent c901483 commit 1b98b8e
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"contributorsSortAlphabetically": true,
"files": ["README.md"],
"imageSize": 100,
"projectName": "template-typescript-node-package",
"projectName": "console-fail-test",
"projectOwner": "JoshuaKGoldberg",
"repoHost": "https://github.com",
"repoType": "github"
Expand Down
3 changes: 0 additions & 3 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ Add the `--coverage` flag to compute test coverage and place reports in the `cov
pnpm run test --coverage
```

Note that [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test) is enabled for all test runs.
Calls to `console.log`, `console.warn`, and other console methods will cause a test to fail.

### Debugging Tests

This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging unit tests.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/01-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
required: true
- label: I have pulled the latest `main` branch of the repository.
required: true
- label: I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.
- label: I have [searched for related issues](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aissue) and found none that matched my issue.
required: true
type: checkboxes
- attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/02-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ body:
options:
- label: I have pulled the latest `main` branch of the repository.
required: true
- label: I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.
- label: I have [searched for related issues](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aissue) and found none that matched my issue.
required: true
type: checkboxes
- attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/03-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
required: true
- label: I have pulled the latest `main` branch of the repository.
required: true
- label: I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.
- label: I have [searched for related issues](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aissue) and found none that matched my issue.
required: true
type: checkboxes
- attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/04-tooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
required: true
- label: I have pulled the latest `main` branch of the repository.
required: true
- label: I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.
- label: I have [searched for related issues](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aissue) and found none that matched my issue.
required: true
type: checkboxes
- attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
The release is available on:
* [GitHub releases](https://github.com/JoshuaKGoldberg/template-typescript-node-package/releases/tag/{release_tag})
* [npm package (@latest dist-tag)](https://www.npmjs.com/package/template-typescript-node-package/v/${{ env.npm_version }})
* [GitHub releases](https://github.com/JoshuaKGoldberg/console-fail-test/releases/tag/{release_tag})
* [npm package (@latest dist-tag)](https://www.npmjs.com/package/console-fail-test/v/${{ env.npm_version }})
Cheers! 📦🚀
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
script: |
try {
await github.request(
`DELETE /repos/JoshuaKGoldberg/template-typescript-node-package/branches/main/protection`,
`DELETE /repos/JoshuaKGoldberg/console-fail-test/branches/main/protection`,
);
} catch (error) {
if (!error.message?.includes?.("Branch not protected")) {
Expand All @@ -44,7 +44,7 @@ jobs:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
github.request(
`PUT /repos/JoshuaKGoldberg/template-typescript-node-package/branches/main/protection`,
`PUT /repos/JoshuaKGoldberg/console-fail-test/branches/main/protection`,
{
allow_deletions: false,
allow_force_pushes: true,
Expand All @@ -54,7 +54,7 @@ jobs:
branch: "main",
enforce_admins: false,
owner: "JoshuaKGoldberg",
repo: "template-typescript-node-package",
repo: "console-fail-test",
required_conversation_resolution: true,
required_linear_history: false,
required_pull_request_reviews: null,
Expand Down
76 changes: 0 additions & 76 deletions CODE_OF_CONDUCT.md

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ require("console-fail-test").cft({

## Ignoring `console` methods

By default, `console-fail-test` will error on _any_ called `console` method. If you'd like allow certain methods, pass a `console` object to the `cft` API when you set it up:
By default, `console-fail-test` will error on _any_ called `console` method.
If you'd like allow certain methods, pass a `console` object to the `cft` API when you set it up:

```js
require("console-fail-test").cft({
Expand Down Expand Up @@ -384,4 +385,4 @@ See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
<!-- ALL-CONTRIBUTORS-LIST:END -->
<!-- spellchecker: enable -->

> 💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [template-typescript-node-package](https://github.com/JoshuaKGoldberg/template-typescript-node-package).`,
> 💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [template-typescript-node-package](https://github.com/JoshuaKGoldberg/template-typescript-node-package).,
3 changes: 2 additions & 1 deletion docs/Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ The `TestFramework` object potentially returned by a test framework selector inc
The `SpyFactorySelector` function potentially returned by a test framework selector will be used by [`cft.ts`](../src/cft.ts) to create method spies on the console.
It receives as parameters:

1. `container`: An object whose method is to be spied on. This will practically always be `console`.
1. `container`: An object whose method is to be spied on.
This will practically always be `console`.
- Note that in future versions of console-fail-test, this may expand to include other objects.
2. `methodName`: The key of the method to spy on, such as `"log"`.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "console-fail-test",
"version": "0.3.0",
"description": "Gently fails test runs if the console was used during them.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -40,7 +41,6 @@
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"@vitest/coverage-istanbul": "^0.31.1",
"console-fail-test": "^0.2.3",
"cspell": "^6.31.1",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
Expand Down
13 changes: 3 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/environments/testEnvironmentTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type TestFrameworkSelector = (
request: CftRequest
) => TestFramework | undefined;

export interface TestFramework {
interface TestFramework {
/**
* Adds a callback to be called after each test.
* @param callback - Called after each test.
Expand All @@ -27,11 +27,11 @@ export interface TestFramework {
mapSpyCalls?: (call: SpyCallsAndName) => SpyCallArgs[];
}

export interface TestAfterHooks {
interface TestAfterHooks {
reportComplaint?: (complaint: TestComplaint) => void;
}

export interface SpyCallsAndName {
interface SpyCallsAndName {
methodCalls: SpyCallArgs[];
methodName: string;
}
Expand Down
1 change: 0 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ export default defineConfig({
reporter: ["html", "lcov"],
},
exclude: ["lib", "node_modules"],
setupFiles: ["console-fail-test/setup"],
},
});

0 comments on commit 1b98b8e

Please sign in to comment.