fix(build): Corrected package.json and workflow dependencies and resolved formatting issues in tests.

This commit is contained in:
Philipp Kunz 2025-03-04 12:32:00 +00:00
parent 5801d34f18
commit ed9a9b7f2c
6 changed files with 2250 additions and 1051 deletions

View File

@ -119,6 +119,6 @@ jobs:
run: |
npmci node install stable
npmci npm install
pnpm install -g @gitzone/tsdoc
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

View File

@ -1,5 +1,12 @@
# Changelog
## 2025-03-04 - 1.6.1 - fix(build)
Corrected package.json and workflow dependencies and resolved formatting issues in tests.
- Fixed incorrect global npm package reference for tsdoc installation in workflow file.
- Updated dependencies in package.json for consistency in package naming.
- Resolved inconsistent formatting and spacing in test files.
## 2025-03-04 - 1.6.0 - feat(assertion)
Enhanced the assertion error messaging and added new test cases.

View File

@ -10,14 +10,14 @@
"license": "MIT",
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)",
"build": "(tsbuild tsfolders)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.66",
"@gitzone/tsbundle": "^2.0.8",
"@gitzone/tsrun": "^1.2.44",
"@gitzone/tstest": "^1.0.77",
"@git.zone/tsbuild": "^2.2.1",
"@git.zone/tsbundle": "^2.2.5",
"@git.zone/tsrun": "^1.3.3",
"@git.zone/tstest": "^1.0.96",
"@push.rocks/tapbundle": "^5.5.6",
"@types/node": "^22.13.9"
},

3182
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -76,9 +76,9 @@ tap.test('object property assertions', async () => {
nested: {
prop: 42,
deeplyNested: {
array: [1, 2, 3]
}
}
array: [1, 2, 3],
},
},
};
// Basic property checks
@ -88,13 +88,24 @@ tap.test('object property assertions', async () => {
// Drill-down property navigation
smartexpect.expect(testObject).property('nested').toHaveProperty('prop', 42);
smartexpect.expect(testObject).property('nested').property('deeplyNested').property('array').toBeArray();
smartexpect
.expect(testObject)
.property('nested')
.property('deeplyNested')
.property('array')
.toBeArray();
// Deep property checks
smartexpect.expect(testObject).toHaveDeepProperty(['nested', 'deeplyNested', 'array']);
// Array item navigation
smartexpect.expect(testObject).property('nested').property('deeplyNested').property('array').arrayItem(0).toEqual(1);
smartexpect
.expect(testObject)
.property('nested')
.property('deeplyNested')
.property('array')
.arrayItem(0)
.toEqual(1);
});
tap.test('numeric comparison assertions', async () => {
@ -155,7 +166,9 @@ tap.test('boolean assertions', async () => {
tap.test('function assertions', async () => {
// Function that throws
const throwingFn = () => { throw new Error('test error'); };
const throwingFn = () => {
throw new Error('test error');
};
smartexpect.expect(throwingFn).toThrow();
smartexpect.expect(throwingFn).toThrow(Error);
@ -176,15 +189,10 @@ tap.test('date assertions', async () => {
tap.test('custom assertions', async () => {
// Custom validation logic
smartexpect.expect(42).customAssertion(
value => value % 2 === 0,
'Expected number to be even'
);
smartexpect.expect(42).customAssertion((value) => value % 2 === 0, 'Expected number to be even');
// With fail message
smartexpect.expect('test')
.setFailMessage('Custom fail message for assertion')
.toHaveLength(4);
smartexpect.expect('test').setFailMessage('Custom fail message for assertion').toHaveLength(4);
});
tap.test('logging and debugging', async () => {
@ -192,13 +200,19 @@ tap.test('logging and debugging', async () => {
const complexObject = {
level1: {
level2: {
value: 'nested value'
}
}
value: 'nested value',
},
},
};
// This logs the current value in the chain for debugging
smartexpect.expect(complexObject).property('level1').property('level2').log().property('value').toEqual('nested value');
smartexpect
.expect(complexObject)
.property('level1')
.property('level2')
.log()
.property('value')
.toEqual('nested value');
});
export default tap.start();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartexpect',
version: '1.6.0',
version: '1.6.1',
description: 'A testing library to manage expectations in code, offering both synchronous and asynchronous assertion methods.'
}