Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/klassijs/klassijs-soft-assert
https://github.com/klassijs/klassijs-soft-assert
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/klassijs/klassijs-soft-assert
- Owner: klassijs
- License: mit
- Created: 2024-11-07T16:58:26.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-01-06T16:04:42.000Z (9 days ago)
- Last Synced: 2025-01-06T16:37:36.132Z (9 days ago)
- Language: JavaScript
- Size: 111 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Klassijs 'soft assert' Assertion Tool
## Overview
The Assertion Tool is designed to enhance your testing framework by allowing tests to continue running even when assertions fail. Instead of halting the test upon an assertion failure, this tool collects all failed assertions and compiles them into a comprehensive report at the end of the test run. This approach ensures that non-functional features do not prevent your tests from executing completely.
## Features
- **Non-blocking Assertions**: Failures in assertions do not stop the execution of tests.
- **Comprehensive Reporting**: All failed assertions are accumulated and reported at the end of the test run.
- **Easy Integration**: Seamlessly integrates with your existing test framework.## Installation
To add the Assertion Tool to your project, follow these steps:
1. Add to project:
```bash
pnpm add klassijs-soft-assert
```
2. Import the tool into your test files:
```javascript
const softAssert = require('klassijs-soft-assert');
```## Usage
1. **Use the assertion methods**:
Use the assertion methods as you normally would. If an assertion fails, it will not stop the test:
```javascript
await softAssert(actual, assertionType, expected, message, operator);
```2. **The report**:
At the end of your test suite, as part of the report method a summary of all failed assertions will be attached to te report## Example
Here’s a simple example of how to use the Assertion Tool:
```javascript
const softAssert = require('klassijs-soft-assert');describe('Sample Test Suite', async() => {
it('should run all tests and report failed assertions', () => {
await softAssert(title, 'tohavetext', 'our priority', 'This will pass');
await softAssert(title, 'tohavetext', 'our priorities', 'This will fail');
await softAssert(elem.elementId,'equal', null, 'This will pass');
await softAssert(elem.elementId,'toNotEqual', null, 'This will fail');
});
});
```## Contributing
Contributions are welcome! If you have suggestions for improvements or bug fixes, feel free to open an issue or submit a pull request.
## License
This project is licensed under the MIT License.