Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: JoshuaKGoldberg/console-fail-test
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 398a1b3b135127e7469196a788322a24ab984baf
Choose a base ref
...
head repository: JoshuaKGoldberg/console-fail-test
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.4.0
Choose a head ref
Loading
Showing with 8,877 additions and 4,057 deletions.
  1. +51 −0 .all-contributorsrc
  2. +0 −26 .eslintrc.js
  3. +62 −13 .github/CONTRIBUTING.md
  4. +97 −0 .github/DEVELOPMENT.md
  5. +7 −7 .github/ISSUE_TEMPLATE/{01-bug.yaml → 01-bug.yml}
  6. +7 −7 .github/ISSUE_TEMPLATE/{02-documentation.yaml → 02-documentation.yml}
  7. +7 −9 .github/ISSUE_TEMPLATE/{03-feature.yaml → 03-feature.yml}
  8. +7 −7 .github/ISSUE_TEMPLATE/{04-tooling.yaml → 04-tooling.yml}
  9. +1 −1 .github/PULL_REQUEST_TEMPLATE.md
  10. +9 −0 .github/SECURITY.md
  11. +10 −7 .github/actions/prepare/action.yml
  12. +12 −12 .github/dependabot.yml
  13. +10 −0 .github/renovate.json
  14. +26 −0 .github/workflows/accessibility-alt-text-bot.yml
  15. +16 −0 .github/workflows/build.yml
  16. +28 −0 .github/workflows/compliance.yml
  17. +18 −0 .github/workflows/contributors.yml
  18. +10 −10 .github/workflows/{spelling.yml → lint-knip.yml}
  19. +9 −9 .github/workflows/{markdown.yml → lint-markdown.yml}
  20. +10 −10 .github/workflows/{format.yml → lint-packages.yml}
  21. +15 −0 .github/workflows/lint-spelling.yml
  22. +16 −0 .github/workflows/lint.yml
  23. +27 −0 .github/workflows/post-release.yml
  24. +21 −0 .github/workflows/pr-review-requested.yml
  25. +15 −0 .github/workflows/prettier.yml
  26. +0 −18 .github/workflows/publish.yml
  27. +0 −18 .github/workflows/pull_request_title.yml
  28. +28 −0 .github/workflows/release.yml
  29. +11 −9 .github/workflows/test.yml
  30. +10 −10 .github/workflows/{compile.yml → tsc.yml}
  31. +2 −4 .gitignore
  32. +1 −0 .husky/.gitignore
  33. +3 −4 .husky/pre-commit
  34. +3 −5 .markdownlint.json
  35. +3 −0 .markdownlintignore
  36. +0 −2 .npmignore
  37. +1 −0 .nvmrc
  38. +5 −0 .prettierignore
  39. +9 −0 .prettierrc
  40. +8 −3 .prettierrc.json
  41. +18 −0 .release-it.json
  42. +6 −1 .vscode/extensions.json
  43. +14 −14 .vscode/launch.json
  44. +17 −7 .vscode/settings.json
  45. +11 −0 .vscode/tasks.json
  46. +12 −0 CHANGELOG.md
  47. +0 −76 CODE_OF_CONDUCT.md
  48. +16 −15 LICENSE.md
  49. +83 −15 README.md
  50. +27 −3 cspell.json
  51. +1 −1 docs/Ava.md
  52. +2 −1 docs/Development.md
  53. +3 −4 docs/Jasmine.md
  54. +4 −4 docs/Jest.md
  55. +5 −3 docs/Lab.md
  56. +1 −1 docs/NodeTap.md
  57. +1 −1 docs/Sinon.md
  58. +12 −2 docs/Vitest.md
  59. +151 −0 eslint.config.js
  60. +6 −0 knip.json
  61. +6 −0 knip.jsonc
  62. +89 −49 package.json
  63. +7,109 −0 pnpm-lock.yaml
  64. +1 −1 setup.js
  65. +50 −44 src/cft.ts
  66. +20 −18 src/complaining/createComplaint.ts
  67. +20 −19 src/complaining/formatComplaintCall.test.ts
  68. +7 −7 src/complaining/formatComplaintCall.ts
  69. +17 −12 src/complaining/formatMethodComplaint.ts
  70. +2 −3 src/complaining/index.ts
  71. +9 −7 src/console.ts
  72. +3 −3 src/defaults.ts
  73. +35 −33 src/environments/ava.ts
  74. +26 −26 src/environments/jasmine.ts
  75. +24 −24 src/environments/jest.ts
  76. +33 −31 src/environments/lab.ts
  77. +50 −48 src/environments/mocha.ts
  78. +49 −46 src/environments/nodeTap.ts
  79. +54 −50 src/environments/selectTestFramework.ts
  80. +27 −29 src/environments/testEnvironmentTypes.ts
  81. +28 −28 src/environments/vitest.ts
  82. +1 −1 src/index.ts
  83. +16 −15 src/spies/fallback.ts
  84. +32 −31 src/spies/jasmine.ts
  85. +31 −28 src/spies/jest.ts
  86. +46 −45 src/spies/selectSpyFactory.ts
  87. +38 −32 src/spies/sinon.ts
  88. +9 −10 src/spies/spyTypes.ts
  89. +32 −29 src/spies/vitest.ts
  90. +11 −6 src/types.ts
  91. +1 −0 tsconfig.eslint.json
  92. +15 −9 tsconfig.json
  93. +11 −0 tsup.config.ts
  94. +10 −4 vitest.config.ts
  95. +0 −3,030 yarn.lock
