diff --git a/lib/gui/tool-runner/index.ts b/lib/gui/tool-runner/index.ts index 2971ef524..d9228d5ed 100644 --- a/lib/gui/tool-runner/index.ts +++ b/lib/gui/tool-runner/index.ts @@ -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; + private _collection: any; + private _globalOpts: any; + private _guiOpts: any; + private _reportPath: string; + private _pluginConfig: any; + private _eventSource: typeof EventSource; + private _reportBuilder: GuiReportBuilder; + private _tests: any; + static create(paths, hermione, configs) { return new this(paths, hermione, configs); } @@ -300,4 +312,4 @@ module.exports = class ToolRunner { _resolveImgPath(imgPath) { return path.resolve(process.cwd(), this._pluginConfig.path, imgPath); } -}; +} diff --git a/package-lock.json b/package-lock.json index 18872bfca..2146eead6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "html-reporter", - "version": "9.11.6", + "version": "9.15.0", "license": "MIT", "workspaces": [ "test/func/fixtures/*", @@ -54,6 +54,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", @@ -4343,6 +4344,12 @@ "@types/node": "*" } }, + "node_modules/@types/bluebird": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.3.tgz", + "integrity": "sha512-dpJ3I8LGkokLWK5mRJB48d/Y5n5J222dPqJV//xx2g1dqB0ISjWmn0hjw+ylfTNMpYopDJ3NUmFfQKcV8365bA==", + "dev": true + }, "node_modules/@types/cacheable-request": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", @@ -38116,6 +38123,12 @@ "@types/node": "*" } }, + "@types/bluebird": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.3.tgz", + "integrity": "sha512-dpJ3I8LGkokLWK5mRJB48d/Y5n5J222dPqJV//xx2g1dqB0ISjWmn0hjw+ylfTNMpYopDJ3NUmFfQKcV8365bA==", + "dev": true + }, "@types/cacheable-request": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", diff --git a/package.json b/package.json index c2d9574e2..8d76323e9 100644 --- a/package.json +++ b/package.json @@ -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",