update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 17:34:23 +02:00
parent b7e098f0a7
commit 56d28d04d6
4 changed files with 162 additions and 30 deletions

View File

@ -5,17 +5,29 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartexpect",
"description": "manage expectations in code",
"description": "A testing library to manage expectations in code, offering both synchronous and asynchronous assertion methods.",
"npmPackagename": "@push.rocks/smartexpect",
"license": "MIT",
"projectDomain": "push.rocks"
"projectDomain": "push.rocks",
"keywords": [
"testing",
"assertions",
"code quality",
"unit testing",
"test driven development",
"synchronous testing",
"asynchronous testing",
"expectations",
"validation",
"development tools"
]
}
},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"tsdocs": {
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartexpect",
"version": "1.0.21",
"private": false,
"description": "manage expectations in code",
"description": "A testing library to manage expectations in code, offering both synchronous and asynchronous assertion methods.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -40,5 +40,17 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"keywords": [
"testing",
"assertions",
"code quality",
"unit testing",
"test driven development",
"synchronous testing",
"asynchronous testing",
"expectations",
"validation",
"development tools"
]
}
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

157
readme.md
View File

@ -1,37 +1,144 @@
# @push.rocks/smartexpect
manage expectations in code
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartexpect)
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartexpect)
* [github.com (source mirror)](https://github.com/push.rocks/smartexpect)
* [docs (typedoc)](https://push.rocks.gitlab.io/smartexpect/)
## Install
## Status for master
To install `@push.rocks/smartexpect`, use the following command in your terminal:
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartexpect/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartexpect/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartexpect)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartexpect)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartexpect)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartexpect)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartexpect)](https://lossless.cloud)
```bash
npm install @push.rocks/smartexpect --save
```
This will add `@push.rocks/smartexpect` to your project's dependencies. Make sure you're inside your project directory before running this command.
## Usage
Use TypeScript for best in class intellisense
`@push.rocks/smartexpect` is a TypeScript library designed to manage expectations in your code effectively, improving testing readability and maintainability. Below are various scenarios showcasing how to use this library effectively across both synchronous and asynchronous code paths.
## Contribution
### Getting Started
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
First, import `@push.rocks/smartexpect` into your TypeScript file:
For further information read the linked docs at the top of this readme.
```typescript
import { expect, expectAsync } from '@push.rocks/smartexpect';
```
## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
### Synchronous Expectations
You can employ `expect` to create synchronous assertions:
```typescript
import { expect } from '@push.rocks/smartexpect';
// String type assertion
expect('hello').toBeTypeofString();
// Negated String type assertion
expect(1).not.toBeTypeofString();
// Boolean type assertion
expect(true).toBeTypeofBoolean();
// Equality assertion
expect('hithere').toEqual('hithere');
// Deep equality assertion
expect({ key: 'value' }).toEqual({ key: 'value' });
// Regular expression matching
expect('hithere').toMatch(/hi/);
```
### Asynchronous Expectations
For asynchronous operations, use `expectAsync` to return a promise:
```typescript
import { expectAsync } from '@push.rocks/smartexpect';
const asyncStringFetcher = async (): Promise<string> => {
return 'async string';
};
const asyncTest = async () => {
await expectAsync(asyncStringFetcher()).toBeTypeofString();
await expectAsync(asyncStringFetcher()).toEqual('async string');
};
asyncTest();
```
### Advanced Usage
- **Properties and Deep Properties:** Assert the existence of properties and their values.
```typescript
const testObject = { level1: { level2: 'value' } };
// Property existence
expect(testObject).toHaveProperty('level1');
// Deep Property existence
expect(testObject).toHaveDeepProperty(['level1', 'level2']);
```
- **Conditions and Comparisons:** Allow more intricate assertions like greater than, less than, or matching specific conditions.
```typescript
// Greater Than
expect(5).toBeGreaterThan(3);
// Less Than
expect(3).toBeLessThan(5);
// Custom conditions
expect(7).customAssertion(value => value > 5, 'Value is not greater than 5');
```
- **Arrays and Objects:** Work seamlessly with arrays and objects, checking for containment, length, or specific values.
```typescript
const testArray = [1, 2, 3];
// Containment
expect(testArray).toContain(2);
// Array length
expect(testArray).toHaveLength(3);
// Object matching
expect({ name: 'Test', value: 123 }).toMatchObject({ name: 'Test' });
```
### Handling Promises and Async Operations
`@push.rocks/smartexpect` gracefully integrates with asynchronous operations, providing a `expectAsync` function that handles promise-based assertions. This keeps your tests clean and readable, irrespective of the nature of the code being tested.
### Best Practices
- **Readability:** Favor clarity and readability by explicitly stating your expectations. `@push.rocks/smartexpect`'s API is designed to be fluent and expressive, making your tests easy to write and, more importantly, easy to read.
- **Comprehensive Coverage:** Utilize the full spectrum of assertions provided to cover a broad set of use cases, ensuring your code behaves as expected not just in ideal conditions but across various edge cases.
- **Maintainability:** Group related assertions together to improve test maintainability. This makes it easier to update tests as your codebase evolves.
Through judicious use of `@push.rocks/smartexpect`, you can enhance the reliability and maintainability of your test suite, making your codebase more robust and your development workflow more efficient.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.