51 changes: 51 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"badgeTemplate": "<img alt=\"All Contributors: <%= contributors.length %> 👪\" src=\"https://img.shields.io/badge/all_contributors-<%= contributors.length %>_👪-21bb42.svg\" />",
"commit": false,
"commitConvention": "angular",
"contributors": [
{
"avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4",
"contributions": ["tool", "code", "maintenance", "infra", "ideas"],
"login": "JoshuaKGoldberg",
"name": "Josh Goldberg",
"profile": "http://www.joshuakgoldberg.com"
},
{
"login": "kopax-polyconseil",
"name": "Dimitri Kopriwa",
"avatar_url": "https://avatars.githubusercontent.com/u/77674046?v=4",
"profile": "https://www.kop.ax/",
"contributions": ["code"]
},
{
"login": "mackenco",
"name": "Colin MacKenzie",
"avatar_url": "https://avatars.githubusercontent.com/u/4284340?v=4",
"profile": "https://github.com/mackenco",
"contributions": ["code", "ideas"]
},
{
"login": "sosukesuzuki",
"name": "SUZUKI Sosuke",
"avatar_url": "https://avatars.githubusercontent.com/u/14838850?v=4",
"profile": "https://github.com/sosukesuzuki",
"contributions": ["code"]
},
{
"login": "joel-daros",
"name": "Joel",
"avatar_url": "https://avatars.githubusercontent.com/u/992049?v=4",
"profile": "https://www.linkedin.com/in/joel-darós-95536a21/?locale=en_US",
"contributions": ["ideas"]
}
],
"contributorsPerLine": 7,
"contributorsSortAlphabetically": true,
"files": ["README.md"],
"imageSize": 100,
"projectName": "console-fail-test",
"projectOwner": "JoshuaKGoldberg",
"repoHost": "https://github.com",
"repoType": "github",
"commitType": "docs"
}
26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

75 changes: 62 additions & 13 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -2,22 +2,15 @@

Thanks for your interest in contributing to `console-fail-test`! 💖

> After this page, see [DEVELOPMENT.md](./DEVELOPMENT.md) for local development instructions.
## Code of Conduct

This project contains a [Contributor Covenant code of conduct](./CODE_OF_CONDUCT.md) all contributors are expected to follow.

## Getting Started

```shell
git clone https://github.com/your-username/console-fail-test
cd console-fail-test
yarn
```

## Reporting Issues

