fix(core): update
This commit is contained in:
parent
035138a437
commit
8a2d34e88a
128
.gitlab-ci.yml
128
.gitlab-ci.yml
@ -1,128 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- pnpm install -g pnpm
|
|
||||||
- pnpm install -g @shipzone/npmci
|
|
||||||
- npmci npm prepare
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
auditProductionDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command pnpm audit --audit-level=high --prod
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
auditDevDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command pnpm audit --audit-level=high --dev
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run buildDocs
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
14
package.json
14
package.json
@ -16,16 +16,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.66",
|
"@gitzone/tsbuild": "^2.1.66",
|
||||||
"@gitzone/tsbundle": "^2.0.8",
|
"@gitzone/tsbundle": "^2.0.8",
|
||||||
"@gitzone/tsrun": "^1.2.42",
|
"@gitzone/tsrun": "^1.2.44",
|
||||||
"@gitzone/tstest": "^1.0.74",
|
"@gitzone/tstest": "^1.0.77",
|
||||||
"@pushrocks/tapbundle": "^5.0.4",
|
"@push.rocks/tapbundle": "^5.0.12",
|
||||||
"@types/node": "^20.3.1",
|
"@types/node": "^20.4.10"
|
||||||
"tslint": "^6.1.3",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^3.0.1",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"@pushrocks/smartpromise": "^4.0.2",
|
"@push.rocks/smartpromise": "^4.0.2",
|
||||||
"fast-deep-equal": "^3.1.3"
|
"fast-deep-equal": "^3.1.3"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
|
982
pnpm-lock.yaml
generated
982
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
import { tap } from '@pushrocks/tapbundle';
|
import { tap } from '@push.rocks/tapbundle';
|
||||||
import * as smartexpect from '../ts/index.js';
|
import * as smartexpect from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('sync tests', async () => {
|
tap.test('sync tests', async () => {
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartexpect',
|
name: '@push.rocks/smartexpect',
|
||||||
version: '1.0.18',
|
version: '1.0.19',
|
||||||
description: 'manage expectations in code'
|
description: 'manage expectations in code'
|
||||||
}
|
}
|
||||||
|
@ -184,6 +184,26 @@ export class Assertion {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public toHaveDeepProperty(properties: string[]) {
|
||||||
|
return this.runCheck(() => {
|
||||||
|
let obj = this.getObjectToTestReference();
|
||||||
|
let currentPath = '';
|
||||||
|
|
||||||
|
for (const property of properties) {
|
||||||
|
if (currentPath) {
|
||||||
|
currentPath += `.${property}`;
|
||||||
|
} else {
|
||||||
|
currentPath = property;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!obj || !(property in obj)) {
|
||||||
|
throw new Error(`Missing property at path "${currentPath}" in ${this.baseReference}`);
|
||||||
|
}
|
||||||
|
obj = obj[property];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public toBeGreaterThan(numberArg: number) {
|
public toBeGreaterThan(numberArg: number) {
|
||||||
return this.runCheck(() => {
|
return this.runCheck(() => {
|
||||||
const result = this.getObjectToTestReference() > numberArg;
|
const result = this.getObjectToTestReference() > numberArg;
|
||||||
@ -240,6 +260,8 @@ export class Assertion {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Array
|
||||||
|
|
||||||
public toContain(itemArg: any) {
|
public toContain(itemArg: any) {
|
||||||
return this.runCheck(() => {
|
return this.runCheck(() => {
|
||||||
const result =
|
const result =
|
||||||
@ -253,6 +275,47 @@ export class Assertion {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public toBeEmptyArray() {
|
||||||
|
return this.runCheck(() => {
|
||||||
|
const arrayRef = this.getObjectToTestReference();
|
||||||
|
if (!Array.isArray(arrayRef) || arrayRef.length !== 0) {
|
||||||
|
throw new Error(`Expected ${this.baseReference} to be an empty array, but it was not.`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public toContainAll(values: any[]) {
|
||||||
|
return this.runCheck(() => {
|
||||||
|
const arrayRef = this.getObjectToTestReference();
|
||||||
|
if (!Array.isArray(arrayRef)) {
|
||||||
|
throw new Error(`Expected ${this.baseReference} to be an array.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const value of values) {
|
||||||
|
if (!arrayRef.includes(value)) {
|
||||||
|
throw new Error(
|
||||||
|
`Expected ${this.baseReference} to include value "${value}", but it did not.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public toExclude(value: any) {
|
||||||
|
return this.runCheck(() => {
|
||||||
|
const arrayRef = this.getObjectToTestReference();
|
||||||
|
if (!Array.isArray(arrayRef)) {
|
||||||
|
throw new Error(`Expected ${this.baseReference} to be an array.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arrayRef.includes(value)) {
|
||||||
|
throw new Error(
|
||||||
|
`Expected ${this.baseReference} to exclude value "${value}", but it included it.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public toStartWith(itemArg: any) {
|
public toStartWith(itemArg: any) {
|
||||||
return this.runCheck(() => {
|
return this.runCheck(() => {
|
||||||
const testObject = this.getObjectToTestReference();
|
const testObject = this.getObjectToTestReference();
|
||||||
@ -466,6 +529,14 @@ export class Assertion {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public customAssertion(assertionFunction: (value: any) => boolean, errorMessage: string) {
|
||||||
|
return this.runCheck(() => {
|
||||||
|
if (!assertionFunction(this.getObjectToTestReference())) {
|
||||||
|
throw new Error(errorMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public property(propertyNameArg: string) {
|
public property(propertyNameArg: string) {
|
||||||
this.propertyDrillDown.push(propertyNameArg);
|
this.propertyDrillDown.push(propertyNameArg);
|
||||||
return this;
|
return this;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
|
|
||||||
export { smartdelay, smartpromise };
|
export { smartdelay, smartpromise };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user