@itwin/certa 5.3.2 → 5.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Change Log - @itwin/certa
2
2
 
3
- This log was last generated on Thu, 13 Nov 2025 23:23:23 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 12 Dec 2025 20:11:41 GMT and should not be manually modified.
4
+
5
+ ## 5.3.4
6
+ Fri, 12 Dec 2025 20:11:41 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 5.3.3
11
+ Thu, 20 Nov 2025 22:30:37 GMT
12
+
13
+ _Version update only_
4
14
 
5
15
  ## 5.3.2
6
16
  Thu, 13 Nov 2025 23:23:23 GMT
@@ -1 +1 @@
1
- {"version":3,"file":"CertaConfig.js","sourceRoot":"","sources":["../src/CertaConfig.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,+CAAqC;AA2FrC,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,OAAO,GAAG,EAAE,GAAG,OAAO,CAAC;AAE7B,IAAiB,WAAW,CAiF3B;AAjFD,WAAiB,WAAW;IACb,oBAAQ,GAAG;QACtB,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE;YACL,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;YACd,iBAAiB,EAAE,IAAI;SACxB;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,CAAC,GAAG,OAAO;YACpB,QAAQ,EAAE,MAAM;SACjB;QACD,aAAa,EAAE;YACb,uGAAuG;YACvG,IAAI,EAAE,IAAI,KAAK,EAAU;YACzB,UAAU,EAAE,IAAI,KAAK,EAAU;SAChC;KACF,CAAC;IAEF,mGAAmG;IACnG,MAAM,aAAa,GAAG;QACpB,mBAAmB;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AM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,QAAQ,GAAG,IAAA,oBAAK,EAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,4DAA4D;QAC7G,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9D,CAAC;IALe,0BAAc,iBAK7B,CAAA;AACH,CAAC,EAjFgB,WAAW,2BAAX,WAAW,QAiF3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport * as lodash from \"lodash\";\nimport { parse } from \"jsonc-parser\";\n\n/** Defines mocha options common to all test runners. */\nexport interface CertaMochaOpts {\n /** The default hook and test-case timeout, in milliseconds. */\n timeout: number;\n /** A regular expression test filter - only tests matching this expression will be run. */\n grep?: string;\n /** A string test filter - only tests containing this string will be run. */\n fgrep?: string;\n /** Whether `grep` and `fgrep` matches should be inverted. */\n invert: boolean;\n /** Causes tests marked `only` to fail the suite. */\n forbidOnly: boolean;\n /** The name of a (built-in) mocha reporter to use. */\n reporter: string;\n /** Mocha reporter-specific options. */\n reporterOptions?: object;\n}\n\n/** Defines options specific to the chrome test runner */\nexport interface CertaChromeOpts {\n /** Array of additional chrome arguments. */\n args: string[];\n /** Array of absolute paths to directories that contain static assets which should be made available via the frontend webserver. */\n publicDirs: string[];\n}\n\n/** Defines ports that certa may listen on. */\nexport interface CertaPortOpts {\n /** The port that will be used by the v8 inspector in the \"main\" process to communicate with a debugger (when the `debug` option is enabled). */\n debugging: number;\n /** `[Chrome Only]` The port that will be used by to serve test assets to the frontend. */\n frontend: number;\n /** `[Chrome and Electron Only]` The port that will be used for remote debugging (when the `debug` option is enabled). */\n frontendDebugging: number;\n}\n\nexport interface PartialCertaConfig {\n testBundle: string;\n instrumentedTestBundle?: string;\n backendInitModule?: string;\n debug?: boolean;\n ports?: Partial<CertaPortOpts>;\n mochaOptions?: Partial<CertaMochaOpts>;\n chromeOptions?: Partial<CertaChromeOpts>;\n}\n\n/** Certa configuration options. */\nexport interface CertaConfig {\n\n /** The absolute path to a JavaScript file containing all mocha tests to be run. */\n readonly testBundle: string;\n\n /**\n * An instanbul-instrumented version of the `testBundle`.\n * This will be used instead of `testBundle` when running with `cover` enabled.\n */\n readonly instrumentedTestBundle?: string;\n\n /**\n * The absolute path to a JavaScript module containing backend initialization logic.\n * This module will be required in Certa's \"main\" process ***before*** initializing a test runner.\n * If the file's `module.exports` is a Promise, that Promise will also be awaited before running tests.\n * The exported Promise may also optionally be resolved with a \"cleanup\" async callback, which will be executed _after_ running tests (not supported in electron).\n * @optional\n */\n readonly backendInitModule?: string;\n\n /**\n * Whether Certa should run in \"debug mode\".\n * When debug mode is enabled, chrome and electron windows will be visible and remote debugging is enabled.\n */\n readonly debug: boolean;\n\n /**\n * Whether Certa should measure code coverage.\n * NB: This is currently only supported by the chrome and node test runners.\n */\n readonly cover: boolean;\n\n /** Defines ports used by the chrome and electron test runners. */\n readonly ports: Readonly<CertaPortOpts>;\n\n /** Defines mocha options common to all test runners. */\n readonly mochaOptions: Readonly<CertaMochaOpts>;\n\n /** Defines options specific to the chrome test runner */\n readonly chromeOptions: Readonly<CertaChromeOpts>;\n}\n\nconst SECONDS = 1000;\nconst MINUTES = 60 * SECONDS;\n\nexport namespace CertaConfig {\n export const defaults = {\n debug: false,\n cover: false,\n ports: {\n debugging: 5858,\n frontend: 3000,\n frontendDebugging: 9223,\n },\n mochaOptions: {\n invert: false,\n timeout: 2 * MINUTES,\n reporter: \"spec\",\n },\n chromeOptions: {\n // NB: These should stay **empty** arrays, otherwise lodash.defaultsDeep will not merge them correctly.\n args: new Array<string>(),\n publicDirs: new Array<string>(),\n },\n };\n\n // List of config options that may be relative file paths and should be resolved to absolute paths.\n const _filePathOpts = [\n \"backendInitModule\",\n \"testBundle\",\n \"instrumentedTestBundle\",\n \"chromeOptions.publicDirs\",\n ];\n\n /**\n * Resolves all relative file paths in `opts` to absolute paths, starting from `baseDir`.\n * NB: This mutates `opts`.\n * @param baseDir The starting point for resolving relative paths.\n * @param opts A partial CertaConfig object.\n */\n function resolvePaths(baseDir: string, opts: PartialCertaConfig): void {\n for (const propPath of _filePathOpts) {\n const relativeFilePath = lodash.get(opts, propPath);\n if (relativeFilePath) {\n if (Array.isArray(relativeFilePath))\n lodash.set(opts, propPath, relativeFilePath.map((p) => path.resolve(baseDir, p)));\n else\n lodash.set(opts, propPath, path.resolve(baseDir, relativeFilePath));\n }\n }\n }\n\n /**\n * Creates a complete CertaConfig object by combining a partial config with default values.\n * All relative paths are resolved from the current working directory.\n * Throws if the `testBundle` option is undefined or invalid.\n * @param opts A partial CertaConfig object.\n */\n export function fromObject(opts: PartialCertaConfig): CertaConfig {\n const resolvedOpts = lodash.defaultsDeep(opts, defaults);\n resolvePaths(process.cwd(), resolvedOpts);\n\n if (!resolvedOpts.testBundle)\n throw new Error(\"The required testBundle option was not set.\");\n\n if (!fs.existsSync(resolvedOpts.testBundle))\n throw new Error(`The specified testBundle file \"${resolvedOpts.testBundle}\" does not exist.`);\n\n return resolvedOpts;\n }\n\n /**\n * Creates a complete CertaConfig object by loading options from a certa.json config file,\n * applying run-time overrides, then combining that with default values.\n * All relative paths specified in the config file are resolved from the config file directory.\n * All other relative paths (overrides or defaults) are resolved from the current working directory.\n * Throws if the `testBundle` option is undefined or invalid.\n * @param filePath The path to a certa.json config file.\n * @param overrides A partial CertaConfig object. These values will always override any options set in the config file.\n */\n export function fromConfigFile(filePath: string, overrides: PartialCertaConfig): CertaConfig {\n const fileContents = fs.readFileSync(filePath);\n const fileOpts = parse(fileContents.toString()); // Parsing with jsonc-parser lets us safely handle comments.\n resolvePaths(path.dirname(filePath), fileOpts);\n return fromObject(lodash.defaultsDeep(overrides, fileOpts));\n }\n}\n"]}
1
+ {"version":3,"file":"CertaConfig.js","sourceRoot":"","sources":["../src/CertaConfig.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,+CAAqC;AA2FrC,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,OAAO,GAAG,EAAE,GAAG,OAAO,CAAC;AAE7B,IAAiB,WAAW,CAiF3B;AAjFD,WAAiB,WAAW;IACb,oBAAQ,GAAG;QACtB,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE;YACL,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;YACd,iBAAiB,EAAE,IAAI;SACxB;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,CAAC,GAAG,OAAO;YACpB,QAAQ,EAAE,MAAM;SACjB;QACD,aAAa,EAAE;YACb,uGAAuG;YACvG,IAAI,EAAE,IAAI,KAAK,EAAU;YACzB,UAAU,EAAE,IAAI,KAAK,EAAU;SAChC;KACF,CAAC;IAEF,mGAAmG;IACnG,MAAM,aAAa,GAAG;QACpB,mBAAmB;QACnB,YAAY;QACZ,wBAAwB;QACxB,0BAA0B;KAC3B,CAAC;IAEF;;;;;OAKG;IACH,SAAS,YAAY,CAAC,OAAe,EAAE,IAAwB;QAC7D,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE,CAAC;YACrC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACpD,IAAI,gBAAgB,EAAE,CAAC;gBACrB,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;oBACjC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,gBAAgB,CAAC,GAAG,C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3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as fs from \"fs\";\r\nimport * as path from \"path\";\r\nimport * as lodash from \"lodash\";\r\nimport { parse } from \"jsonc-parser\";\r\n\r\n/** Defines mocha options common to all test runners. */\r\nexport interface CertaMochaOpts {\r\n /** The default hook and test-case timeout, in milliseconds. */\r\n timeout: number;\r\n /** A regular expression test filter - only tests matching this expression will be run. */\r\n grep?: string;\r\n /** A string test filter - only tests containing this string will be run. */\r\n fgrep?: string;\r\n /** Whether `grep` and `fgrep` matches should be inverted. */\r\n invert: boolean;\r\n /** Causes tests marked `only` to fail the suite. */\r\n forbidOnly: boolean;\r\n /** The name of a (built-in) mocha reporter to use. */\r\n reporter: string;\r\n /** Mocha reporter-specific options. */\r\n reporterOptions?: object;\r\n}\r\n\r\n/** Defines options specific to the chrome test runner */\r\nexport interface CertaChromeOpts {\r\n /** Array of additional chrome arguments. */\r\n args: string[];\r\n /** Array of absolute paths to directories that contain static assets which should be made available via the frontend webserver. */\r\n publicDirs: string[];\r\n}\r\n\r\n/** Defines ports that certa may listen on. */\r\nexport interface CertaPortOpts {\r\n /** The port that will be used by the v8 inspector in the \"main\" process to communicate with a debugger (when the `debug` option is enabled). */\r\n debugging: number;\r\n /** `[Chrome Only]` The port that will be used by to serve test assets to the frontend. */\r\n frontend: number;\r\n /** `[Chrome and Electron Only]` The port that will be used for remote debugging (when the `debug` option is enabled). */\r\n frontendDebugging: number;\r\n}\r\n\r\nexport interface PartialCertaConfig {\r\n testBundle: string;\r\n instrumentedTestBundle?: string;\r\n backendInitModule?: string;\r\n debug?: boolean;\r\n ports?: Partial<CertaPortOpts>;\r\n mochaOptions?: Partial<CertaMochaOpts>;\r\n chromeOptions?: Partial<CertaChromeOpts>;\r\n}\r\n\r\n/** Certa configuration options. */\r\nexport interface CertaConfig {\r\n\r\n /** The absolute path to a JavaScript file containing all mocha tests to be run. */\r\n readonly testBundle: string;\r\n\r\n /**\r\n * An instanbul-instrumented version of the `testBundle`.\r\n * This will be used instead of `testBundle` when running with `cover` enabled.\r\n */\r\n readonly instrumentedTestBundle?: string;\r\n\r\n /**\r\n * The absolute path to a JavaScript module containing backend initialization logic.\r\n * This module will be required in Certa's \"main\" process ***before*** initializing a test runner.\r\n * If the file's `module.exports` is a Promise, that Promise will also be awaited before running tests.\r\n * The exported Promise may also optionally be resolved with a \"cleanup\" async callback, which will be executed _after_ running tests (not supported in electron).\r\n * @optional\r\n */\r\n readonly backendInitModule?: string;\r\n\r\n /**\r\n * Whether Certa should run in \"debug mode\".\r\n * When debug mode is enabled, chrome and electron windows will be visible and remote debugging is enabled.\r\n */\r\n readonly debug: boolean;\r\n\r\n /**\r\n * Whether Certa should measure code coverage.\r\n * NB: This is currently only supported by the chrome and node test runners.\r\n */\r\n readonly cover: boolean;\r\n\r\n /** Defines ports used by the chrome and electron test runners. */\r\n readonly ports: Readonly<CertaPortOpts>;\r\n\r\n /** Defines mocha options common to all test runners. */\r\n readonly mochaOptions: Readonly<CertaMochaOpts>;\r\n\r\n /** Defines options specific to the chrome test runner */\r\n readonly chromeOptions: Readonly<CertaChromeOpts>;\r\n}\r\n\r\nconst SECONDS = 1000;\r\nconst MINUTES = 60 * SECONDS;\r\n\r\nexport namespace CertaConfig {\r\n export const defaults = {\r\n debug: false,\r\n cover: false,\r\n ports: {\r\n debugging: 5858,\r\n frontend: 3000,\r\n frontendDebugging: 9223,\r\n },\r\n mochaOptions: {\r\n invert: false,\r\n timeout: 2 * MINUTES,\r\n reporter: \"spec\",\r\n },\r\n chromeOptions: {\r\n // NB: These should stay **empty** arrays, otherwise lodash.defaultsDeep will not merge them correctly.\r\n args: new Array<string>(),\r\n publicDirs: new Array<string>(),\r\n },\r\n };\r\n\r\n // List of config options that may be relative file paths and should be resolved to absolute paths.\r\n const _filePathOpts = [\r\n \"backendInitModule\",\r\n \"testBundle\",\r\n \"instrumentedTestBundle\",\r\n \"chromeOptions.publicDirs\",\r\n ];\r\n\r\n /**\r\n * Resolves all relative file paths in `opts` to absolute paths, starting from `baseDir`.\r\n * NB: This mutates `opts`.\r\n * @param baseDir The starting point for resolving relative paths.\r\n * @param opts A partial CertaConfig object.\r\n */\r\n function resolvePaths(baseDir: string, opts: PartialCertaConfig): void {\r\n for (const propPath of _filePathOpts) {\r\n const relativeFilePath = lodash.get(opts, propPath);\r\n if (relativeFilePath) {\r\n if (Array.isArray(relativeFilePath))\r\n lodash.set(opts, propPath, relativeFilePath.map((p) => path.resolve(baseDir, p)));\r\n else\r\n lodash.set(opts, propPath, path.resolve(baseDir, relativeFilePath));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a complete CertaConfig object by combining a partial config with default values.\r\n * All relative paths are resolved from the current working directory.\r\n * Throws if the `testBundle` option is undefined or invalid.\r\n * @param opts A partial CertaConfig object.\r\n */\r\n export function fromObject(opts: PartialCertaConfig): CertaConfig {\r\n const resolvedOpts = lodash.defaultsDeep(opts, defaults);\r\n resolvePaths(process.cwd(), resolvedOpts);\r\n\r\n if (!resolvedOpts.testBundle)\r\n throw new Error(\"The required testBundle option was not set.\");\r\n\r\n if (!fs.existsSync(resolvedOpts.testBundle))\r\n throw new Error(`The specified testBundle file \"${resolvedOpts.testBundle}\" does not exist.`);\r\n\r\n return resolvedOpts;\r\n }\r\n\r\n /**\r\n * Creates a complete CertaConfig object by loading options from a certa.json config file,\r\n * applying run-time overrides, then combining that with default values.\r\n * All relative paths specified in the config file are resolved from the config file directory.\r\n * All other relative paths (overrides or defaults) are resolved from the current working directory.\r\n * Throws if the `testBundle` option is undefined or invalid.\r\n * @param filePath The path to a certa.json config file.\r\n * @param overrides A partial CertaConfig object. These values will always override any options set in the config file.\r\n */\r\n export function fromConfigFile(filePath: string, overrides: PartialCertaConfig): CertaConfig {\r\n const fileContents = fs.readFileSync(filePath);\r\n const fileOpts = parse(fileContents.toString()); // Parsing with jsonc-parser lets us safely handle comments.\r\n resolvePaths(path.dirname(filePath), fileOpts);\r\n return fromObject(lodash.defaultsDeep(overrides, fileOpts));\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CertaCore.js","sourceRoot":"","sources":["../src/CertaCore.ts"],"names":[],"mappings":";;;AAqCA,sBA+BC;AApED;;;+FAG+F;AAC/F,8EAA2E;AAC3E,wEAAqE;AAErE,kEAA+D;AAC/D,yDAA4D;AAC5D,mDAAmD;AASnD,MAAa,SAAS;IACZ,MAAM,CAAC,QAAQ,GAA+C,EAAE,CAAC;IAElE,MAAM,CAAC,kBAAkB,CAAC,WAAmB,EAAE,MAAuB;QAC3E,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;IACtC,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,WAAmB;QAC7C,IAAI,WAAW,IAAI,IAAI,CAAC,QAAQ;YAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAEpC,MAAM,IAAI,KAAK,CAAC,wBAAwB,WAAW,GAAG,CAAC,CAAC;IAC1D,CAAC;;AAZH,8BAaC;AAED,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,+BAAc,CAAC,CAAC;AACrD,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE,mCAAgB,CAAC,CAAC;AACzD,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,uCAAkB,CAAC,CAAC;AAEtD,KAAK,UAAU,KAAK,CAAC,WAAmB,EAAE,MAAmB;IAClE,MAAM,MAAM,GAAG,SAAS,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAEpD,wHAAwH;IACxH,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC;IACvD,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,gBAAgB,IAAI,CAAC,YAAY;QAC1D,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,IAAA,mCAAmB,GAAE,CAAC,CAAC;IAEnD,IAAI,MAAM,CAAC,UAAU;QACnB,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAElC,gGAAgG;IAChG,IAAI,MAAM,CAAC,KAAK;QACd,IAAA,0BAAa,EAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAExC,gDAAgD;IAChD,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,EAAE,CAAC;IAExC;;;;OAIG;IACH,IAAI,eAA2D,CAAC;IAChE,IAAI,MAAM,CAAC,iBAAiB;QAC1B,eAAe,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAE5D,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE9B,IAAI,OAAO,eAAe,KAAK,UAAU,IAAI,MAAM,CAAC,eAAe;QACjE,MAAM,eAAe,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { ElectronTestRunner } from \"./runners/electron/ElectronTestRunner\";\nimport { ChromeTestRunner } from \"./runners/chrome/ChromeTestRunner\";\nimport { CertaConfig } from \"./CertaConfig\";\nimport { NodeTestRunner } from \"./runners/node/NodeTestRunner\";\nimport { relaunchForCoverage } from \"./utils/CoverageUtils\";\nimport { startDebugger } from \"./utils/SpawnUtils\";\n\nexport interface CertaTestRunner {\n readonly supportsCoverage: boolean;\n readonly supportsCleanup: boolean;\n initialize?(config: CertaConfig): Promise<void>;\n runTests(config: CertaConfig): Promise<void>;\n}\n\nexport class CertaCore {\n private static _runners: { [environment: string]: CertaTestRunner } = {};\n\n public static registerTestRunner(environment: string, runner: CertaTestRunner) {\n this._runners[environment] = runner;\n }\n\n public static getTestRunner(environment: string): CertaTestRunner {\n if (environment in this._runners)\n return this._runners[environment];\n\n throw new Error(`Unknown TestRunner: \"${environment}\"`);\n }\n}\n\nCertaCore.registerTestRunner(\"node\", NodeTestRunner);\nCertaCore.registerTestRunner(\"chrome\", ChromeTestRunner);\nCertaCore.registerTestRunner(\"electron\", ElectronTestRunner);\n\nexport async function certa(environment: string, config: CertaConfig): Promise<void> {\n const runner = CertaCore.getTestRunner(environment);\n\n // If we're going to measure code coverage, we should stop now and let an `nyc`-wrapped child process take it from here.\n const alreadyInNyc = process.env.NYC_CWD !== undefined;\n if (config.cover && runner.supportsCoverage && !alreadyInNyc)\n return process.exit(await relaunchForCoverage());\n\n if (runner.initialize)\n await runner.initialize(config);\n\n // In debug mode, we should now start listening for debugger connections (if we're not already).\n if (config.debug)\n startDebugger(config.ports.debugging);\n\n // Source map any errors in this backend process\n require(\"source-map-support\").install();\n\n /**\n * undefined if backendInitModule not specified;\n * callback if a cleanup function is returned by the backendInitModule export;\n * empty object if nothing is exported by the backendInitModule\n */\n let cleanUpCallback: undefined | (() => Promise<void>) | object;\n if (config.backendInitModule)\n cleanUpCallback = await require(config.backendInitModule);\n\n await runner.runTests(config);\n\n if (typeof cleanUpCallback === \"function\" && runner.supportsCleanup)\n await cleanUpCallback();\n}\n"]}
1
+ {"version":3,"file":"CertaCore.js","sourceRoot":"","sources":["../src/CertaCore.ts"],"names":[],"mappings":";;;AAqCA,sBA+BC;AApED;;;+FAG+F;AAC/F,8EAA2E;AAC3E,wEAAqE;AAErE,kEAA+D;AAC/D,yDAA4D;AAC5D,mDAAmD;AASnD,MAAa,SAAS;IACZ,MAAM,CAAC,QAAQ,GAA+C,EAAE,CAAC;IAElE,MAAM,CAAC,kBAAkB,CAAC,WAAmB,EAAE,MAAuB;QAC3E,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;IACtC,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,WAAmB;QAC7C,IAAI,WAAW,IAAI,IAAI,C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AAe;QACjE,MAAM,eAAe,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { ElectronTestRunner } from \"./runners/electron/ElectronTestRunner\";\r\nimport { ChromeTestRunner } from \"./runners/chrome/ChromeTestRunner\";\r\nimport { CertaConfig } from \"./CertaConfig\";\r\nimport { NodeTestRunner } from \"./runners/node/NodeTestRunner\";\r\nimport { relaunchForCoverage } from \"./utils/CoverageUtils\";\r\nimport { startDebugger } from \"./utils/SpawnUtils\";\r\n\r\nexport interface CertaTestRunner {\r\n readonly supportsCoverage: boolean;\r\n readonly supportsCleanup: boolean;\r\n initialize?(config: CertaConfig): Promise<void>;\r\n runTests(config: CertaConfig): Promise<void>;\r\n}\r\n\r\nexport class CertaCore {\r\n private static _runners: { [environment: string]: CertaTestRunner } = {};\r\n\r\n public static registerTestRunner(environment: string, runner: CertaTestRunner) {\r\n this._runners[environment] = runner;\r\n }\r\n\r\n public static getTestRunner(environment: string): CertaTestRunner {\r\n if (environment in this._runners)\r\n return this._runners[environment];\r\n\r\n throw new Error(`Unknown TestRunner: \"${environment}\"`);\r\n }\r\n}\r\n\r\nCertaCore.registerTestRunner(\"node\", NodeTestRunner);\r\nCertaCore.registerTestRunner(\"chrome\", ChromeTestRunner);\r\nCertaCore.registerTestRunner(\"electron\", ElectronTestRunner);\r\n\r\nexport async function certa(environment: string, config: CertaConfig): Promise<void> {\r\n const runner = CertaCore.getTestRunner(environment);\r\n\r\n // If we're going to measure code coverage, we should stop now and let an `nyc`-wrapped child process take it from here.\r\n const alreadyInNyc = process.env.NYC_CWD !== undefined;\r\n if (config.cover && runner.supportsCoverage && !alreadyInNyc)\r\n return process.exit(await relaunchForCoverage());\r\n\r\n if (runner.initialize)\r\n await runner.initialize(config);\r\n\r\n // In debug mode, we should now start listening for debugger connections (if we're not already).\r\n if (config.debug)\r\n startDebugger(config.ports.debugging);\r\n\r\n // Source map any errors in this backend process\r\n require(\"source-map-support\").install();\r\n\r\n /**\r\n * undefined if backendInitModule not specified;\r\n * callback if a cleanup function is returned by the backendInitModule export;\r\n * empty object if nothing is exported by the backendInitModule\r\n */\r\n let cleanUpCallback: undefined | (() => Promise<void>) | object;\r\n if (config.backendInitModule)\r\n cleanUpCallback = await require(config.backendInitModule);\r\n\r\n await runner.runTests(config);\r\n\r\n if (typeof cleanUpCallback === \"function\" && runner.supportsCleanup)\r\n await cleanUpCallback();\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChromeTestRunner.js","sourceRoot":"","sources":["../../../src/runners/chrome/ChromeTestRunner.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,6BAA6B;AAC7B,2CAAoE;AAEpE,uDAA2D;AAC3D,6DAAsE;AAEtE,6DAA8D;AAC9D,+DAAgE;AAShE,IAAI,OAAgB,CAAC;AACrB,IAAI,gBAA8B,CAAC;AAEnC,MAAa,gBAAgB;IACpB,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IACxC,MAAM,CAAU,eAAe,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAmB;QAChD,mIAAmI;QACnI,MAAM,OAAO,GAAkB;YAC7B,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,IAAI;YAC/B,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK;SACxB,CAAC;QAEF,IAAI,MAAM,CAAC,KAAK;YACd,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,2BAA2B,MAAM,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAEnG,OAAO,GAAG,MAAM,qBAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEzC,MAAM,YAAY,GAAG;YACnB,UAAU,EAAE,GAAG,MAAM,CAAC,KAAK,CAA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C;YACpC,MAAM,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC;YACpE,MAAM,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAEnC,yBAAyB;YACzB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;gBAC7B,uDAAuD;gBACvD,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,GAAG,IAAW,CAAC;gBACzC,MAAM,OAAO,GAAG,MAAa,CAAC;gBAC9B,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;oBACrB,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;oBACtC,OAAO,CAAC,mBAAmB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,8BAA8B;gBACrF,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,sEAAsE;QACvF,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as path from \"path\";\nimport { Browser, chromium, LaunchOptions, Page } from \"playwright\";\nimport { ChildProcess } from \"child_process\";\nimport { spawnChildProcess } from \"../../utils/SpawnUtils\";\nimport { executeRegisteredCallback } from \"../../utils/CallbackUtils\";\nimport { CertaConfig } from \"../../CertaConfig\";\nimport { writeCoverageData } from \"../../utils/CoverageUtils\";\nimport { configureRemoteReporter } from \"./MochaRemoteReporter\";\n\ninterface ChromeTestResults {\n failures: number;\n coverage: any;\n}\n\ntype ConsoleMethodName = \"log\" | \"error\" | \"dir\";\n\nlet browser: Browser;\nlet webserverProcess: ChildProcess;\n\nexport class ChromeTestRunner {\n public static readonly supportsCoverage = true;\n public static readonly supportsCleanup = true;\n public static async initialize(config: CertaConfig): Promise<void> {\n // Go ahead and launch playwright now - the VS Code debugger gets confused if it can't at least see the chrome instance right away.\n const options: LaunchOptions = {\n args: config.chromeOptions.args,\n headless: !config.debug,\n };\n\n if (config.debug)\n options.args?.push(`--disable-gpu`, `--remote-debugging-port=${config.ports.frontendDebugging}`);\n\n browser = await chromium.launch(options);\n\n const webserverEnv = {\n CERTA_PORT: `${config.ports.frontend}`, // eslint-disable-line @typescript-eslint/naming-convention\n CERTA_PATH: path.join(__dirname, \"../../../public/index.html\"), // eslint-disable-line @typescript-eslint/naming-convention\n CERTA_PUBLIC_DIRS: JSON.stringify(config.chromeOptions.publicDirs), // eslint-disable-line @typescript-eslint/naming-convention\n };\n webserverProcess = spawnChildProcess(\"node\", [require.resolve(\"./webserver\")], webserverEnv, true);\n\n // Don't continue until the webserver is started and listening.\n const webserverExited = new Promise<never>((_resolve, reject) => webserverProcess.once(\"exit\", () => reject(new Error(\"Webserver exited!\"))));\n const webserverStarted = new Promise<number>((resolve) => webserverProcess.once(\"message\", resolve));\n const actualPort = await Promise.race([webserverExited, webserverStarted]);\n if (actualPort !== config.ports.frontend)\n console.warn(`CERTA: Port ${config.ports.frontend} was already in use, so serving test resources on port ${actualPort}`);\n process.env.CERTA_PORT = String(actualPort);\n }\n\n public static async runTests(config: CertaConfig): Promise<void> {\n // FIXME: Do we really want to always enforce this behavior?\n if (process.env.CI || process.env.TF_BUILD)\n (config.mochaOptions as any).forbidOnly = true;\n\n const { failures, coverage } = await runTestsInPlaywright(config, process.env.CERTA_PORT!);\n webserverProcess.kill();\n\n // Save nyc/istanbul coverage file.\n if (config.cover)\n writeCoverageData(coverage);\n\n process.exitCode = failures;\n (process as any).emit(\"chrome-test-runner-done\");\n }\n}\n\nasync function loadScript(page: Page, scriptPath: string) {\n return page.addScriptTag({ url: `/@/${scriptPath}` });\n}\n\nasync function runTestsInPlaywright(config: CertaConfig, port: string) {\n return new Promise<ChromeTestResults>(async (resolve, reject) => {\n try {\n const page = browser.contexts().pop()?.pages()?.pop() || await browser.newPage();\n\n // Don't let dialogs block tests\n page.on(\"dialog\", async (dialog: any) => dialog.dismiss());\n\n // Re-throw any uncaught exceptions from the frontend in the backend\n page.on(\"pageerror\", async (error) => {\n await browser.close();\n reject(error);\n });\n\n // Expose some functions to the frontend that will execute _in the backend context_\n await page.exposeFunction(\"_CertaConsole\", (type: ConsoleMethodName, args: any[]) => console[type](...args));\n await page.exposeFunction(\"_CertaSendToBackend\", executeRegisteredCallback);\n await page.exposeFunction(\"_CertaReportResults\", (results: ChromeTestResults) => {\n setTimeout(async () => {\n await browser.close();\n resolve(results);\n });\n });\n\n // Now load the page (and requisite scripts)...\n const testBundle = (config.cover && config.instrumentedTestBundle) || config.testBundle;\n await page.goto(`http://localhost:${port}`);\n await page.addScriptTag({ content: `var _CERTA_CONFIG = ${JSON.stringify(config)};` });\n await loadScript(page, require.resolve(\"../../utils/initLogging.js\"));\n await loadScript(page, require.resolve(\"mocha/mocha.js\"));\n await loadScript(page, require.resolve(\"source-map-support/browser-source-map-support.js\"));\n await loadScript(page, require.resolve(\"../../utils/initSourceMaps.js\"));\n await loadScript(page, require.resolve(\"./MochaSerializer.js\"));\n await configureRemoteReporter(page);\n await loadScript(page, require.resolve(\"../../utils/initMocha.js\"));\n await loadScript(page, testBundle);\n\n // ...and start the tests\n await page.evaluate(async () => {\n // NB: This is being evaluated in the frontend context!\n Mocha.reporters.Base.color = true as any;\n const globals = window as any;\n mocha.run((failures) => {\n const coverage = globals.__coverage__;\n globals._CertaReportResults({ failures, coverage }); // This will close the browser\n });\n });\n } catch (error) {\n await browser.close();\n reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\n }\n });\n}\n"]}
1
+ {"version":3,"file":"ChromeTestRunner.js","sourceRoot":"","sources":["../../../src/runners/chrome/ChromeTest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AAC,mBAAmB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,8BAA8B;gBACrF,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,sEAAsE;QACvF,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as path from \"path\";\r\nimport { Browser, chromium, LaunchOptions, Page } from \"playwright\";\r\nimport { ChildProcess } from \"child_process\";\r\nimport { spawnChildProcess } from \"../../utils/SpawnUtils\";\r\nimport { executeRegisteredCallback } from \"../../utils/CallbackUtils\";\r\nimport { CertaConfig } from \"../../CertaConfig\";\r\nimport { writeCoverageData } from \"../../utils/CoverageUtils\";\r\nimport { configureRemoteReporter } from \"./MochaRemoteReporter\";\r\n\r\ninterface ChromeTestResults {\r\n failures: number;\r\n coverage: any;\r\n}\r\n\r\ntype ConsoleMethodName = \"log\" | \"error\" | \"dir\";\r\n\r\nlet browser: Browser;\r\nlet webserverProcess: ChildProcess;\r\n\r\nexport class ChromeTestRunner {\r\n public static readonly supportsCoverage = true;\r\n public static readonly supportsCleanup = true;\r\n public static async initialize(config: CertaConfig): Promise<void> {\r\n // Go ahead and launch playwright now - the VS Code debugger gets confused if it can't at least see the chrome instance right away.\r\n const options: LaunchOptions = {\r\n args: config.chromeOptions.args,\r\n headless: !config.debug,\r\n };\r\n\r\n if (config.debug)\r\n options.args?.push(`--disable-gpu`, `--remote-debugging-port=${config.ports.frontendDebugging}`);\r\n\r\n browser = await chromium.launch(options);\r\n\r\n const webserverEnv = {\r\n CERTA_PORT: `${config.ports.frontend}`, // eslint-disable-line @typescript-eslint/naming-convention\r\n CERTA_PATH: path.join(__dirname, \"../../../public/index.html\"), // eslint-disable-line @typescript-eslint/naming-convention\r\n CERTA_PUBLIC_DIRS: JSON.stringify(config.chromeOptions.publicDirs), // eslint-disable-line @typescript-eslint/naming-convention\r\n };\r\n webserverProcess = spawnChildProcess(\"node\", [require.resolve(\"./webserver\")], webserverEnv, true);\r\n\r\n // Don't continue until the webserver is started and listening.\r\n const webserverExited = new Promise<never>((_resolve, reject) => webserverProcess.once(\"exit\", () => reject(new Error(\"Webserver exited!\"))));\r\n const webserverStarted = new Promise<number>((resolve) => webserverProcess.once(\"message\", resolve));\r\n const actualPort = await Promise.race([webserverExited, webserverStarted]);\r\n if (actualPort !== config.ports.frontend)\r\n console.warn(`CERTA: Port ${config.ports.frontend} was already in use, so serving test resources on port ${actualPort}`);\r\n process.env.CERTA_PORT = String(actualPort);\r\n }\r\n\r\n public static async runTests(config: CertaConfig): Promise<void> {\r\n // FIXME: Do we really want to always enforce this behavior?\r\n if (process.env.CI || process.env.TF_BUILD)\r\n (config.mochaOptions as any).forbidOnly = true;\r\n\r\n const { failures, coverage } = await runTestsInPlaywright(config, process.env.CERTA_PORT!);\r\n webserverProcess.kill();\r\n\r\n // Save nyc/istanbul coverage file.\r\n if (config.cover)\r\n writeCoverageData(coverage);\r\n\r\n process.exitCode = failures;\r\n (process as any).emit(\"chrome-test-runner-done\");\r\n }\r\n}\r\n\r\nasync function loadScript(page: Page, scriptPath: string) {\r\n return page.addScriptTag({ url: `/@/${scriptPath}` });\r\n}\r\n\r\nasync function runTestsInPlaywright(config: CertaConfig, port: string) {\r\n return new Promise<ChromeTestResults>(async (resolve, reject) => {\r\n try {\r\n const page = browser.contexts().pop()?.pages()?.pop() || await browser.newPage();\r\n\r\n // Don't let dialogs block tests\r\n page.on(\"dialog\", async (dialog: any) => dialog.dismiss());\r\n\r\n // Re-throw any uncaught exceptions from the frontend in the backend\r\n page.on(\"pageerror\", async (error) => {\r\n await browser.close();\r\n reject(error);\r\n });\r\n\r\n // Expose some functions to the frontend that will execute _in the backend context_\r\n await page.exposeFunction(\"_CertaConsole\", (type: ConsoleMethodName, args: any[]) => console[type](...args));\r\n await page.exposeFunction(\"_CertaSendToBackend\", executeRegisteredCallback);\r\n await page.exposeFunction(\"_CertaReportResults\", (results: ChromeTestResults) => {\r\n setTimeout(async () => {\r\n await browser.close();\r\n resolve(results);\r\n });\r\n });\r\n\r\n // Now load the page (and requisite scripts)...\r\n const testBundle = (config.cover && config.instrumentedTestBundle) || config.testBundle;\r\n await page.goto(`http://localhost:${port}`);\r\n await page.addScriptTag({ content: `var _CERTA_CONFIG = ${JSON.stringify(config)};` });\r\n await loadScript(page, require.resolve(\"../../utils/initLogging.js\"));\r\n await loadScript(page, require.resolve(\"mocha/mocha.js\"));\r\n await loadScript(page, require.resolve(\"source-map-support/browser-source-map-support.js\"));\r\n await loadScript(page, require.resolve(\"../../utils/initSourceMaps.js\"));\r\n await loadScript(page, require.resolve(\"./MochaSerializer.js\"));\r\n await configureRemoteReporter(page);\r\n await loadScript(page, require.resolve(\"../../utils/initMocha.js\"));\r\n await loadScript(page, testBundle);\r\n\r\n // ...and start the tests\r\n await page.evaluate(async () => {\r\n // NB: This is being evaluated in the frontend context!\r\n Mocha.reporters.Base.color = true as any;\r\n const globals = window as any;\r\n mocha.run((failures) => {\r\n const coverage = globals.__coverage__;\r\n globals._CertaReportResults({ failures, coverage }); // This will close the browser\r\n });\r\n });\r\n } catch (error) {\r\n await browser.close();\r\n reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\r\n }\r\n });\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MochaRemoteReporter.js","sourceRoot":"","sources":["../../../src/runners/chrome/MochaRemoteReporter.ts"],"names":[],"mappings":";;AASA,0DAkDC;AA3DD;;;+FAG+F;AAC/F,mCAAsC;AAEtC,6BAA2B;AAGpB,KAAK,UAAU,uBAAuB,CAAC,IAAU;IACtD,0D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AQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5C,KAAK,CAAC,QAAQ,GAAG,CAAC,YAAoB,EAAE,eAAoB,EAAE,EAAE;gBAC9D,uEAAuE;gBACvE,MAAM,cAAc;oBAClB,YAAY,MAAoB,EAAE,QAAa;wBAC7C,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;wBACzH,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;4BAC3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;gCAClC,MAAM,CAAC,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;4BACxG,CAAC,CAAC,CAAC;wBACL,CAAC;wBACD,MAAM,CAAC,oBAAoB,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;oBAChG,CAAC;iBACF;gBACD,OAAO,QAAQ,CAAC,cAA2C,CAAC,CAAC;YAC/D,CAAC,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { EventEmitter } from \"events\";\nimport { Page } from \"playwright\";\nimport \"./MochaSerializer\";\ndeclare const window: any;\n\nexport async function configureRemoteReporter(page: Page) {\n // This will stand in for mocha's \"runner\" on the backend.\n // Basically, we'll just be using this to echo events from the frontend runner.\n const mockRunner = new EventEmitter();\n let realReporter: any;\n\n // Expose a function to the frontend for initializing the reporter on the backend.\n await page.exposeFunction(\"_CertaCreateReporter\", (serializedRunner: string, reporterName: string, reporterOptions: any) => {\n const runner = MochaSerializer.deserialize(serializedRunner);\n\n // Reporters will use these methods to register event handlers.\n // Since `runner` has been marshalled via JSON, they don't already exist.\n runner.on = mockRunner.on.bind(mockRunner);\n runner.once = mockRunner.once.bind(mockRunner);\n\n // Mocha already knows how to find and construct a reporter object from a reporterName,\n // so we can just leverage that instead of having to re-implement it all.\n const backendMocha = new (require(\"mocha\"))();\n backendMocha.reporter(reporterName);\n\n // Mocha.reporter saves the reporter constructor in this._reporter.\n realReporter = new backendMocha._reporter(runner, { reporterOptions });\n });\n\n // Expose a function to the frontend for initializing the reporter on the backend.\n await page.exposeFunction(\"_CertaEmitReporterEvent\", (name: string, stats: any, ...args: any[]) => {\n realReporter.stats = stats;\n mockRunner.emit(name, ...args.map((a) => MochaSerializer.deserialize(a)));\n });\n\n await page.evaluate(() => {\n (() => {\n const original = mocha.reporter.bind(mocha);\n mocha.reporter = (reporterName: string, reporterOptions: any) => {\n // A mocha reporter class that just forwards all events to the backend.\n class RemoteReporter {\n constructor(runner: Mocha.Runner, _options: any) {\n const events = [\"start\", \"end\", \"suite\", \"suite end\", \"test\", \"test end\", \"hook\", \"hook end\", \"pass\", \"fail\", \"pending\"];\n for (const event of events) {\n runner.on(event, (...args: any[]) => {\n window._CertaEmitReporterEvent(event, runner.stats, ...args.map((a) => MochaSerializer.serialize(a)));\n });\n }\n window._CertaCreateReporter(MochaSerializer.serialize(runner), reporterName, reporterOptions);\n }\n }\n return original(RemoteReporter as Mocha.ReporterConstructor);\n };\n })();\n });\n}\n"]}
1
+ {"version":3,"file":"MochaRemoteReporter.js","sourceRoot":"","sources":["../../../src/runners/chrome/MochaRemoteReporter.ts"],"names":[],"mappings":";;AASA,0DAkDC;AA3DD;;;+FAG+F;AAC/F,mCAAsC;AAEtC,6BAA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GAAG,EAAE;YACJ,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5C,KAAK,CAAC,QAAQ,GAAG,CAAC,YAAoB,EAAE,eAAoB,EAAE,EAAE;gBAC9D,uEAAuE;gBACvE,MAAM,cAAc;oBAClB,YAAY,MAAoB,EAAE,QAAa;wBAC7C,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;wBACzH,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;4BAC3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;gCAClC,MAAM,CAAC,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;4BACxG,CAAC,CAAC,CAAC;wBACL,CAAC;wBACD,MAAM,CAAC,oBAAoB,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;oBAChG,CAAC;iBACF;gBACD,OAAO,QAAQ,CAAC,cAA2C,CAAC,CAAC;YAC/D,CAAC,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { EventEmitter } from \"events\";\r\nimport { Page } from \"playwright\";\r\nimport \"./MochaSerializer\";\r\ndeclare const window: any;\r\n\r\nexport async function configureRemoteReporter(page: Page) {\r\n // This will stand in for mocha's \"runner\" on the backend.\r\n // Basically, we'll just be using this to echo events from the frontend runner.\r\n const mockRunner = new EventEmitter();\r\n let realReporter: any;\r\n\r\n // Expose a function to the frontend for initializing the reporter on the backend.\r\n await page.exposeFunction(\"_CertaCreateReporter\", (serializedRunner: string, reporterName: string, reporterOptions: any) => {\r\n const runner = MochaSerializer.deserialize(serializedRunner);\r\n\r\n // Reporters will use these methods to register event handlers.\r\n // Since `runner` has been marshalled via JSON, they don't already exist.\r\n runner.on = mockRunner.on.bind(mockRunner);\r\n runner.once = mockRunner.once.bind(mockRunner);\r\n\r\n // Mocha already knows how to find and construct a reporter object from a reporterName,\r\n // so we can just leverage that instead of having to re-implement it all.\r\n const backendMocha = new (require(\"mocha\"))();\r\n backendMocha.reporter(reporterName);\r\n\r\n // Mocha.reporter saves the reporter constructor in this._reporter.\r\n realReporter = new backendMocha._reporter(runner, { reporterOptions });\r\n });\r\n\r\n // Expose a function to the frontend for initializing the reporter on the backend.\r\n await page.exposeFunction(\"_CertaEmitReporterEvent\", (name: string, stats: any, ...args: any[]) => {\r\n realReporter.stats = stats;\r\n mockRunner.emit(name, ...args.map((a) => MochaSerializer.deserialize(a)));\r\n });\r\n\r\n await page.evaluate(() => {\r\n (() => {\r\n const original = mocha.reporter.bind(mocha);\r\n mocha.reporter = (reporterName: string, reporterOptions: any) => {\r\n // A mocha reporter class that just forwards all events to the backend.\r\n class RemoteReporter {\r\n constructor(runner: Mocha.Runner, _options: any) {\r\n const events = [\"start\", \"end\", \"suite\", \"suite end\", \"test\", \"test end\", \"hook\", \"hook end\", \"pass\", \"fail\", \"pending\"];\r\n for (const event of events) {\r\n runner.on(event, (...args: any[]) => {\r\n window._CertaEmitReporterEvent(event, runner.stats, ...args.map((a) => MochaSerializer.serialize(a)));\r\n });\r\n }\r\n window._CertaCreateReporter(MochaSerializer.serialize(runner), reporterName, reporterOptions);\r\n }\r\n }\r\n return original(RemoteReporter as Mocha.ReporterConstructor);\r\n };\r\n })();\r\n });\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MochaSerializer.js","sourceRoot":"","sources":["../../../src/runners/chrome/MochaSerializer.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,iHAAiH;AAKjH;;;;;;;;;;;GAWG;AACH,MAAM,eAAe;IACX,MAAM,CAAC,SAAS,GAAe,EAAE,CAAC;IAEnC,MAAM,CAAC,YAAY,CAAC,GAAa,EAAE,SAAkB;QAC1D,IAAI,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1C,gIAAgI;QAChI,6IAA6I;QAC7I,IAAI,UAAkB,CAAC;QACvB,IAAI,GAAG,YAAY,KAAK,CAAC,KAAK;YAC5B,UAAU,GAAG,OAAO,CAAC;aAClB,IAAI,GAAG,YAAY,KAAK,CAAC,IAAI;YAChC,UAAU,GAAG,MAAM,CAAC;aACjB,IAAI,GAAG,YAAY,KAAK,CAAC,IAAI;YAChC,UAAU,GAAG,MAAM,CAAC;;YAEpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAElD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACvC,oEAAoE;YACpE,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC;QAED,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IACjF,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,SAAS,CAAC,IAAS;QAC/B,MAAM,UAAU,GAAG,CAAC,GAAQ,EAAmB,EAAE,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,QAAQ,IAAI,GAAG,YAAY,KAAK,CA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gB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;gBACxC,CAAC;gBACD,OAAO,QAAQ,CAAC;YAClB,CAAC;YAED,mHAAmH;YACnH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;YAC3E,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;;AAGH,IAAI,OAAO,MAAM,KAAK,WAAW;IAC9B,MAAc,CAAC,eAAe,GAAG,eAAe,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// NB: This file is not a CommonJs module - it needs to run in the browser. Do not import or export modules here!\n\n// Object types we need to handle specially when serializing/deserializing\ntype MochaObj = Mocha.Runnable | Mocha.Suite;\n\n/**\n * Helper for marshalling certain mocha objects between frontend and backend processes.\n *\n * Normally, playwright automatically uses JSON to serialize and deserialize arguments to backend functions exposed via `page.exposeFunction()`.\n * However, we face two problems when trying to pass `Mocha.Runnable` and `Mocha.Suite` instances to the backend:\n * - These objects have circular references\n * - JSON round-tripping won't preserve these objects' prototypes, and thus will be missing methods that reporters rely on.\n *\n * This class attempts to solve this by replacing all instances of these classes with \"handles\" that simply refer to their\n * index in a central \"registry\" array. Because we serialize and deserialize in the same order, we can re-create this \"registry\"\n * on the backend as we deserialize.\n */\nclass MochaSerializer {\n private static _registry: MochaObj[] = [];\n\n public static createHandle(raw: MochaObj, isPrimary: boolean) {\n let $$index = this._registry.indexOf(raw);\n // Browser side of mocha is webpacked so the constructor name has an added suffix for example `Test` is converted into `Test$4`.\n // This is not the case is node side of mocha, so an error is thrown because of this mismatch. The `.replace()` is there to strip that suffix\n let $$typeName: string;\n if (raw instanceof Mocha.Suite)\n $$typeName = \"Suite\";\n else if (raw instanceof Mocha.Test)\n $$typeName = \"Test\";\n else if (raw instanceof Mocha.Hook)\n $$typeName = \"Hook\";\n else\n throw new Error(\"Unexpected instance of Mocha\");\n\n if ($$index < 0) {\n $$index = this._registry.push(raw) - 1;\n // This is a new instance, so we also need to include its properties\n isPrimary = true;\n }\n\n return (isPrimary) ? { $$index, $$typeName, ...raw } : { $$index, $$typeName };\n }\n\n /**\n * (On the frontend) Serializes a value to JSON string, recursively replacing any MochaObjs with appropriate handles\n * TODO: There are ***surely*** more performant ways to do this...\n *\n * @param root The root object to serialize. If this is a MochaObj, it will always include all\n * properties (even if it should already exist in the backend's registry).\n */\n public static serialize(root: any) {\n const isMochaObj = (obj: any): obj is MochaObj => (obj instanceof Mocha.Runnable || obj instanceof Mocha.Suite);\n\n const replacer = (key: string, value: any): any => {\n // Some pretty important properties of Errors are not enumerable, so we need to special handle them here:\n if (value instanceof Error)\n return { ...value, name: value.name, message: value.message, stack: value.stack };\n\n if (key === \"\" || !isMochaObj(value))\n return value;\n\n return JSON.parse(JSON.stringify(this.createHandle(value, false), replacer));\n };\n\n return JSON.stringify(isMochaObj(root) ? this.createHandle(root, true) : root, replacer);\n }\n\n /**\n * (On the backend) Deserializes a JSON string, replacing any MochaObj handles with their corresponding instances.\n * The first time we encounter a given instance's handle, we'll transform that handle object to serve as the actual instance on the backend.\n */\n public static deserialize(txt: string): any {\n return JSON.parse(txt, (_key, value) => {\n // We only need to special-case our \"handle\" objects, and we'll assume anything with `$$index` fits the bill.\n if (typeof value !== \"object\" || value === null || typeof value.$$index !== \"number\")\n return value;\n\n // Try to lookup this handle's instance in our registry\n const existing = this._registry[value.$$index];\n if (existing) {\n // Update property values (in case they've changed)\n for (const name of Object.getOwnPropertyNames(value)) {\n (existing as any)[name] = value[name];\n }\n return existing;\n }\n\n // Set the prototype and add the handle to the registry - we can now treat this as (essentially) the real instance.\n Object.setPrototypeOf(value, require(\"mocha\")[value.$$typeName].prototype);\n this._registry[value.$$index] = value;\n return value;\n });\n }\n}\n\nif (typeof global !== \"undefined\")\n (global as any).MochaSerializer = MochaSerializer;\n"]}
1
+ {"version":3,"file":"MochaSerializer.js","sourceRoot":"","sources":["../../../src/runners/chrome/MochaSerializer.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,iHAAiH;AAKjH;;;;;;;;;;;GAWG;AACH,MAAM,eAAe;IACX,MAAM,CAAC,SAAS,GAAe,EAAE,CAAC;IAEnC,MAAM,CAAC,YAAY,CAAC,GAAa,EAAE,SAAkB;QAC1D,IAAI,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1C,gIAAgI;QAChI,6IAA6I;QAC7I,IAAI,UAAkB,CAAC;QACvB,IAAI,GAAG,YAAY,KAAK,CAAC,KAAK;YAC5B,UAAU,GAAG,OAAO,CAAC;aAClB,IAAI,GAAG,YAAY,KAAK,CAAC,IAAI;YAChC,UAAU,GAAG,MAAM,CAAC;aACjB,IAAI,GAAG,YAAY,KAAK,CAAC,IAAI;YAChC,UAAU,GAAG,MAAM,CAAC;;YAEpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAElD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACvC,oEAAoE;YACpE,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC;QAED,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IACjF,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,SAAS,CAAC,IAAS;QAC/B,MAAM,UAAU,GAAG,CAAC,GAAQ,EA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,MAAM,IAAI,IAAI,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;oBACpD,QAAgB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;gBACxC,CAAC;gBACD,OAAO,QAAQ,CAAC;YAClB,CAAC;YAED,mHAAmH;YACnH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;YAC3E,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;;AAGH,IAAI,OAAO,MAAM,KAAK,WAAW;IAC9B,MAAc,CAAC,eAAe,GAAG,eAAe,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// NB: This file is not a CommonJs module - it needs to run in the browser. Do not import or export modules here!\r\n\r\n// Object types we need to handle specially when serializing/deserializing\r\ntype MochaObj = Mocha.Runnable | Mocha.Suite;\r\n\r\n/**\r\n * Helper for marshalling certain mocha objects between frontend and backend processes.\r\n *\r\n * Normally, playwright automatically uses JSON to serialize and deserialize arguments to backend functions exposed via `page.exposeFunction()`.\r\n * However, we face two problems when trying to pass `Mocha.Runnable` and `Mocha.Suite` instances to the backend:\r\n * - These objects have circular references\r\n * - JSON round-tripping won't preserve these objects' prototypes, and thus will be missing methods that reporters rely on.\r\n *\r\n * This class attempts to solve this by replacing all instances of these classes with \"handles\" that simply refer to their\r\n * index in a central \"registry\" array. Because we serialize and deserialize in the same order, we can re-create this \"registry\"\r\n * on the backend as we deserialize.\r\n */\r\nclass MochaSerializer {\r\n private static _registry: MochaObj[] = [];\r\n\r\n public static createHandle(raw: MochaObj, isPrimary: boolean) {\r\n let $$index = this._registry.indexOf(raw);\r\n // Browser side of mocha is webpacked so the constructor name has an added suffix for example `Test` is converted into `Test$4`.\r\n // This is not the case is node side of mocha, so an error is thrown because of this mismatch. The `.replace()` is there to strip that suffix\r\n let $$typeName: string;\r\n if (raw instanceof Mocha.Suite)\r\n $$typeName = \"Suite\";\r\n else if (raw instanceof Mocha.Test)\r\n $$typeName = \"Test\";\r\n else if (raw instanceof Mocha.Hook)\r\n $$typeName = \"Hook\";\r\n else\r\n throw new Error(\"Unexpected instance of Mocha\");\r\n\r\n if ($$index < 0) {\r\n $$index = this._registry.push(raw) - 1;\r\n // This is a new instance, so we also need to include its properties\r\n isPrimary = true;\r\n }\r\n\r\n return (isPrimary) ? { $$index, $$typeName, ...raw } : { $$index, $$typeName };\r\n }\r\n\r\n /**\r\n * (On the frontend) Serializes a value to JSON string, recursively replacing any MochaObjs with appropriate handles\r\n * TODO: There are ***surely*** more performant ways to do this...\r\n *\r\n * @param root The root object to serialize. If this is a MochaObj, it will always include all\r\n * properties (even if it should already exist in the backend's registry).\r\n */\r\n public static serialize(root: any) {\r\n const isMochaObj = (obj: any): obj is MochaObj => (obj instanceof Mocha.Runnable || obj instanceof Mocha.Suite);\r\n\r\n const replacer = (key: string, value: any): any => {\r\n // Some pretty important properties of Errors are not enumerable, so we need to special handle them here:\r\n if (value instanceof Error)\r\n return { ...value, name: value.name, message: value.message, stack: value.stack };\r\n\r\n if (key === \"\" || !isMochaObj(value))\r\n return value;\r\n\r\n return JSON.parse(JSON.stringify(this.createHandle(value, false), replacer));\r\n };\r\n\r\n return JSON.stringify(isMochaObj(root) ? this.createHandle(root, true) : root, replacer);\r\n }\r\n\r\n /**\r\n * (On the backend) Deserializes a JSON string, replacing any MochaObj handles with their corresponding instances.\r\n * The first time we encounter a given instance's handle, we'll transform that handle object to serve as the actual instance on the backend.\r\n */\r\n public static deserialize(txt: string): any {\r\n return JSON.parse(txt, (_key, value) => {\r\n // We only need to special-case our \"handle\" objects, and we'll assume anything with `$$index` fits the bill.\r\n if (typeof value !== \"object\" || value === null || typeof value.$$index !== \"number\")\r\n return value;\r\n\r\n // Try to lookup this handle's instance in our registry\r\n const existing = this._registry[value.$$index];\r\n if (existing) {\r\n // Update property values (in case they've changed)\r\n for (const name of Object.getOwnPropertyNames(value)) {\r\n (existing as any)[name] = value[name];\r\n }\r\n return existing;\r\n }\r\n\r\n // Set the prototype and add the handle to the registry - we can now treat this as (essentially) the real instance.\r\n Object.setPrototypeOf(value, require(\"mocha\")[value.$$typeName].prototype);\r\n this._registry[value.$$index] = value;\r\n return value;\r\n });\r\n }\r\n}\r\n\r\nif (typeof global !== \"undefined\")\r\n (global as any).MochaSerializer = MochaSerializer;\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"webserver.js","sourceRoot":"","sources":["../../../src/runners/chrome/webserver.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,sCAAsC;AACtC,mCAAmC;AACnC,6BAA6B;AAC7B,6BAA6B;AAE7B,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AAEtB,2BAA2B;AAC3B,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IAChC,GAAG,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;IAC/C,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC;IACjE,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,qLAAqL,CAAC,CAAC;IAClO,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC;AAEH,6FAA6F;AAC7F,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAC/B,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG;QAClB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAW,CA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AC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,oBAAoB;AACpB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as detect from \"detect-port\";\nimport * as express from \"express\";\nimport * as http from \"http\";\nimport * as path from \"path\";\n\nconst app = express();\n\n// Enable CORS for all apis\napp.all(\"/*\", (_req, res, next) => {\n res.header(\"Access-Control-Allow-Origin\", \"*\");\n res.header(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS\");\n res.header(\"Access-Control-Allow-Headers\", \"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id, X-Protocol-Version\");\n next();\n});\n\n// The generated HTML file should be served at the \"root\" URL (i.e., http://localhost:3000/).\napp.use(\"/\", (req, resp, next) => {\n if (req.path === \"/\")\n resp.sendFile(process.env.CERTA_PATH!);\n else\n next();\n});\n\n// Handle a special route for serving absolute paths and files from node_modules\napp.use(\"/@/\", (_req, resp) => {\n const filePath = _req.originalUrl.replace(/^\\/@\\//, \"\");\n const canonicalPath = require(\"canonical-path\");\n const sourceMap = require(\"source-map-support\").retrieveSourceMap(filePath);\n const fullPath = path.resolve(\"/\", filePath);\n resp.sendFile(canonicalPath.normalize(fullPath), {\n headers: (sourceMap) && {\n \"X-SourceMap\": `/@/${sourceMap.url}`,\n },\n });\n});\n\n// Serve static assets from any configured \"public\" directories\nconst publicDirs: string[] = JSON.parse(process.env.CERTA_PUBLIC_DIRS || \"[]\");\nfor (const publicDir of publicDirs) {\n app.use(express.static(publicDir));\n}\n\n// All other routes should log a warning\nconst alreadyLogged = new Set<string>();\napp.use(\"*\", (req, resp) => {\n // Don't repeat these warnings if the same asset was requested multiple times.\n if (!alreadyLogged.has(req.originalUrl)) {\n console.warn(`WARNING: Tests attempted to load missing asset: \"${req.originalUrl}\"`);\n alreadyLogged.add(req.originalUrl);\n }\n resp.sendStatus(404);\n});\n\n// Once the server actually starts, we should log and send the actual port back to the parent process\nlet port = parseInt(process.env.CERTA_PORT ?? \"3000\", 10);\nconst server = http.createServer(app);\nserver.on(\"listening\", async () => {\n console.log(`Certa web frontend now listening on port ${port}`);\n process.send!(port);\n});\n\n// The preferred port (process.env.CERTA_PORT) may be in use. If that happens detect a free port and try again.\n// Even though we detect a free port, there can still be race conditions when many certa processes run simultaneously.\n// Therefore, we'll retry up to 4 times with a new free port.\nconst maxRetries = 4;\nlet numRetries = 0;\nserver.on(\"error\", async (e: any) => {\n if (e.code !== \"EADDRINUSE\" || numRetries >= maxRetries) {\n console.error(e);\n process.exit(1);\n }\n try {\n numRetries++;\n port = await detect(port);\n server.close();\n server.listen(port);\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n});\n\n// Run the server...\nserver.listen(port);\n"]}
1
+ {"version":3,"file":"webserver.js","sourceRoot":"","sources":["../../../src/runners/chrome/webserver.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,sCAAsC;AACtC,mCAAmC;AACnC,6BAA6B;AAC7B,6BAA6B;AAE7B,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AAEtB,2BAA2B;AAC3B,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IAChC,GAAG,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;IAC/C,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC;IACjE,GAAG,CAAC,MAAM,CAAC,8BAA8B,EAAE,qLAAqL,CAAC,CAAC;IAClO,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC;AAEH,6FAA6F;AAC7F,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG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AAC,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,oBAAoB;AACpB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as detect from \"detect-port\";\r\nimport * as express from \"express\";\r\nimport * as http from \"http\";\r\nimport * as path from \"path\";\r\n\r\nconst app = express();\r\n\r\n// Enable CORS for all apis\r\napp.all(\"/*\", (_req, res, next) => {\r\n res.header(\"Access-Control-Allow-Origin\", \"*\");\r\n res.header(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS\");\r\n res.header(\"Access-Control-Allow-Headers\", \"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id, X-Protocol-Version\");\r\n next();\r\n});\r\n\r\n// The generated HTML file should be served at the \"root\" URL (i.e., http://localhost:3000/).\r\napp.use(\"/\", (req, resp, next) => {\r\n if (req.path === \"/\")\r\n resp.sendFile(process.env.CERTA_PATH!);\r\n else\r\n next();\r\n});\r\n\r\n// Handle a special route for serving absolute paths and files from node_modules\r\napp.use(\"/@/\", (_req, resp) => {\r\n const filePath = _req.originalUrl.replace(/^\\/@\\//, \"\");\r\n const canonicalPath = require(\"canonical-path\");\r\n const sourceMap = require(\"source-map-support\").retrieveSourceMap(filePath);\r\n const fullPath = path.resolve(\"/\", filePath);\r\n resp.sendFile(canonicalPath.normalize(fullPath), {\r\n headers: (sourceMap) && {\r\n \"X-SourceMap\": `/@/${sourceMap.url}`,\r\n },\r\n });\r\n});\r\n\r\n// Serve static assets from any configured \"public\" directories\r\nconst publicDirs: string[] = JSON.parse(process.env.CERTA_PUBLIC_DIRS || \"[]\");\r\nfor (const publicDir of publicDirs) {\r\n app.use(express.static(publicDir));\r\n}\r\n\r\n// All other routes should log a warning\r\nconst alreadyLogged = new Set<string>();\r\napp.use(\"*\", (req, resp) => {\r\n // Don't repeat these warnings if the same asset was requested multiple times.\r\n if (!alreadyLogged.has(req.originalUrl)) {\r\n console.warn(`WARNING: Tests attempted to load missing asset: \"${req.originalUrl}\"`);\r\n alreadyLogged.add(req.originalUrl);\r\n }\r\n resp.sendStatus(404);\r\n});\r\n\r\n// Once the server actually starts, we should log and send the actual port back to the parent process\r\nlet port = parseInt(process.env.CERTA_PORT ?? \"3000\", 10);\r\nconst server = http.createServer(app);\r\nserver.on(\"listening\", async () => {\r\n console.log(`Certa web frontend now listening on port ${port}`);\r\n process.send!(port);\r\n});\r\n\r\n// The preferred port (process.env.CERTA_PORT) may be in use. If that happens detect a free port and try again.\r\n// Even though we detect a free port, there can still be race conditions when many certa processes run simultaneously.\r\n// Therefore, we'll retry up to 4 times with a new free port.\r\nconst maxRetries = 4;\r\nlet numRetries = 0;\r\nserver.on(\"error\", async (e: any) => {\r\n if (e.code !== \"EADDRINUSE\" || numRetries >= maxRetries) {\r\n console.error(e);\r\n process.exit(1);\r\n }\r\n try {\r\n numRetries++;\r\n port = await detect(port);\r\n server.close();\r\n server.listen(port);\r\n } catch (error) {\r\n console.error(error);\r\n process.exit(1);\r\n }\r\n});\r\n\r\n// Run the server...\r\nserver.listen(port);\r\n"]}
@@ -64,9 +64,9 @@ class ElectronTestRunner {
64
64
  });
