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

Give better assertion messages for assert.all & assert.any #193

Merged
merged 2 commits into from
Aug 9, 2023

Conversation

bjornstar
Copy link
Contributor

Fixes #107

I improved the output slightly for the type assertion messages and added tests for the improvements.

source/index.ts Outdated Show resolved Hide resolved
source/index.ts Outdated
return Array.from(new Set(values));
}

function joinWithWord(values: string[], word: 'and' | 'or'): string {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I switched to using Intl.ListFormat but ran into an issue where the type definitions did not exist for it.

I updated tsconfig.json to target ES2021.

@sindresorhus sindresorhus merged commit 85c8992 into sindresorhus:main Aug 9, 2023
2 checks passed
@bjornstar bjornstar deleted the is-any-all-descriptions branch August 15, 2023 12:15
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.

Enhance assert error messages
2 participants