Skip to content

Commit

Permalink
Properly deleted Sauce Labs config from Karma.
Browse files Browse the repository at this point in the history
  • Loading branch information
shirblc committed Apr 3, 2022
1 parent 99feb30 commit 5c59a31
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 62 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ jobs:
- run: npm run lint
- run: npm run build
- run: npm run test
env:
SAUCE: false

# Upload coverage report to codecov.io
# - run: |
Expand Down
45 changes: 0 additions & 45 deletions tests/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
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,
Expand Down Expand Up @@ -94,46 +92,3 @@ export function webpack(
devtool: "source-map"
}
}

/**
* SauceLabs configuration
*
* @param config - Configuration
* @param browsers - Browser configuration
*
* @return SauceLabs configuration
*/
export function saucelabs(
config: KarmaConfig & KarmaConfigOptions,
browsers: Record<string, CustomLauncher>
): Partial<KarmaConfigOptions> {
return {

/* Define browsers to run tests on, see http://bit.ly/2pl96u1 */
browsers: Object.keys(browsers),
customLaunchers: browsers as any,

/* Configure SauceLabs integration */
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
},

/* Set reporters */
reporters: config.singleRun
? ["summary", "coverage-istanbul", "saucelabs"]
: ["spec", "clear-screen"],
specReporter: {
suppressErrorSummary: true,
suppressPassed: !config.singleRun
},
coverageIstanbulReporter: {
reports: ["lcovonly"]
}
}
}
4 changes: 2 additions & 2 deletions tests/karma.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default (config: KarmaConfig & KarmaConfigOptions) => {

/* Reporters */
reporters: config.singleRun
? ["spec", "coverage-istanbul"]
? ["summary", "coverage-istanbul", "saucelabs"]
: ["spec", "clear-screen"],

/* Browsers */
Expand All @@ -75,7 +75,7 @@ export default (config: KarmaConfig & KarmaConfigOptions) => {

/* Configuration for coverage reporter */
coverageIstanbulReporter: {
reports: ["html", "text"]
reports: ["html", "text", "lcovonly"]
},

/* Hack: Don't serve TypeScript files with "video/mp2t" mime type */
Expand Down
20 changes: 7 additions & 13 deletions tests/karma.integration.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import {
ConfigOptions as KarmaConfigOptions
} from "karma"

import { saucelabs, webpack } from "./config"
import * as browsers from "./config/browsers/integration.json"
import { webpack } from "./config"

/* ----------------------------------------------------------------------------
* Configuration
Expand Down Expand Up @@ -68,7 +67,7 @@ export default (config: KarmaConfig & KarmaConfigOptions) => {

/* Reporters */
reporters: config.singleRun
? ["spec"]
? ["summary", "coverage-istanbul", "saucelabs"]
: ["spec", "clear-screen"],

/* Browsers */
Expand All @@ -80,6 +79,11 @@ export default (config: KarmaConfig & KarmaConfigOptions) => {
suppressSkipped: !config.singleRun
},

/* Configuration for coverage reporter */
coverageIstanbulReporter: {
reports: []
},

/* Hack: Don't serve TypeScript files with "video/mp2t" mime type */
mime: {
"text/x-typescript": ["ts"]
Expand Down Expand Up @@ -117,16 +121,6 @@ export default (config: KarmaConfig & KarmaConfigOptions) => {
}
}
]
},

/* Configuration overrides */
...(process.env.GITHUB_ACTIONS || process.env.SAUCE
? saucelabs(config, browsers)
: {}),

/* Configuration for coverage reporter */
coverageIstanbulReporter: {
reports: []
}
})
}

0 comments on commit 5c59a31

Please sign in to comment.