Please do [report an issue on the issue tracker](https://github.com/JoshuaKGoldberg/console-fail-test/issues/new/choose) if there's any bugfix, documentation improvement, or general enhancement you'd like to see in the repository!
Please fully fill out all required fields in the most appropriate issue form.
Please do [report an issue on the issue tracker](https://github.com/JoshuaKGoldberg/console-fail-test/issues/new/choose) if there's any bugfix, documentation improvement, or general enhancement you'd like to see in the repository! Please fully fill out all required fields in the most appropriate issue form.

## Sending Contributions

@@ -29,20 +22,76 @@ There are two steps involved:

### Finding an Issue

With the exception of very small typos, all changes to this repository generally need to correspond to an [open issue marked as `accepting prs` on the issue tracker](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aopen+is%3Aissue+label%3A%22accepting+prs%22).
If this is your first time contributing, consider searching for [issues that also have the `good first issue` label](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aopen+is%3Aissue+label%3A%22accepting+prs%22+label%3A%22good+first+issue%22).
With the exception of very small typos, all changes to this repository generally need to correspond to an [unassigned open issue marked as `status: accepting prs` on the issue tracker](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aissue+is%3Aopen+label%3A%22status%3A+accepting+prs%22+no%3Aassignee+).
If this is your first time contributing, consider searching for [unassigned issues that also have the `good first issue` label](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3A%22status%3A+accepting+prs%22+no%3Aassignee+).
If the issue you'd like to fix isn't found on the issue, see [Reporting Issues](#reporting-issues) for filing your own (please do!).

#### Issue Claiming

We don't use any kind of issue claiming system.
We've found in the past that they result in accidental ["licked cookie"](https://devblogs.microsoft.com/oldnewthing/20091201-00/?p=15843) situations where contributors claim an issue but run out of time or energy trying before sending a PR.

If an unassigned issue has been marked as `status: accepting prs` and an open PR does not exist, feel free to send a PR.
Please don't post comments asking for permission or stating you will work on an issue.

### Sending a Pull Request

Once you've identified an open issue accepting PRs that doesn't yet have a PR sent, you're free to send a pull request.
Be sure to fill out the pull request template's requested information -- otherwise your PR will likely be closed.

PRs are also expected to have a title that adheres to [commitlint](https://github.com/conventional-changelog/commitlint).
PRs are also expected to have a title that adheres to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0).
Only PR titles need to be in that format, not individual commits.
Don't worry if you get this wrong: you can always change the PR title after sending it.
Check [previously merged PRs](https://github.com/JoshuaKGoldberg/console-fail-test/pulls?q=is%3Apr+is%3Amerged+-label%3Adependencies+) for reference.

#### Draft PRs

If you don't think your PR is ready for review, [set it as a draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft).
Draft PRs won't be reviewed.

#### Granular PRs

Please keep pull requests single-purpose: in other words, don't attempt to solve multiple unrelated problems in one pull request.
Send one PR per area of concern.
Multi-purpose pull requests are harder and slower to review, block all changes from being merged until the whole pull request is reviewed, and are difficult to name well with semantic PR titles.

#### Pull Request Reviews

When a PR is not in draft, it's considered ready for review.
Please don't manually `@` tag anybody to request review.
A maintainer will look at it when they're next able to.

PRs should have passing [GitHub status checks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks) before review is requested (unless there are explicit questions asked in the PR about any failures).

#### Asking Questions

If you need help and/or have a question, posting a comment in the PR is a great way to do so.
There's no need to tag anybody individually.
One of us will drop by and help when we can.

Please post comments as [line comments](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request) when possible, so that they can be threaded.
You can [resolve conversations](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request#resolving-conversations) on your own when you feel they're resolved - no need to comment explicitly and/or wait for a maintainer.

#### Requested Changes

After a maintainer reviews your PR, they may request changes on it.
Once you've made those changes, [re-request review on GitHub](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#re-requesting-a-review).

Please try not to force-push commits to PRs that have already been reviewed.
Doing so makes it harder to review the changes.
We squash merge all commits so there's no need to try to preserve Git history within a PR branch.

Once you've addressed all our feedback by making code changes and/or started a followup discussion, [re-request review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#re-requesting-a-review) from each maintainer whose feedback you addressed.

Once all feedback is addressed and the PR is approved, we'll ensure the branch is up to date with `main` and merge it for you.

#### Post-Merge Recognition

Once your PR is merged, if you haven't yet been added to the [_Contributors_ table in the README.md](../README.md#contributors) for its [type of contribution](https://allcontributors.org/docs/en/emoji-key "Allcontributors emoji key"), you should be soon.
Please do ping the maintainer who merged your PR if that doesn't happen within 24 hours - it was likely an oversight on our end!

## Emojis & Appreciation

If you made it all the way to the end, bravo dear user, we love you.
Please include your favorite emoji in the bottom of your issues and PRs to signal to us that you did in fact read this file and are trying to conform to it as best as possible.
💖 is a good starter if you're not sure which to use.
97 changes: 97 additions & 0 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Development

After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing pnpm](https://pnpm.io/installation):

```shell
git clone https://github.com/<your-name-here>/console-fail-test
cd console-fail-test
pnpm install
```

> This repository includes a list of suggested VS Code extensions.
> It's a good idea to use [VS Code](https://code.visualstudio.com) and accept its suggestion to install them, as they'll help with development.
## Building

Run [**tsup**](https://tsup.egoist.dev) locally to build source files from `src/` into output files in `lib/`:

```shell
pnpm build
```

Add `--watch` to run the builder in a watch mode that continuously cleans and recreates `lib/` as you save files:

```shell
pnpm build --watch
```

## Formatting

[Prettier](https://prettier.io) is used to format code.
It should be applied automatically when you save files in VS Code or make a Git commit.

To manually reformat all files, you can run:

```shell
pnpm format --write
```

## Linting

This package includes several forms of linting to enforce consistent code quality and styling.
Each should be shown in VS Code, and can be run manually on the command-line:

- `pnpm lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files
- `pnpm lint:knip` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports
- `pnpm lint:md` ([Markdownlint](https://github.com/DavidAnson/markdownlint)): Checks Markdown source files
- `pnpm lint:packages` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the `pnpm-lock.yml` file
- `pnpm lint:spelling` ([cspell](https://cspell.org)): Spell checks across all source files

Read the individual documentation for each linter to understand how it can be configured and used best.

For example, ESLint can be run with `--fix` to auto-fix some lint rule complaints:

```shell
pnpm run lint --fix
```

Note that you'll likely need to run `pnpm build` before `pnpm lint` so that lint rules which check the file system can pick up on any built files.

## Testing

[Vitest](https://vitest.dev) is used for tests.
You can run it locally on the command-line:

```shell
pnpm run test
```

Add the `--coverage` flag to compute test coverage and place reports in the `coverage/` directory:

```shell
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.
To launch it, open a test file, then run _Debug Current Test File_ from the VS Code Debug panel (or press F5).

## Type Checking

You should be able to see suggestions from [TypeScript](https://typescriptlang.org) in your editor for all open files.

However, it can be useful to run the TypeScript command-line (`tsc`) to type check all files in `src/`:

```shell
pnpm tsc
```

Add `--watch` to keep the type checker running in a watch mode that updates the display as you save files:

```shell
pnpm tsc --watch
```
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
name: "🐛 Report a Bug"
description: "Report a bug trying to run the code."
title: "🐛 Bug: <short description of the bug>"
labels:
- "type: bug"
body:
- attributes:
description: If any of these required steps are not taken, we may not be able to review your issue. Help us to help you!
@@ -12,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/console-fail-test/issues?q=is%3Aissue+label%3A%22type%3A+bug%22) 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:
@@ -28,6 +23,11 @@ body:
validations:
required: true
- attributes:
label: Additional Info
description: Any additional info you'd like to provide.
label: Additional Info
type: textarea
description: Report a bug trying to run the code
labels:
- "type: bug"
name: 🐛 Bug
title: "🐛 Bug: <short description of the bug>"
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: "📝 Documentation"
description: "Report a typo or missing area of documentation"
title: "📝 Documentation: <short description of the request>"
labels:
- "area: documentation"
body:
- attributes:
description: If any of these required steps are not taken, we may not be able to review your issue. Help us to help you!
label: Bug Report Checklist
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/console-fail-test/issues?q=is%3Aissue+label%3A%22area%3A+documentation%22) 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:
@@ -20,6 +15,11 @@ body:
validations:
required: true
- attributes:
label: Additional Info
description: Any additional info you'd like to provide.
label: Additional Info
type: textarea
description: Report a typo or missing area of documentation
labels:
- "area: documentation"
name: 📝 Documentation
title: "📝 Documentation: <short description of the request>"
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
name: "🚀 Request a Feature"
description: "Request that a new feature be added or an existing feature improved"
title: "🚀 Feature: <short description of the feature>"
labels:
- "type: feature"
body:
- attributes:
description: If any of these required steps are not taken, we may not be able to review your issue. Help us to help you!
label: Bug Report Checklist
options:
- label: I have tried restarting my IDE and the issue persists.
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/console-fail-test/issues?q=is%3Aissue+label%3A%22type%3A+feature%22) 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:
@@ -22,6 +15,11 @@ body:
validations:
required: true
- attributes:
label: Additional Info
description: Any additional info you'd like to provide.
label: Additional Info
type: textarea
description: Request that a new feature be added or an existing feature improved
labels:
- "type: feature"
name: 🚀 Feature
title: "🚀 Feature: <short description of the feature>"
Loading