import { Config as KarmaConfig , ConfigOptions as KarmaConfigOptions , CustomLauncher } from "karma" ; import * as path from "path" ; import { generate } from "project-name-generator" ; import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin" ; import { Configuration as WebpackConfig , ProvidePlugin , RuleSetRule as WebpackRuleSetRule } from "webpack" ; param config return export function webpack ( config ) { delete process . env . TS_NODE_PROJECT ; return { mode : "development" , module : { rules : [ { test : /\.ts$/ , use : [ "babel-loader" , "ts-loader" ] , exclude : /\/node_modules\// } , ... ( config . singleRun ? [ ( { test : /\.ts$/ , use : "istanbul-instrumenter-loader?+esModules" , include : path . resolve ( __dirname , "../../src" ) , enforce : "post" } ) as WebpackRuleSetRule ] : [ ] ) ] } , resolve : { modules : [ path . resolve ( __dirname , "../../node_modules" ) ] , extensions : [ ".ts" , ".js" , ".json" ] , plugins : [ new TsconfigPathsPlugin ( ) ] , alias : { _ : path . resolve ( __dirname , ".." ) } } , plugins : [ new ProvidePlugin ( { Promise : "es6-promise" } ) ] , devtool : "source-map" } ; } param config param browsers return export function saucelabs ( config , browsers ) { return { browsers : Object . keys ( browsers ) , customLaunchers : browsers as any , concurrency : 5 , sauceLabs : { build : process . env . GITHUB_ACTIONS , testName : process . env . GITHUB_RUN_ID ? `${ process . env . GITHUB_RUN_ID }` : `~ #${ generate ( ) . dashed }` , recordVideo : false , recordScreenshots : false } , reporters : config . singleRun ? [ "summary" , "coverage-istanbul" , "saucelabs" ] : [ "spec" , "clear-screen" ] , specReporter : { suppressErrorSummary : true , suppressPassed : ! config . singleRun } , coverageIstanbulReporter : { reports : [ "lcovonly" ] } } ; }