Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
476f028
Refactor TypeScript configuration and improve type safety across mult…
ArtMathArt May 2, 2025
354f9c6
WAT-4234
sukhinin-artem May 8, 2025
9202a34
Enhance type safety and improve TypeScript configurations across mult…
sukhinin-artem Jun 4, 2025
d9fb96a
Merge remote-tracking branch 'origin/master' into migrate_strict_ts
sukhinin-artem Jun 17, 2025
83fcc32
Refactor TypeScript types for improved clarity and type safety across…
sukhinin-artem Jun 17, 2025
810ee32
Add TypeScript configuration files for browser-proxy and test-utils p…
sukhinin-artem Jun 17, 2025
1c273e3
Implement TypeScript build configuration for http-api package, enhanc…
sukhinin-artem Jun 17, 2025
7e6cda9
Refactor LockPool utility for improved clarity, add TypeScript build …
sukhinin-artem Jun 17, 2025
84245f8
Add TypeScript build configuration for plugin-fs-store, update tsconf…
sukhinin-artem Jun 17, 2025
5974a9f
Add TypeScript build configuration for plugin-selenium-driver, update…
sukhinin-artem Jun 17, 2025
47de017
Enhance type safety and improve TypeScript configurations in web-appl…
sukhinin-artem Jul 2, 2025
1f27a52
Refactor TypeScript configurations and enhance type safety across mul…
sukhinin-artem Jul 2, 2025
ddb6ce3
Update .gitignore to include .tsbuildinfo and c8-cov/ directories, mo…
sukhinin-artem Jul 2, 2025
658e5b2
Refactor error handling in tests and utility functions by updating er…
sukhinin-artem Jul 2, 2025
0b8e842
Refactor HttpClient and HttpServer tests to improve type safety by re…
sukhinin-artem Jul 2, 2025
57d21df
Enhance child process spawning by adding 'windowsHide' option to supp…
sukhinin-artem Jul 3, 2025
4fcedc8
Update publish script to support package exclusion during CI publishi…
sukhinin-artem Jul 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run build:main
- run: npm run test:ci

- name: Coveralls
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ node_modules
lerna-debug.log

.DS_Store
.tsbuildinfo

c8-cov/
8 changes: 4 additions & 4 deletions core/api/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {testAPIController} from './test-api-controller';

type TestFunction = (api: TestContext) => void | Promise<any>;

export function beforeRun(callback) {
export function beforeRun(callback: (...args: any[]) => any) {
testAPIController.registerBeforeRunCallback(callback);
}

export function afterRun(callback) {
export function afterRun(callback: (...args: any[]) => any) {
testAPIController.registerAfterRunCallback(callback);
}

Expand Down Expand Up @@ -44,7 +44,7 @@ export async function run(...tests: Array<TestFunction>) {

passed = true;
} catch (error) {
catchedError = restructureError(error);
catchedError = restructureError(error as Error);
} finally {
if (passed) {
loggerClient.endStep(testID, 'Test passed');
Expand All @@ -53,7 +53,7 @@ export async function run(...tests: Array<TestFunction>) {
} else {
loggerClient.endStep(testID, 'Test failed', catchedError);

await bus.failedTest(catchedError);
await bus.failedTest(catchedError as Error);
}
}
}
10 changes: 10 additions & 0 deletions core/api/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"noEmit": false,
"composite": true
},
"exclude": ["test"]
}
37 changes: 5 additions & 32 deletions core/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"allowJs": false,
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"preserveConstEnums": true,
"noEmitOnError": true,
"declaration": false,
"outDir": "dist",
"sourceMap": true,
"lib": [
"es5",
"es2015",
"es2016",
"es2017",
"dom"
],

"noUnusedLocals": true,
"strictNullChecks": true,
"removeComments": false
"rootDir": ".",
"noEmit": true
},
"include": [
"*.ts",
"src/**/*.ts",
"src/**/*.json"
],
"exclude": [
"./node_modules",
"../../node_modules"
]
}
"include": ["src", "test"]
}
20 changes: 10 additions & 10 deletions core/async-assert/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ type AssertionAPI = typeof chai['assert'] & {
};
type WrappedPromisedAssertionApi = PromisedAssert & {
[errorMessagesField]: Array<string>;
};
} & AssertionAPI;

