Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow expectError assertions to detect non-callable/non-constructable values/expressions #104

Conversation

BendingBender
Copy link
Collaborator

This PR extends the errors swallowed by usage of expectError for the following 4 errors:

  • expression is not callable
  • value is not callable
  • expression not constructable
  • non-void function is not constructable

Fixes #96

@papb
Copy link
Contributor

papb commented May 24, 2021

Hello! This helps a little to clarify my various questions about how exactly expectError works. Do you mind taking a look on other questions I raised for expectError in #55 (example)? Thanks!!

@sindresorhus
Copy link
Collaborator

@BendingBender Any idea why the test is failing?

@BendingBender
Copy link
Collaborator Author

@sindresorhus Fixed it. This broke because #100 fixed tests to only depend on explicit TS configs. Previously, noImplicitAny: false was inherited by tests from the project's tsconfig.json. This setting influences which errors are reported by tsc for the "new call for a non-void function" test.

@SamVerschueren SamVerschueren merged commit 27ccc49 into tsdjs:master May 27, 2021
@SamVerschueren
Copy link
Collaborator

🥂 Awesome work!

@BendingBender BendingBender deleted the expect-error-for-non-callable-constructable branch May 27, 2021 20:17
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.

How can I assert that a value is not a callable?
4 participants