Skip to content

Commit

Permalink
chore: re-write tool-runner to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowusr committed Oct 30, 2023
1 parent fc5f647 commit ba4c54e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 26 deletions.
62 changes: 37 additions & 25 deletions lib/gui/tool-runner/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
'use strict';

const _ = require('lodash');
const fs = require('fs-extra');
const path = require('path');
const chalk = require('chalk');
const Promise = require('bluebird');
const looksSame = require('looks-same');

const Runner = require('./runner');
const subscribeOnToolEvents = require('./report-subscriber');
const {GuiReportBuilder} = require('../../report-builder/gui');
const EventSource = require('../event-source');
const {logger} = require('../../common-utils');
const reporterHelper = require('../../reporter-helpers');
const {UPDATED, SKIPPED, IDLE} = require('../../constants/test-statuses');
const {DATABASE_URLS_JSON_NAME, LOCAL_DATABASE_NAME} = require('../../constants/database');
const {getShortMD5} = require('../../common-utils');
const {formatId, mkFullTitle, mergeDatabasesForReuse, filterByEqualDiffSizes} = require('./utils');
const {getTestsTreeFromDatabase} = require('../../db-utils/server');
const {formatTestResult} = require('../../server-utils');
const {ToolName} = require('../../constants');

module.exports = class ToolRunner {
import _ from 'lodash';
import fs from 'fs-extra';
import path from 'path';
import chalk from 'chalk';
import Promise from 'bluebird';
import looksSame from 'looks-same';
import type Hermione from 'hermione';

import Runner from './runner';
import subscribeOnToolEvents from './report-subscriber';
import {GuiReportBuilder} from '../../report-builder/gui';
import EventSource from '../event-source';
import {logger} from '../../common-utils';
import reporterHelper from '../../reporter-helpers';
import {UPDATED, SKIPPED, IDLE} from '../../constants/test-statuses';
import {DATABASE_URLS_JSON_NAME, LOCAL_DATABASE_NAME} from '../../constants/database';
import {getShortMD5} from '../../common-utils';
import {formatId, mkFullTitle, mergeDatabasesForReuse, filterByEqualDiffSizes} from './utils';
import {getTestsTreeFromDatabase} from '../../db-utils/server';
import {formatTestResult} from '../../server-utils';
import {ToolName} from '../../constants';
import {HtmlReporter} from '../../plugin-api';

export class ToolRunner {
private _testFiles: string[];
private _hermione: Hermione & {htmlReporter: HtmlReporter};
private _tree: any;

Check warning on line 27 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 27 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 27 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type
private _collection: any;

Check warning on line 28 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 28 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 28 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type
private _globalOpts: any;

Check warning on line 29 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 29 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 29 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type
private _guiOpts: any;

Check warning on line 30 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 30 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 30 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type
private _reportPath: string;
private _pluginConfig: any;

Check warning on line 32 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 32 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 32 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type
private _eventSource: typeof EventSource;
private _reportBuilder: GuiReportBuilder;
private _tests: any;

Check warning on line 35 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 35 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 35 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

static create(paths, hermione, configs) {

Check failure on line 37 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Missing return type on function

Check failure on line 37 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Missing return type on function

Check failure on line 37 in lib/gui/tool-runner/index.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Missing return type on function
return new this(paths, hermione, configs);
}
Expand Down Expand Up @@ -300,4 +312,4 @@ module.exports = class ToolRunner {
_resolveImgPath(imgPath) {
return path.resolve(process.cwd(), this._pluginConfig.path, imgPath);
}
};
}
15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"@playwright/test": "^1.37.1",
"@swc/core": "^1.3.64",
"@types/better-sqlite3": "^7.6.4",
"@types/bluebird": "^3.5.3",
"@types/chai": "^4.3.5",
"@types/debug": "^4.1.8",
"@types/enzyme": "^3.10.13",
Expand Down

0 comments on commit ba4c54e

Please sign in to comment.