export function createAssertion(options: IAssertionOptions = {}) {
const isSoft = options.isSoft === true;
for (const plugin of options.plugins || []) {
chai.use(plugin);
}
// eslint-disable-next-line sonarjs/cognitive-complexity
const proxyGetter = (target, fieldName: string) => {
const proxyGetter = (target: AssertionAPI, fieldName: string) => {
if (fieldName === errorMessagesField) {
return target[errorMessagesField];
}

const typeOfAssert = isSoft ? 'softAssert' : 'assert';

const originalMethod = chai.assert[fieldName];
const methodAsString = target[fieldName]
const originalMethod = (chai.assert as any)[fieldName];
const methodAsString = (target as any)[fieldName]
.toString()
.replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, '');
const stringStart = methodAsString.indexOf('(') + 1;
Expand All @@ -33,7 +33,7 @@ export function createAssertion(options: IAssertionOptions = {}) {
methodAsString.slice(stringStart, stringEnd).match(/([^\s,]+)/g) ||
[];

return async (...args) => {
return async (...args: any[]) => {
const successMessage =
originalMethod.length === args.length ? args.pop() : '';
const assertArguments: Array<any> = [];
Expand All @@ -45,7 +45,7 @@ export function createAssertion(options: IAssertionOptions = {}) {
break;
}

const replacer = (k, v) =>
const replacer = (_k: any, v: any) =>
Object.prototype.toString.call(v) === '[object RegExp]'
? v.toString()
: v;
Expand All @@ -72,25 +72,25 @@ export function createAssertion(options: IAssertionOptions = {}) {
});
}
} catch (error) {
const errorMessage = error.message;
const errorMessage = (error as Error).message;
let handleError: void | Error | null = null;

error.message = successMessage || assertMessage || errorMessage;
(error as Error).message = successMessage || assertMessage || errorMessage;

if (options.onError) {
handleError = await options.onError({
isSoft,
successMessage,
assertMessage,
errorMessage,
error,
error: (error instanceof Error) ? error : new Error(String(error)),
args,
originalMethod: fieldName,
});
}

if (!handleError) {
handleError = error;
handleError = error as Error;
}

if (isSoft) {
Expand Down
12 changes: 6 additions & 6 deletions core/async-assert/test/assert.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('assertion functional', () => {

it('should call onError assertion callback without changed error object', async () => {
const assert = createAssertion({
onError: (meta) => {
onError: (_meta) => {
/* empty */
},
});
Expand All @@ -118,22 +118,22 @@ describe('assertion functional', () => {
await assert.equal(1, 2);
} catch (error) {
chai.expect(error).to.be.an.instanceof(Error);
chai.expect(error.message).to.be.eq(
chai.expect((error as Error).message).to.be.eq(
'[assert] equal(act = 1, exp = 2)',
);
}
});

it('should call onError assertion callback with different Error', async () => {
const overloadMessage = 'Overloaded message';
let originalError;
let originalError: Error | undefined;

const assert = createAssertion({
onError: (meta) => {
const tmpErr = new Error();
originalError = meta.error;
tmpErr.message = overloadMessage;
tmpErr.stack = meta.error.stack;
tmpErr.stack = meta.error?.stack ?? '';

return tmpErr;
},
Expand All @@ -143,8 +143,8 @@ describe('assertion functional', () => {
await assert.equal(1, 2);
} catch (error) {
chai.expect(error).to.be.an.instanceof(Error);
chai.expect(error.message).to.be.eq(overloadMessage);
chai.expect(error.stack).to.be.eq(originalError.stack);
chai.expect((error as Error).message).to.be.eq(overloadMessage);
chai.expect((error as Error).stack).to.be.eq(originalError?.stack);
}
});
});
10 changes: 10 additions & 0 deletions core/async-assert/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"noEmit": false,
"composite": true
},
"exclude": ["test"]
}
37 changes: 5 additions & 32 deletions core/async-assert/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"allowJs": false,
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"preserveConstEnums": true,
"noEmitOnError": true,
"declaration": false,
"outDir": "dist",
"sourceMap": true,
"lib": [
"es5",
"es2015",
"es2016",
"es2017",
"dom"
],

"noUnusedLocals": true,
"strictNullChecks": true,
"removeComments": false
"rootDir": ".",
"noEmit": true
},
"include": [
"*.ts",
"src/**/*.ts",
"src/**/*.json"
],
"exclude": [
"./node_modules",
"../../node_modules"
]
}
"include": ["src", "test"]
}
2 changes: 1 addition & 1 deletion core/async-breakpoints/src/async-breakpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class AsyncBreakpoints extends EventEmitter {
}

const breakpoint = new Promise<void>((resolve, reject) => {
const releaseHandler = (resolvedType) => {
const releaseHandler = (resolvedType: BreakpointsTypes) => {
if (resolvedType === type) {
this.clearBreakpoint(type);
// eslint-disable-next-line no-use-before-define
Expand Down
2 changes: 1 addition & 1 deletion core/async-breakpoints/src/break-stack-error.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export class BreakStackError extends Error {
constructor(message) {
constructor(message: string) {
super(message);
// Ensure the name of this error is the same as the class name
this.name = this.constructor.name;
Expand Down
10 changes: 10 additions & 0 deletions core/async-breakpoints/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"noEmit": false,
"composite": true
},
"exclude": ["test"]
}
37 changes: 5 additions & 32 deletions core/async-breakpoints/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"allowJs": false,
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"preserveConstEnums": true,
"noEmitOnError": true,
"declaration": false,
"outDir": "dist",
"sourceMap": true,
"lib": [
"es5",
"es2015",
"es2016",
"es2017",
"dom"
],

"noUnusedLocals": true,
"strictNullChecks": true,
"removeComments": false
"rootDir": ".",
"noEmit": true
},
"include": [
"*.ts",
"src/**/*.ts",
"src/**/*.json"
],
"exclude": [
"./node_modules",
"../../node_modules"
]
}
"include": ["src", "test"]
}
Loading