65
65
  rendererWindow.webContents.once("did-finish-load", async () => {
66
66
  const initScriptPath = require.resolve("./initElectronTests.js");
67
- const startTests = async () => rendererWindow.webContents.executeJavaScript(`
68
- var _CERTA_CONFIG = ${JSON.stringify(config)};
69
- require(${JSON.stringify(initScriptPath)});
67
+ const startTests = async () => rendererWindow.webContents.executeJavaScript(`
68
+ var _CERTA_CONFIG = ${JSON.stringify(config)};
69
+ require(${JSON.stringify(initScriptPath)});
70
70
  startCertaTests(${JSON.stringify(config.testBundle)});`);
71
71
  await startTests();
72
72
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ElectronTestRunner.js","sourceRoot":"","sources":["../../../src/runners/electron/ElectronTestRunner.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,yDAAyD;AACzD,6BAA6B;AAE7B,6DAAsE;AACtE,uDAA4D;AAG5D,MAAa,kBAAkB;IACtB,MAAM,CAAU,gBAAgB,GAAG,KAAK,CAAC;IACzC,MAAM,CAAU,eAAe,GAAG,KAAK,CAAC;IACxC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAmB;QAChD,kDAAkD;QAClD,IAAI,CAAC,CAAC,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;YACnC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,IAAA,+BAAkB,GAAE,CAAC,CAAC;QAElD,0IAA0I;QAC1I,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,MAAM,CAAC,KAAK;YACd,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAEhG,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;QAC1J,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAmB;QAC9C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2B,EAAE,OAAO,CAAC,CAAC;YACpD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;gBAChD,eAAe,CAAC,CAAC,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,KAAU,EAAE,GAAQ,EAAE,EAAE;YAC1D,KAAK,CAAC,WAAW,GAAG,MAAM,IAAA,yCAAyB,EAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;QAEH,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;YAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;YACjE,MAAM,UAAU,GAAG,KAAK,IAAI,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,iBAAiB,CAAC;8BACpD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;kBAClC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;0BACtB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAE3D,MAAM,UAAU,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,MAAM,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,4BAA4B,CAAC,CAAC,CAAC;IACpF,CAAC;;AA1EH,gDA2EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/naming-convention */\nimport * as path from \"path\";\nimport { WebPreferences } from \"electron\";\nimport { executeRegisteredCallback } from \"../../utils/CallbackUtils\";\nimport { relaunchInElectron } from \"../../utils/SpawnUtils\";\nimport { CertaConfig } from \"../../CertaConfig\";\n\nexport class ElectronTestRunner {\n public static readonly supportsCoverage = false;\n public static readonly supportsCleanup = false;\n public static async initialize(config: CertaConfig): Promise<void> {\n // Restart under electron if we're running in node\n if (!(\"electron\" in process.versions))\n return process.exit(await relaunchInElectron());\n\n // If we are running in electron, we need to append any chromium CLI switches ***before*** the 'ready' event of the app module is emitted.\n const { app } = require(\"electron\");\n if (config.debug)\n app.commandLine.appendSwitch(\"remote-debugging-port\", String(config.ports.frontendDebugging));\n\n const timeout = new Promise((_resolve, reject) => setTimeout(() => reject(new Error(\"Timed out after 2 minutes when starting electron\")), 2 * 60 * 1000));\n await Promise.race([app.whenReady(), timeout]);\n }\n\n public static async runTests(config: CertaConfig): Promise<void> {\n const { BrowserWindow, app, ipcMain } = require(\"electron\");\n\n const webPreferences: WebPreferences = {\n nodeIntegration: true,\n contextIsolation: false,\n sandbox: false,\n };\n\n const rendererWindow = new BrowserWindow({\n show: config.debug,\n webPreferences,\n });\n\n const exitElectronApp = (exitCode: number) => {\n // Passing exit code to parent process doesn't seem to work anymore with electron 10 - sending message with status instead\n // See note in SpawnUtils.onExitElectronApp\n if (process.send)\n process.send({ exitCode });\n app.exit(exitCode);\n };\n\n ipcMain.on(\"certa-console\", async (e: any, op: \"log\" | \"error\" | \"dir\", ...args: any[]) => {\n console[op](...args);\n e.returnValue = undefined; // ipcRenderer.sendSync() will hang without this\n });\n\n ipcMain.on(\"certa-done\", (_e: any, count: number) => {\n rendererWindow.webContents.once(\"destroyed\", () => {\n exitElectronApp(count);\n });\n setImmediate(() => rendererWindow.close());\n });\n\n ipcMain.on(\"certa-error\", (_e: any, { message, stack }: any) => {\n console.error(\"Uncaught Error in Tests: \", message);\n console.error(stack);\n rendererWindow.webContents.once(\"destroyed\", () => {\n exitElectronApp(1);\n });\n rendererWindow.close();\n });\n\n ipcMain.on(\"certa-callback\", async (event: any, msg: any) => {\n event.returnValue = await executeRegisteredCallback(msg.name, msg.args);\n });\n\n rendererWindow.webContents.once(\"did-finish-load\", async () => {\n const initScriptPath = require.resolve(\"./initElectronTests.js\");\n const startTests = async () => rendererWindow.webContents.executeJavaScript(`\n var _CERTA_CONFIG = ${JSON.stringify(config)};\n require(${JSON.stringify(initScriptPath)});\n startCertaTests(${JSON.stringify(config.testBundle)});`);\n\n await startTests();\n });\n await rendererWindow.loadFile(path.join(__dirname, \"../../../public/index.html\"));\n }\n}\n"]}
1
+ {"version":3,"file":"ElectronTestRunner.js","sourceRoot":"","sources":["../../../src/runners/electron/ElectronTestRunner.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,yDAAyD;AACzD,6BAA6B;AAE7B,6DAAsE;AACtE,uDAA4D;AAG5D,MAAa,kBAAkB;IACtB,MAAM,CAAU,gBAAgB,GAAG,KAAK,CAAC;IACzC,MAAM,CAAU,eAAe,GAAG,KAAK,CAAC;IACxC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAmB;QAChD,kDAAkD;QAClD,IAAI,CAAC,CAAC,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;YACnC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,IAAA,+BAAkB,GAAE,CAAC,CAAC;QAElD,0IAA0I;QAC1I,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,MAAM,CAAC,KAAK;YACd,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAEhG,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,kDAAkD,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EAAE,4BAA4B,CAAC,CAAC,CAAC;IACpF,CAAC;;AA1EH,gDA2EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport * as path from \"path\";\r\nimport { WebPreferences } from \"electron\";\r\nimport { executeRegisteredCallback } from \"../../utils/CallbackUtils\";\r\nimport { relaunchInElectron } from \"../../utils/SpawnUtils\";\r\nimport { CertaConfig } from \"../../CertaConfig\";\r\n\r\nexport class ElectronTestRunner {\r\n public static readonly supportsCoverage = false;\r\n public static readonly supportsCleanup = false;\r\n public static async initialize(config: CertaConfig): Promise<void> {\r\n // Restart under electron if we're running in node\r\n if (!(\"electron\" in process.versions))\r\n return process.exit(await relaunchInElectron());\r\n\r\n // If we are running in electron, we need to append any chromium CLI switches ***before*** the 'ready' event of the app module is emitted.\r\n const { app } = require(\"electron\");\r\n if (config.debug)\r\n app.commandLine.appendSwitch(\"remote-debugging-port\", String(config.ports.frontendDebugging));\r\n\r\n const timeout = new Promise((_resolve, reject) => setTimeout(() => reject(new Error(\"Timed out after 2 minutes when starting electron\")), 2 * 60 * 1000));\r\n await Promise.race([app.whenReady(), timeout]);\r\n }\r\n\r\n public static async runTests(config: CertaConfig): Promise<void> {\r\n const { BrowserWindow, app, ipcMain } = require(\"electron\");\r\n\r\n const webPreferences: WebPreferences = {\r\n nodeIntegration: true,\r\n contextIsolation: false,\r\n sandbox: false,\r\n };\r\n\r\n const rendererWindow = new BrowserWindow({\r\n show: config.debug,\r\n webPreferences,\r\n });\r\n\r\n const exitElectronApp = (exitCode: number) => {\r\n // Passing exit code to parent process doesn't seem to work anymore with electron 10 - sending message with status instead\r\n // See note in SpawnUtils.onExitElectronApp\r\n if (process.send)\r\n process.send({ exitCode });\r\n app.exit(exitCode);\r\n };\r\n\r\n ipcMain.on(\"certa-console\", async (e: any, op: \"log\" | \"error\" | \"dir\", ...args: any[]) => {\r\n console[op](...args);\r\n e.returnValue = undefined; // ipcRenderer.sendSync() will hang without this\r\n });\r\n\r\n ipcMain.on(\"certa-done\", (_e: any, count: number) => {\r\n rendererWindow.webContents.once(\"destroyed\", () => {\r\n exitElectronApp(count);\r\n });\r\n setImmediate(() => rendererWindow.close());\r\n });\r\n\r\n ipcMain.on(\"certa-error\", (_e: any, { message, stack }: any) => {\r\n console.error(\"Uncaught Error in Tests: \", message);\r\n console.error(stack);\r\n rendererWindow.webContents.once(\"destroyed\", () => {\r\n exitElectronApp(1);\r\n });\r\n rendererWindow.close();\r\n });\r\n\r\n ipcMain.on(\"certa-callback\", async (event: any, msg: any) => {\r\n event.returnValue = await executeRegisteredCallback(msg.name, msg.args);\r\n });\r\n\r\n rendererWindow.webContents.once(\"did-finish-load\", async () => {\r\n const initScriptPath = require.resolve(\"./initElectronTests.js\");\r\n const startTests = async () => rendererWindow.webContents.executeJavaScript(`\r\n var _CERTA_CONFIG = ${JSON.stringify(config)};\r\n require(${JSON.stringify(initScriptPath)});\r\n startCertaTests(${JSON.stringify(config.testBundle)});`);\r\n\r\n await startTests();\r\n });\r\n await rendererWindow.loadFile(path.join(__dirname, \"../../../public/index.html\"));\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initElectronTests.js","sourceRoot":"","sources":["../../../src/runners/electron/initElectronTests.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,uCAAuC;AAEvC,mDAAmD;AACnD,MAAM,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,OAAc,CAAC,EAAE,CAAC,EAAE,EAAE;IAC1D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEhB,OAAO,sBAAW,CAAC,QAAQ,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAC9D,CAAC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AC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,sBAAW,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAO,EAAE,CAAC;QACjC,sBAAW,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG,KAAK,EAAE,IAAY,EAAE,IAAW,EAAE,EAAE,CAAC,sBAAW,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvH,sBAAsB;AACtB,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;AACzC,MAAM,CAAC,mBAAmB,GAAG,kBAAkB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { ipcRenderer } from \"electron\";\n\n// NB: This has to happen _before_ we import mocha!\nwindow._CertaConsole = (name: string, args: any[] = [\"\"]) => {\n if (args.length === 0)\n args.push(\"\");\n\n return ipcRenderer.sendSync(\"certa-console\", name, ...args);\n};\nimport \"../../utils/initLogging\";\n\nimport Mocha = require(\"mocha\");\n\nwindow.onerror = (_message: any, _source: any, _lineno: any, _colno: any, error: any) => {\n const { message, stack } = error || {};\n ipcRenderer.send(\"certa-error\", { message, stack });\n};\n\nwindow.onunhandledrejection = (event: any) => {\n const { message, stack } = event.reason;\n ipcRenderer.send(\"certa-error\", { message, stack });\n};\n\n// Initialize mocha\ndeclare const window: any;\nwindow.mocha = new Mocha();\nimport \"../../utils/initMocha\";\n\nasync function startCertaTests(entryPoint: string) {\n try {\n // Setup source maps\n window.sourceMapSupport = require(\"source-map-support\");\n require(\"../../utils/initSourceMaps\");\n\n // Load tests\n // Note that we need to use a script tag instead of `require` here - that way debuggers can break on the first statement and resolve breakpoints.\n const script = document.createElement(\"script\");\n script.src = entryPoint;\n const loaded = new Promise((res, rej) => {\n script.onload = res;\n script.onerror = rej;\n });\n document.head.appendChild(script);\n await loaded;\n\n // Execute tests\n mocha.run((failedCount) => ipcRenderer.send(\"certa-done\", failedCount));\n } catch ({ message, stack }: any) {\n ipcRenderer.send(\"certa-error\", { message, stack });\n }\n}\n\nconst certaSendToBackend = async (name: string, args: any[]) => ipcRenderer.sendSync(\"certa-callback\", { name, args });\n\n// Expose some globals\nwindow.startCertaTests = startCertaTests;\nwindow._CertaSendToBackend = certaSendToBackend;\n"]}
1
+ {"version":3,"file":"initElectronTests.js","sourceRoot":"","sources":["../../../src/runners/electron/initElectronTests.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,uCAAuC;AAEvC,mDAAmD;AACnD,MAAM,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,OAAc,CAAC,EAAE,CAAC,EAAE,EAAE;IAC1D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEhB,OAAO,sBAAW,CAAC,QAAQ,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAC9D,CAAC,CAAC;AACF,mCAAiC;AAEjC,+BAAgC;AAEhC,MAAM,CAAC,OAAO,GAAG,CAAC,QAAa,EAAE,OAAY,EAAE,OAAY,EAAE,MAAW,EAAE,KAAU,EAAE,EAAE;IACtF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;IACvC,sBAAW,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,CAAC,oBAAoB,GAAG,CAAC,KAAU,EAAE,EAAE;IAC3C,MAAM,EAAE,OAAO,EAAE,KA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AI,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvH,sBAAsB;AACtB,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;AACzC,MAAM,CAAC,mBAAmB,GAAG,kBAAkB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { ipcRenderer } from \"electron\";\r\n\r\n// NB: This has to happen _before_ we import mocha!\r\nwindow._CertaConsole = (name: string, args: any[] = [\"\"]) => {\r\n if (args.length === 0)\r\n args.push(\"\");\r\n\r\n return ipcRenderer.sendSync(\"certa-console\", name, ...args);\r\n};\r\nimport \"../../utils/initLogging\";\r\n\r\nimport Mocha = require(\"mocha\");\r\n\r\nwindow.onerror = (_message: any, _source: any, _lineno: any, _colno: any, error: any) => {\r\n const { message, stack } = error || {};\r\n ipcRenderer.send(\"certa-error\", { message, stack });\r\n};\r\n\r\nwindow.onunhandledrejection = (event: any) => {\r\n const { message, stack } = event.reason;\r\n ipcRenderer.send(\"certa-error\", { message, stack });\r\n};\r\n\r\n// Initialize mocha\r\ndeclare const window: any;\r\nwindow.mocha = new Mocha();\r\nimport \"../../utils/initMocha\";\r\n\r\nasync function startCertaTests(entryPoint: string) {\r\n try {\r\n // Setup source maps\r\n window.sourceMapSupport = require(\"source-map-support\");\r\n require(\"../../utils/initSourceMaps\");\r\n\r\n // Load tests\r\n // Note that we need to use a script tag instead of `require` here - that way debuggers can break on the first statement and resolve breakpoints.\r\n const script = document.createElement(\"script\");\r\n script.src = entryPoint;\r\n const loaded = new Promise((res, rej) => {\r\n script.onload = res;\r\n script.onerror = rej;\r\n });\r\n document.head.appendChild(script);\r\n await loaded;\r\n\r\n // Execute tests\r\n mocha.run((failedCount) => ipcRenderer.send(\"certa-done\", failedCount));\r\n } catch ({ message, stack }: any) {\r\n ipcRenderer.send(\"certa-error\", { message, stack });\r\n }\r\n}\r\n\r\nconst certaSendToBackend = async (name: string, args: any[]) => ipcRenderer.sendSync(\"certa-callback\", { name, args });\r\n\r\n// Expose some globals\r\nwindow.startCertaTests = startCertaTests;\r\nwindow._CertaSendToBackend = certaSendToBackend;\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"NodeTestRunner.js","sourceRoot":"","sources":["../../../src/runners/node/NodeTestRunner.ts"],"names":[],"mappings":";;;AAKA,+BAAgC;AAIhC,MAAa,cAAc;IAClB,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IACxC,MAAM,CAAU,eAAe,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAmB;QAC9C,mBAAmB;QACnB,MAAM,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;QAC3B,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC;QAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAEjC,oBAAoB;QACpB,MAAM,CAAC,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACxD,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAEtC,aAAa;QACb,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,sBAAsB,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC;QAC5F,OAAO,CAAC,cAAc,CAAC,CAAC;QAExB,gBAAgB;QAChB,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC;IAC7D,CAAC;;AAnBH,wCAoBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { CertaConfig } from \"../../CertaConfig\";\nimport Mocha = require(\"mocha\");\n\ndeclare const global: any;\n\nexport class NodeTestRunner {\n public static readonly supportsCoverage = true;\n public static readonly supportsCleanup = true;\n public static async runTests(config: CertaConfig): Promise<void> {\n // Initialize mocha\n global.mocha = new Mocha();\n global._CERTA_CONFIG = config;\n require(\"../../utils/initMocha\");\n\n // Setup source maps\n global.sourceMapSupport = require(\"source-map-support\");\n require(\"../../utils/initSourceMaps\");\n\n // Load tests\n const frontendBundle = (config.cover && config.instrumentedTestBundle) || config.testBundle;\n require(frontendBundle);\n\n // Execute tests\n mocha.run((failedCount) => process.exitCode = failedCount);\n }\n}\n"]}
1
+ {"version":3,"file":"NodeTestRunner.js","sourceRoot":"","sources":["../../../src/runners/node/NodeTestRunner.ts"],"names":[],"mappings":";;;AAKA,+BAAgC;AAIhC,MAAa,cAAc;IAClB,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IACxC,MAAM,CAAU,eAAe,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAmB;QAC9C,mBAAmB;QACnB,MAAM,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;QAC3B,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC;QAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAEjC,oBAAoB;QACpB,MAAM,CAAC,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACxD,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAEtC,aAAa;QACb,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,sBAAsB,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC;QAC5F,OAAO,CAAC,cAAc,CAAC,CAAC;QAExB,gBAAgB;QAChB,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC;IAC7D,CAAC;;AAnBH,wCAoBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { CertaConfig } from \"../../CertaConfig\";\r\nimport Mocha = require(\"mocha\");\r\n\r\ndeclare const global: any;\r\n\r\nexport class NodeTestRunner {\r\n public static readonly supportsCoverage = true;\r\n public static readonly supportsCleanup = true;\r\n public static async runTests(config: CertaConfig): Promise<void> {\r\n // Initialize mocha\r\n global.mocha = new Mocha();\r\n global._CERTA_CONFIG = config;\r\n require(\"../../utils/initMocha\");\r\n\r\n // Setup source maps\r\n global.sourceMapSupport = require(\"source-map-support\");\r\n require(\"../../utils/initSourceMaps\");\r\n\r\n // Load tests\r\n const frontendBundle = (config.cover && config.instrumentedTestBundle) || config.testBundle;\r\n require(frontendBundle);\r\n\r\n // Execute tests\r\n mocha.run((failedCount) => process.exitCode = failedCount);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CallbackUtils.js","sourceRoot":"","sources":["../../src/utils/CallbackUtils.ts"],"names":[],"mappings":";;AAWA,0EAMC;AAGD,8DAMC;AAED,0DAMC;AAED,wDAKC;AAlCD,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC,CAAC;AAGrD,gBAAgB;AAChB,SAAgB,+BAA+B;IAC7C,IAAI,UAAU;QACZ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAEhE,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,IAAI,EAAE,CAAC;IAC1E,OAAO,MAAM,CAAC,yBAAyB,CAAC;AAC1C,CAAC;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,IAAY,EAAE,IAAW;IACjE,MAAM,mBAAmB,GAAG,+BAA+B,EAAE,CAAC;IAC9D,IAAI,CAAC,CAAC,IAAI,IAAI,mBAAmB,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAC;IAE9D,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,uBAAuB,CAAC,IAAY,EAAE,EAAwB;IAC5E,IAAI,UAAU;QACZ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAEhE,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,IAAI,EAAE,CAAC;IAC1E,MAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAC9C,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAAC,IAAY,EAAE,GAAG,IAAW;IACvE,IAAI,CAAC,UAAU;QACb,OAAO,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE/C,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\ndeclare const window: any;\ndeclare const global: any;\n\nconst isFrontend = (typeof (window) !== \"undefined\");\nexport type CertaBackendCallback = (...args: any[]) => void | null | undefined | number | string | boolean | Promise<void> | Promise<null> | Promise<undefined> | Promise<number> | Promise<string> | Promise<boolean>;\n\n/** @internal */\nexport function getCallbacksRegisteredOnBackend(): { [name: string]: CertaBackendCallback } {\n if (isFrontend)\n throw new Error(\"This should only be called on the backend!\");\n\n global._CertaRegisteredCallbacks = global._CertaRegisteredCallbacks || {};\n return global._CertaRegisteredCallbacks;\n}\n\n/** @internal */\nexport function executeRegisteredCallback(name: string, args: any[]): any {\n const registeredCallbacks = getCallbacksRegisteredOnBackend();\n if (!(name in registeredCallbacks))\n throw new Error(`Unknown certa backend callback \"${name}\"`);\n\n return registeredCallbacks[name](...args);\n}\n\nexport function registerBackendCallback(name: string, cb: CertaBackendCallback): void {\n if (isFrontend)\n throw new Error(\"This should only be called on the backend!\");\n\n global._CertaRegisteredCallbacks = global._CertaRegisteredCallbacks || {};\n global._CertaRegisteredCallbacks[name] = cb;\n}\n\nexport async function executeBackendCallback(name: string, ...args: any[]): Promise<any> {\n if (!isFrontend)\n return executeRegisteredCallback(name, args);\n\n return window._CertaSendToBackend(name, args);\n}\n"]}
1
+ {"version":3,"file":"CallbackUtils.js","sourceRoot":"","sources":["../../src/utils/CallbackUtils.ts"],"names":[],"mappings":";;AAWA,0EAMC;AAGD,8DAMC;AAED,0DAMC;AAED,wDAKC;AAlCD,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC,CAAC;AAGrD,gBAAgB;AAChB,SAAgB,+BAA+B;IAC7C,IAAI,UAAU;QACZ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAEhE,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,IAAI,EAAE,CAAC;IAC1E,OAAO,MAAM,CAAC,yBAAyB,CAAC;AAC1C,CAAC;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,IAAY,EAAE,IAAW;IACjE,MAAM,mBAAmB,GAAG,+BAA+B,EAAE,CAAC;IAC9D,IAAI,CAAC,CAAC,IAAI,IAAI,mBAAmB,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAC;IAE9D,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,uBAAuB,CAAC,IAAY,EAAE,EAAwB;IAC5E,IAAI,UAAU;QACZ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAEhE,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,IAAI,EAAE,CAAC;IAC1E,MAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAC9C,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAAC,IAAY,EAAE,GAAG,IAAW;IACvE,IAAI,CAAC,UAAU;QACb,OAAO,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE/C,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\ndeclare const window: any;\r\ndeclare const global: any;\r\n\r\nconst isFrontend = (typeof (window) !== \"undefined\");\r\nexport type CertaBackendCallback = (...args: any[]) => void | null | undefined | number | string | boolean | Promise<void> | Promise<null> | Promise<undefined> | Promise<number> | Promise<string> | Promise<boolean>;\r\n\r\n/** @internal */\r\nexport function getCallbacksRegisteredOnBackend(): { [name: string]: CertaBackendCallback } {\r\n if (isFrontend)\r\n throw new Error(\"This should only be called on the backend!\");\r\n\r\n global._CertaRegisteredCallbacks = global._CertaRegisteredCallbacks || {};\r\n return global._CertaRegisteredCallbacks;\r\n}\r\n\r\n/** @internal */\r\nexport function executeRegisteredCallback(name: string, args: any[]): any {\r\n const registeredCallbacks = getCallbacksRegisteredOnBackend();\r\n if (!(name in registeredCallbacks))\r\n throw new Error(`Unknown certa backend callback \"${name}\"`);\r\n\r\n return registeredCallbacks[name](...args);\r\n}\r\n\r\nexport function registerBackendCallback(name: string, cb: CertaBackendCallback): void {\r\n if (isFrontend)\r\n throw new Error(\"This should only be called on the backend!\");\r\n\r\n global._CertaRegisteredCallbacks = global._CertaRegisteredCallbacks || {};\r\n global._CertaRegisteredCallbacks[name] = cb;\r\n}\r\n\r\nexport async function executeBackendCallback(name: string, ...args: any[]): Promise<any> {\r\n if (!isFrontend)\r\n return executeRegisteredCallback(name, args);\r\n\r\n return window._CertaSendToBackend(name, args);\r\n}\r\n"]}
@@ -1 +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AM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACxE,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU;QACxB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAE7D,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC5D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,mDAAmD,kBAAkB,mBAAmB,CAAC,CAAC;IAE5G,oDAAoD;IACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1G,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { onExit, spawnChildProcess } from \"./SpawnUtils\";\n\n/**\n * Helper function for relaunching (as a child process) the current process running under `nyc` for measuring code coverage.\n * Once that completes, a second `nyc` child process will be spawned to report the coverage results.\n * Returns a promise that will be resolved with either 0 or the first non-zero child process exit code, once the reporter process terminates.\n */\nexport async function relaunchForCoverage(): Promise<number> {\n const nyc = require.resolve(\"nyc/bin/nyc\");\n const relaunchArgs = [\n nyc,\n \"--silent\",\n \"--\",\n ...process.argv,\n ];\n\n // By splitting \"instrument/runTests\" and \"report coverage\" into two steps, we allow test runners the option of\n // running separate (concurrent) instrumented processes that also write to `nyc`'s temp directory.\n const instrumentedProcess = spawnChildProcess(\"node\", relaunchArgs);\n const instrumentedStatus = await onExit(instrumentedProcess);\n\n // Now create a *combined* report for everything in `nyc`'s temp directory.\n const reporterProcess = spawnChildProcess(\"node\", [require.resolve(\"nyc/bin/nyc\"), \"report\"]);\n const reporterStatus = await onExit(reporterProcess);\n\n // Certa should exit with an error code if _either_ step failed.\n return instrumentedStatus || reporterStatus;\n}\n\n/** Gets the current effective nyc config from `process.env`. Assumes we're running as a child process of `nyc`. */\nfunction getNycConfig(): any {\n const nycConfig = process.env.NYC_CONFIG;\n if (!nycConfig)\n throw new Error(\"NYC_CONFIG is not set in environment\");\n\n return JSON.parse(nycConfig);\n}\n\n/**\n * Writes nyc or istanbul-generated coverage data to a uniquely-named file inside `nyc`'s temp directory.\n * All such files in the nyc temp directory are merged together when nyc reports are generated via `nyc report`.\n * @param coverageData The value of an nyc/istanbul-generated `__coverage__` object.\n */\nexport function writeCoverageData(coverageData: any): void {\n const nycConfig = getNycConfig();\n const nycCWD = nycConfig.cwd;\n const nycTempDir = nycConfig[\"temp-dir\"] || nycConfig[\"temp-directory\"];\n if (!nycCWD || !nycTempDir)\n throw new Error(\"Failed to determine nyc temp directory.\");\n\n const nycTempDirAbsolute = path.resolve(nycCWD, nycTempDir);\n if (!fs.existsSync(nycTempDirAbsolute))\n throw new Error(`Cannot save coverage data - nyc temp directory \"${nycTempDirAbsolute}\" does not exist.`);\n\n // Generate a unique filename, just like `nyc` does.\n const coverageFileName = path.join(nycTempDirAbsolute, `${Math.random().toString(36).substring(2)}.json`);\n fs.writeFileSync(coverageFileName, JSON.stringify(coverageData));\n}\n"]}
1
+ {"version":3,"file":"CoverageUtils.js","sourceRoot":"","sources":["../../src/utils/CoverageUtils.ts"],"names":[],"mappings":";;AAaA,kDAoBC;AAgBD,8CAcC;AA/DD;;;+FAG+F;AAC/F,yBAAyB;AACzB,6BAA6B;AAC7B,6CAAyD;AAEzD;;;;GAIG;AACI,KAAK,UAAU,mBAAmB;IACvC,MAA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AE,UAAU,CAAC,CAAC;IAC5D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,mDAAmD,kBAAkB,mBAAmB,CAAC,CAAC;IAE5G,oDAAoD;IACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1G,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as fs from \"fs\";\r\nimport * as path from \"path\";\r\nimport { onExit, spawnChildProcess } from \"./SpawnUtils\";\r\n\r\n/**\r\n * Helper function for relaunching (as a child process) the current process running under `nyc` for measuring code coverage.\r\n * Once that completes, a second `nyc` child process will be spawned to report the coverage results.\r\n * Returns a promise that will be resolved with either 0 or the first non-zero child process exit code, once the reporter process terminates.\r\n */\r\nexport async function relaunchForCoverage(): Promise<number> {\r\n const nyc = require.resolve(\"nyc/bin/nyc\");\r\n const relaunchArgs = [\r\n nyc,\r\n \"--silent\",\r\n \"--\",\r\n ...process.argv,\r\n ];\r\n\r\n // By splitting \"instrument/runTests\" and \"report coverage\" into two steps, we allow test runners the option of\r\n // running separate (concurrent) instrumented processes that also write to `nyc`'s temp directory.\r\n const instrumentedProcess = spawnChildProcess(\"node\", relaunchArgs);\r\n const instrumentedStatus = await onExit(instrumentedProcess);\r\n\r\n // Now create a *combined* report for everything in `nyc`'s temp directory.\r\n const reporterProcess = spawnChildProcess(\"node\", [require.resolve(\"nyc/bin/nyc\"), \"report\"]);\r\n const reporterStatus = await onExit(reporterProcess);\r\n\r\n // Certa should exit with an error code if _either_ step failed.\r\n return instrumentedStatus || reporterStatus;\r\n}\r\n\r\n/** Gets the current effective nyc config from `process.env`. Assumes we're running as a child process of `nyc`. */\r\nfunction getNycConfig(): any {\r\n const nycConfig = process.env.NYC_CONFIG;\r\n if (!nycConfig)\r\n throw new Error(\"NYC_CONFIG is not set in environment\");\r\n\r\n return JSON.parse(nycConfig);\r\n}\r\n\r\n/**\r\n * Writes nyc or istanbul-generated coverage data to a uniquely-named file inside `nyc`'s temp directory.\r\n * All such files in the nyc temp directory are merged together when nyc reports are generated via `nyc report`.\r\n * @param coverageData The value of an nyc/istanbul-generated `__coverage__` object.\r\n */\r\nexport function writeCoverageData(coverageData: any): void {\r\n const nycConfig = getNycConfig();\r\n const nycCWD = nycConfig.cwd;\r\n const nycTempDir = nycConfig[\"temp-dir\"] || nycConfig[\"temp-directory\"];\r\n if (!nycCWD || !nycTempDir)\r\n throw new Error(\"Failed to determine nyc temp directory.\");\r\n\r\n const nycTempDirAbsolute = path.resolve(nycCWD, nycTempDir);\r\n if (!fs.existsSync(nycTempDirAbsolute))\r\n throw new Error(`Cannot save coverage data - nyc temp directory \"${nycTempDirAbsolute}\" does not exist.`);\r\n\r\n // Generate a unique filename, just like `nyc` does.\r\n const coverageFileName = path.join(nycTempDirAbsolute, `${Math.random().toString(36).substring(2)}.json`);\r\n fs.writeFileSync(coverageFileName, JSON.stringify(coverageData));\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SpawnUtils.js","sourceRoot":"","sources":["../../src/utils/SpawnUtils.ts"],"names":[],"mappings":";;AAeA,8CAYC;AAGD,wBAIC;AAwBD,gDAWC;AAWD,sCAMC;AAtFD;;;+FAG+F;AAC/F,iDAAkE;AAClE,uCAAuC;AAEvC;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAAC,OAAe,EAAE,IAA2B,EAAE,GAAuB,EAAE,MAAM,GAAG,KAAK;IAC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eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE;YAC7B,0IAA0I;YAC1I,oIAAoI;YACpI,yIAAyI;YACzI,6FAA6F;YAC7F,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,kBAAkB;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,4FAA4F;IAC5F,mFAAmF;IACnF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,QAAQ,IAAI,CAAC;QACf,IAAI,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC;IAEtC,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACrF,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,gEAAgE;IAChE,IAAI,SAAS,CAAC,GAAG,EAAE;QACjB,OAAO;IAET,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { ChildProcess, spawn, StdioOptions } from \"child_process\";\nimport * as inspector from \"inspector\";\n\n/**\n * Helper function for spawning a child process with the same cwd, env, stdout, and stderr as the current process.\n * Processes spawned by this function will also have an IPC channel, so the may communicate with their parent via `process.send()`.\n * @param command The command to run.\n * @param args List of string arguments.\n * @param env Environment vars to override in the child process.\n * @param useIpc Whether to enable an IPC channel when spawning.\n */\nexport function spawnChildProcess(command: string, args: ReadonlyArray<string>, env?: NodeJS.ProcessEnv, useIpc = false): ChildProcess {\n const childEnv = { ...process.env, ...(env || {}) };\n\n // FIXME: We should be able to remove the useIpc param and just always enable it,\n // but it's not safe to spawn electron with IPC enabled until https://github.com/electron/electron/issues/17044 is fixed.\n const stdio: StdioOptions = (useIpc) ? [\"ipc\", \"pipe\", \"pipe\"] : \"pipe\";\n const childProcess = spawn(command, args, { stdio, cwd: process.cwd(), env: childEnv });\n // For some reason, spawning using `stdio: \"inherit\"` results in some garbled output (for example, \"✓\" is printed as \"ΓêÜ\").\n // Using `stdio: \"pipe\"` and manually redirecting the output here seems to work though.\n childProcess.stdout!.on(\"data\", (data: any) => process.stdout.write(data));\n childProcess.stderr!.on(\"data\", (data: any) => process.stderr.write(data));\n return childProcess;\n}\n\n/** Returns a Promise that will be resolved with the given child process's exit code upon termination. */\nexport async function onExit(child: ChildProcess): Promise<number> {\n return new Promise((resolve) => {\n child.on(\"exit\", (status) => resolve(status || 0));\n });\n}\n\n/** Returns a Promise that will be resolved with the given child process's exit code upon termination. */\nasync function onExitElectronApp(child: ChildProcess): Promise<number> {\n let messageExitCode = 1; // Default to error\n child.on(\"message\", (message: any) => {\n messageExitCode = message.exitCode;\n });\n\n return new Promise((resolve) => {\n child.on(\"exit\", (_exitCode) => {\n // Note: Upgrading to electron 10 seems to cause the electron child process to always exit with 3221225477 = 0xC0000005(Access Violation).\n // This causes the exitCode we pass to app.exit(_exitCode) to be lost. To work around this issue, we instead pass a message from the\n // child process (see ElectronTestRunner), right before we call app.exit(). This message includes the exitCode based on the status of the\n // test runs. See ElectronTestRunner.runTests, and the above listener to the \"message\" event.\n resolve(messageExitCode);\n });\n });\n}\n\n/**\n * Helper function for relaunching (as a child process) the current process in electron instead of node.\n * Returns a promise that will be resolved with the exit code of the child process, once it terminates.\n */\nexport async function relaunchInElectron(): Promise<number> {\n const args = process.argv.slice(1);\n\n // '--debug' is not allowed in Electron and '--inspect' will automatically start a debugger,\n // so we use custom parameter to indicate what we want to start debugger ourselves.\n const debugIdx = args.indexOf(\"--debug\");\n if (debugIdx >= 0)\n args[debugIdx] = \"--debug-electron\";\n\n const child = spawnChildProcess(require(\"electron/index.js\"), args, undefined, true);\n return onExitElectronApp(child);\n}\n\n/**\n * Activates the v8 inspector and starts listening on the given port, then breaks as soon as a debugger has connected.\n * This is essentially what node does when run with `--inspect-brk={port}`, but doing this manually gives us more control\n * over precisely _which_ child process connects to the debugger.\n *\n * For example, when using the chrome test runner, we want debug the original certa process (\"node certa ...args\") as the\n * test \"backend\", but with the electron test runner, we want to debug a child process (\"electron certa ...args\").\n * @param port Port to listen on for inspector connections.\n */\nexport function startDebugger(port: number) {\n // Don't try to activate if there's already an active inspector.\n if (inspector.url())\n return;\n\n inspector.open(port, undefined, true);\n}\n"]}
1
+ {"version":3,"file":"SpawnUtils.js","sourceRoot":"","sources":["../../src/utils/SpawnUtils.ts"],"names":[],"mappings":";;AAeA,8CAYC;AAGD,wBAIC;AAwBD,gDAWC;AAWD,sCAMC;AAtFD;;;+FAG+F;AAC/F,iDAAkE;AAClE,uCAAuC;AAEvC;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAAC,OAAe,EAAE,IAA2B,EAAE,GAAuB,EAAE,MAAM,GAAG,KAAK;IACrH,MAAM,QAAQ,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC;IAEpD,iFAAiF;IACjF,yHAAyH;IACzH,MAAM,KAAK,GAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACxE,MAAM,YAA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,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,kBAAkB;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,4FAA4F;IAC5F,mFAAmF;IACnF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,QAAQ,IAAI,CAAC;QACf,IAAI,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC;IAEtC,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACrF,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,gEAAgE;IAChE,IAAI,SAAS,CAAC,GAAG,EAAE;QACjB,OAAO;IAET,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { ChildProcess, spawn, StdioOptions } from \"child_process\";\r\nimport * as inspector from \"inspector\";\r\n\r\n/**\r\n * Helper function for spawning a child process with the same cwd, env, stdout, and stderr as the current process.\r\n * Processes spawned by this function will also have an IPC channel, so the may communicate with their parent via `process.send()`.\r\n * @param command The command to run.\r\n * @param args List of string arguments.\r\n * @param env Environment vars to override in the child process.\r\n * @param useIpc Whether to enable an IPC channel when spawning.\r\n */\r\nexport function spawnChildProcess(command: string, args: ReadonlyArray<string>, env?: NodeJS.ProcessEnv, useIpc = false): ChildProcess {\r\n const childEnv = { ...process.env, ...(env || {}) };\r\n\r\n // FIXME: We should be able to remove the useIpc param and just always enable it,\r\n // but it's not safe to spawn electron with IPC enabled until https://github.com/electron/electron/issues/17044 is fixed.\r\n const stdio: StdioOptions = (useIpc) ? [\"ipc\", \"pipe\", \"pipe\"] : \"pipe\";\r\n const childProcess = spawn(command, args, { stdio, cwd: process.cwd(), env: childEnv });\r\n // For some reason, spawning using `stdio: \"inherit\"` results in some garbled output (for example, \"✓\" is printed as \"ΓêÜ\").\r\n // Using `stdio: \"pipe\"` and manually redirecting the output here seems to work though.\r\n childProcess.stdout!.on(\"data\", (data: any) => process.stdout.write(data));\r\n childProcess.stderr!.on(\"data\", (data: any) => process.stderr.write(data));\r\n return childProcess;\r\n}\r\n\r\n/** Returns a Promise that will be resolved with the given child process's exit code upon termination. */\r\nexport async function onExit(child: ChildProcess): Promise<number> {\r\n return new Promise((resolve) => {\r\n child.on(\"exit\", (status) => resolve(status || 0));\r\n });\r\n}\r\n\r\n/** Returns a Promise that will be resolved with the given child process's exit code upon termination. */\r\nasync function onExitElectronApp(child: ChildProcess): Promise<number> {\r\n let messageExitCode = 1; // Default to error\r\n child.on(\"message\", (message: any) => {\r\n messageExitCode = message.exitCode;\r\n });\r\n\r\n return new Promise((resolve) => {\r\n child.on(\"exit\", (_exitCode) => {\r\n // Note: Upgrading to electron 10 seems to cause the electron child process to always exit with 3221225477 = 0xC0000005(Access Violation).\r\n // This causes the exitCode we pass to app.exit(_exitCode) to be lost. To work around this issue, we instead pass a message from the\r\n // child process (see ElectronTestRunner), right before we call app.exit(). This message includes the exitCode based on the status of the\r\n // test runs. See ElectronTestRunner.runTests, and the above listener to the \"message\" event.\r\n resolve(messageExitCode);\r\n });\r\n });\r\n}\r\n\r\n/**\r\n * Helper function for relaunching (as a child process) the current process in electron instead of node.\r\n * Returns a promise that will be resolved with the exit code of the child process, once it terminates.\r\n */\r\nexport async function relaunchInElectron(): Promise<number> {\r\n const args = process.argv.slice(1);\r\n\r\n // '--debug' is not allowed in Electron and '--inspect' will automatically start a debugger,\r\n // so we use custom parameter to indicate what we want to start debugger ourselves.\r\n const debugIdx = args.indexOf(\"--debug\");\r\n if (debugIdx >= 0)\r\n args[debugIdx] = \"--debug-electron\";\r\n\r\n const child = spawnChildProcess(require(\"electron/index.js\"), args, undefined, true);\r\n return onExitElectronApp(child);\r\n}\r\n\r\n/**\r\n * Activates the v8 inspector and starts listening on the given port, then breaks as soon as a debugger has connected.\r\n * This is essentially what node does when run with `--inspect-brk={port}`, but doing this manually gives us more control\r\n * over precisely _which_ child process connects to the debugger.\r\n *\r\n * For example, when using the chrome test runner, we want debug the original certa process (\"node certa ...args\") as the\r\n * test \"backend\", but with the electron test runner, we want to debug a child process (\"electron certa ...args\").\r\n * @param port Port to listen on for inspector connections.\r\n */\r\nexport function startDebugger(port: number) {\r\n // Don't try to activate if there's already an active inspector.\r\n if (inspector.url())\r\n return;\r\n\r\n inspector.open(port, undefined, true);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initLogging.js","sourceRoot":"","sources":["../../src/utils/initLogging.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,iHAAiH;AAIjH,+EAA+E;AAC/E,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE,CAAC;IACzC,SAAS,cAAc,CAAC,IAA6B;QACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;YACjC,aAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC3B,yHAAyH;YACzH,mEAAmE;YACnE,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,IAAW,CAAC,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC;IACD,cAAc,CAAC,KAAK,CAAC,CAAC;IACtB,cAAc,CAAC,OAAO,CAAC,CAAC;IACxB,cAAc,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// NB: This file is not a CommonJs module - it needs to run in the browser. Do not import or export modules here!\n\ndeclare let _CertaConsole: undefined | ((name: string, args: any[]) => void); // eslint-disable-line @typescript-eslint/naming-convention\n\n// Redirect all console output back to the main (backend) process, if necessary\nif (typeof _CertaConsole !== \"undefined\") {\n function forwardConsole(name: \"log\" | \"error\" | \"dir\") {\n const original = console[name];\n console[name] = (...args: any[]) => {\n _CertaConsole!(name, args);\n // Also preserve the original behavior. This way, test progress is reported in both the backend _and_ frontend processes.\n // This helps keep the output readable when debugging the frontend.\n original.apply(console, args as any);\n };\n }\n forwardConsole(\"log\");\n forwardConsole(\"error\");\n forwardConsole(\"dir\");\n}\n"]}
1
+ {"version":3,"file":"initLogging.js","sourceRoot":"","sources":["../../src/utils/initLogging.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,iHAAiH;AAIjH,+EAA+E;AAC/E,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE,CAAC;IACzC,SAAS,cAAc,CAAC,IAA6B;QACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;YACjC,aAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC3B,yHAAyH;YACzH,mEAAmE;YACnE,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,IAAW,CAAC,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC;IACD,cAAc,CAAC,KAAK,CAAC,CAAC;IACtB,cAAc,CAAC,OAAO,CAAC,CAAC;IACxB,cAAc,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// NB: This file is not a CommonJs module - it needs to run in the browser. Do not import or export modules here!\r\n\r\ndeclare let _CertaConsole: undefined | ((name: string, args: any[]) => void); // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n// Redirect all console output back to the main (backend) process, if necessary\r\nif (typeof _CertaConsole !== \"undefined\") {\r\n function forwardConsole(name: \"log\" | \"error\" | \"dir\") {\r\n const original = console[name];\r\n console[name] = (...args: any[]) => {\r\n _CertaConsole!(name, args);\r\n // Also preserve the original behavior. This way, test progress is reported in both the backend _and_ frontend processes.\r\n // This helps keep the output readable when debugging the frontend.\r\n original.apply(console, args as any);\r\n };\r\n }\r\n forwardConsole(\"log\");\r\n forwardConsole(\"error\");\r\n forwardConsole(\"dir\");\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initMocha.js","sourceRoot":"","sources":["../../src/utils/initMocha.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,iHAAiH;AAKjH,CAAC,CAAC,MAAmB,EAAE,EAAE;IACvB,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IAEtC,iHAAiH;IACjH,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAChB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAEhG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC9D,6CAA6C;IAC5C,KAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,SAAS,CAAC,KAAK;QACjB,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,SAAS,CAAC,IAAI;QAChB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,SAAS,CAAC,MAAM;QAClB,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,IAAI,SAAS,CAAC,UAAU;QACtB,KAAK,CAAC,UAAU,EAAE,CAAC;IAErB,mCAAmC;IACnC,IAAI,MAAM,CAAC,KAAK;QACd,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// NB: This file is not a CommonJs module - it needs to run in the browser. Do not import or export modules here!\n\ntype CertaConfig = import(\"../CertaConfig\").CertaConfig;\ndeclare let _CERTA_CONFIG: CertaConfig;\n\n((config: CertaConfig) => {\n const mochaOpts = config.mochaOptions;\n\n // This is essentially equivalent to `mocha.setup(\"bdd\")`, except it works in both node and browser environments.\n mocha.ui(\"bdd\");\n mocha.suite.emit(\"pre-require\", typeof (window) === \"undefined\" ? global : window, null, mocha);\n\n mocha.reporter(mochaOpts.reporter, mochaOpts.reporterOptions);\n // TODO: Come back and fix useColors to color\n (mocha as any).color(true);\n mocha.timeout(mochaOpts.timeout);\n if (mochaOpts.fgrep)\n mocha.fgrep(mochaOpts.fgrep);\n if (mochaOpts.grep)\n mocha.grep(mochaOpts.grep);\n if (mochaOpts.invert)\n mocha.invert();\n if (mochaOpts.forbidOnly)\n mocha.forbidOnly();\n\n // Disable timeouts when debugging.\n if (config.debug)\n mocha.timeout(0);\n})(_CERTA_CONFIG);\n"]}
1
+ {"version":3,"file":"initMocha.js","sourceRoot":"","sources":["../../src/utils/initMocha.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,iHAAiH;AAKjH,CAAC,CAAC,MAAmB,EAAE,EAAE;IACvB,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IAEtC,iHAAiH;IACjH,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAChB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAEhG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC9D,6CAA6C;IAC5C,KAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,SAAS,CAAC,KAAK;QACjB,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,SAAS,CAAC,IAAI;QAChB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,SAAS,CAAC,MAAM;QAClB,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,IAAI,SAAS,CAAC,UAAU;QACtB,KAAK,CAAC,UAAU,EAAE,CAAC;IAErB,mCAAmC;IACnC,IAAI,MAAM,CAAC,KAAK;QACd,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// NB: This file is not a CommonJs module - it needs to run in the browser. Do not import or export modules here!\r\n\r\ntype CertaConfig = import(\"../CertaConfig\").CertaConfig;\r\ndeclare let _CERTA_CONFIG: CertaConfig;\r\n\r\n((config: CertaConfig) => {\r\n const mochaOpts = config.mochaOptions;\r\n\r\n // This is essentially equivalent to `mocha.setup(\"bdd\")`, except it works in both node and browser environments.\r\n mocha.ui(\"bdd\");\r\n mocha.suite.emit(\"pre-require\", typeof (window) === \"undefined\" ? global : window, null, mocha);\r\n\r\n mocha.reporter(mochaOpts.reporter, mochaOpts.reporterOptions);\r\n // TODO: Come back and fix useColors to color\r\n (mocha as any).color(true);\r\n mocha.timeout(mochaOpts.timeout);\r\n if (mochaOpts.fgrep)\r\n mocha.fgrep(mochaOpts.fgrep);\r\n if (mochaOpts.grep)\r\n mocha.grep(mochaOpts.grep);\r\n if (mochaOpts.invert)\r\n mocha.invert();\r\n if (mochaOpts.forbidOnly)\r\n mocha.forbidOnly();\r\n\r\n // Disable timeouts when debugging.\r\n if (config.debug)\r\n mocha.timeout(0);\r\n})(_CERTA_CONFIG);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initSourceMaps.d.ts","sourceRoot":"","sources":["../../src/utils/initSourceMaps.ts"],"names":[],"mappings":"AAOA,OAAO,CAAC,MAAM,gBAAgB,EAAE,GAAG,CAAC;AAKpC,QAAA,MAAM,yBAAyB,6BAKuzF,OAAQ,QAAQ,uBAL7yF,CAAC"}
1
+ {"version":3,"file":"initSourceMaps.d.ts","sourceRoot":"","sources":["../../src/utils/initSourceMaps.ts"],"names":[],"mappings":"AAOA,OAAO,CAAC,MAAM,gBAAgB,EAAE,GAAG,CAAC;AAKpC,QAAA,MAAM,yBAAyB,6BAKsyF,OAAQ,QAAQ,uBAL5xF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"initSourceMaps.js","sourceRoot":"","sources":["../../src/utils/initSourceMaps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,iHAAiH;AAIjH,gBAAgB,CAAC,OAAO,EAAE,CAAC;AAE3B,0FAA0F;AAC1F,4EAA4E;AAC5E,MAAM,yBAAyB,GAAG,KAAK,CAAC,iBAAiB,CAAC;AAC1D,KAAK,CAAC,iBAAiB,GAAG,UAAU,GAAG,IAAI;IACzC,MAAM,GAAG,GAAG,yBAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;AACpF,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// NB: This file is not a CommonJs module - it needs to run in the browser. Do not import or export modules here!\n\n// NB: This requires source-map-support/browser-source-map-support.js to be loaded first!\ndeclare const sourceMapSupport: any;\nsourceMapSupport.install();\n\n// The source-map-support package does not correctly format stack traces from the browser.\n// It gets pretty close though, so we'll just monkey-patch here to fix them.\nconst originalPrepareStackTrace = Error.prepareStackTrace;\nError.prepareStackTrace = function (...args) {\n const res = originalPrepareStackTrace!.call(this, ...args);\n return res.replace(/\\(.*file:(\\/|\\\\)/g, \"(\").replace(/at .*file:(\\/|\\\\)/g, \"at \");\n};\n"]}
1
+ {"version":3,"file":"initSourceMaps.js","sourceRoot":"","sources":["../../src/utils/initSourceMaps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,iHAAiH;AAIjH,gBAAgB,CAAC,OAAO,EAAE,CAAC;AAE3B,0FAA0F;AAC1F,4EAA4E;AAC5E,MAAM,yBAAyB,GAAG,KAAK,CAAC,iBAAiB,CAAC;AAC1D,KAAK,CAAC,iBAAiB,GAAG,UAAU,GAAG,IAAI;IACzC,MAAM,GAAG,GAAG,yBAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;AACpF,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// NB: This file is not a CommonJs module - it needs to run in the browser. Do not import or export modules here!\r\n\r\n// NB: This requires source-map-support/browser-source-map-support.js to be loaded first!\r\ndeclare const sourceMapSupport: any;\r\nsourceMapSupport.install();\r\n\r\n// The source-map-support package does not correctly format stack traces from the browser.\r\n// It gets pretty close though, so we'll just monkey-patch here to fix them.\r\nconst originalPrepareStackTrace = Error.prepareStackTrace;\r\nError.prepareStackTrace = function (...args) {\r\n const res = originalPrepareStackTrace!.call(this, ...args);\r\n return res.replace(/\\(.*file:(\\/|\\\\)/g, \"(\").replace(/at .*file:(\\/|\\\\)/g, \"at \");\r\n};\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/certa",
3
- "version": "5.3.2",
3
+ "version": "5.3.4",
4
4
  "description": "A mocha-based integration test runner",
5
5
  "license": "MIT",
6
6
  "main": "bin/certa.js",
@@ -47,7 +47,7 @@
47
47
  "nyc": "^17.1.0",
48
48
  "rimraf": "^6.0.1",
49
49
  "typescript": "~5.6.2",
50
- "@itwin/build-tools": "5.3.2"
50
+ "@itwin/build-tools": "5.3.4"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "electron": "^35.0.0 || ^36.0.0 || ^37.0.0 || ^38.0.0 || ^39.0.0"