chore(test): move from deprecated karma to web-test-runner for browser tests (#1052)
parent
6ff10c720b
commit
0a4fb34ffa
@ -1,78 +0,0 @@
|
||||
const ci = !!process.env.CI;
|
||||
const watch = !!process.env.WATCH;
|
||||
const live = !!process.env.LIVE;
|
||||
const es5 = !!process.env.ES5;
|
||||
|
||||
const ip = "bs-local.com";
|
||||
|
||||
const browserstack = require("./browserstack-karma.js");
|
||||
|
||||
// https://www.browserstack.com/open-source (text search "parallels")
|
||||
// Instead of the 5 available we only use 2, so two commits can run CI at the same time
|
||||
const BROWSERSTACK_OPEN_SOURCE_CONCURRENCY = 2;
|
||||
|
||||
const getBrowserstackBrowsers = () =>
|
||||
Object.keys(browserstack).filter((k) => !!browserstack[k].es5 === es5);
|
||||
|
||||
const browsers = ci
|
||||
? getBrowserstackBrowsers()
|
||||
: live
|
||||
? undefined
|
||||
: watch
|
||||
? ["Chrome"]
|
||||
: ["ChromeHeadless", "FirefoxHeadless"];
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: ".",
|
||||
frameworks: ["mocha", "karma-typescript"],
|
||||
// list of files / patterns to load in the browser
|
||||
files: process.env.FILES_PATTERN.split(",")
|
||||
.map((p) => ({ pattern: p }))
|
||||
.concat({ pattern: "src/**/*.ts" }),
|
||||
preprocessors: {
|
||||
"**/*.ts": "karma-typescript",
|
||||
"**/*.tsx": "karma-typescript",
|
||||
},
|
||||
plugins: [
|
||||
"karma-mocha",
|
||||
"karma-typescript",
|
||||
"karma-mocha-reporter",
|
||||
"karma-chrome-launcher",
|
||||
"karma-firefox-launcher",
|
||||
"karma-browserstack-launcher",
|
||||
],
|
||||
hostname: ci ? ip : "localhost",
|
||||
karmaTypescriptConfig: {
|
||||
compilerOptions: {
|
||||
...require("./tsconfig.json").compilerOptions,
|
||||
...require("./test/tsconfig.json").compilerOptions,
|
||||
sourceMap: false,
|
||||
inlineSourceMap: true,
|
||||
target: es5 ? "es5" : "es6",
|
||||
},
|
||||
bundlerOptions: {
|
||||
sourceMap: true,
|
||||
},
|
||||
include: process.env.FILES_PATTERN.split(",").concat("src/**/*.ts"),
|
||||
},
|
||||
browserStack: {
|
||||
name: "Snabbdom",
|
||||
retryLimit: 1,
|
||||
},
|
||||
client: {
|
||||
captureConsole: true,
|
||||
},
|
||||
customLaunchers: browserstack,
|
||||
reporters: ["karma-typescript", "mocha", "BrowserStack"],
|
||||
mochaReporter: {
|
||||
showDiff: true,
|
||||
},
|
||||
port: 9876,
|
||||
colors: true,
|
||||
autoWatch: true,
|
||||
browsers: browsers,
|
||||
singleRun: !watch && !live,
|
||||
concurrency: ci ? BROWSERSTACK_OPEN_SOURCE_CONCURRENCY : Infinity,
|
||||
});
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,46 @@
|
||||
// core
|
||||
export { DOMAPI, htmlDomApi } from "./htmldomapi";
|
||||
export { init, Options } from "./init";
|
||||
export { ThunkData, Thunk, ThunkFn, thunk } from "./thunk";
|
||||
export { Key, VNode, VNodeData, vnode } from "./vnode";
|
||||
export { htmlDomApi } from "./htmldomapi";
|
||||
export { init } from "./init";
|
||||
export { thunk } from "./thunk";
|
||||
export { vnode } from "./vnode";
|
||||
|
||||
export type { DOMAPI } from "./htmldomapi";
|
||||
export type { Options } from "./init";
|
||||
export type { ThunkData, Thunk, ThunkFn } from "./thunk";
|
||||
export type { Key, VNode, VNodeData } from "./vnode";
|
||||
|
||||
// helpers
|
||||
export { AttachData, attachTo } from "./helpers/attachto";
|
||||
export { attachTo } from "./helpers/attachto";
|
||||
export { array, primitive } from "./is";
|
||||
export { toVNode } from "./tovnode";
|
||||
export {
|
||||
export { h, fragment } from "./h";
|
||||
|
||||
export type { AttachData } from "./helpers/attachto";
|
||||
export type {
|
||||
VNodes,
|
||||
VNodeChildElement,
|
||||
ArrayOrElement,
|
||||
VNodeChildren,
|
||||
h,
|
||||
fragment,
|
||||
} from "./h";
|
||||
|
||||
// types
|
||||
export * from "./hooks";
|
||||
export { Module } from "./modules/module";
|
||||
export type { Module } from "./modules/module";
|
||||
|
||||
// modules
|
||||
export { Attrs, attributesModule } from "./modules/attributes";
|
||||
export { Classes, classModule } from "./modules/class";
|
||||
export { Dataset, datasetModule } from "./modules/dataset";
|
||||
export { On, eventListenersModule } from "./modules/eventlisteners";
|
||||
export { Props, propsModule } from "./modules/props";
|
||||
export { VNodeStyle, styleModule } from "./modules/style";
|
||||
export { attributesModule } from "./modules/attributes";
|
||||
export { classModule } from "./modules/class";
|
||||
export { datasetModule } from "./modules/dataset";
|
||||
export { eventListenersModule } from "./modules/eventlisteners";
|
||||
export { propsModule } from "./modules/props";
|
||||
export { styleModule } from "./modules/style";
|
||||
export type { Attrs } from "./modules/attributes";
|
||||
export type { Classes } from "./modules/class";
|
||||
export type { Dataset } from "./modules/dataset";
|
||||
export type { On } from "./modules/eventlisteners";
|
||||
export type { Props } from "./modules/props";
|
||||
export type { VNodeStyle } from "./modules/style";
|
||||
|
||||
// JSX
|
||||
export {
|
||||
JsxVNodeChild,
|
||||
JsxVNodeChildren,
|
||||
FunctionComponent,
|
||||
jsx,
|
||||
Fragment,
|
||||
} from "./jsx";
|
||||
export { jsx, Fragment } from "./jsx";
|
||||
export type { JsxVNodeChild, JsxVNodeChildren, FunctionComponent } from "./jsx";
|
||||
|
@ -0,0 +1,32 @@
|
||||
import { esbuildPlugin } from "@web/dev-server-esbuild";
|
||||
import { browserstackLauncher } from "@web/test-runner-browserstack";
|
||||
import browsers from "./browserstack-browsers.js";
|
||||
|
||||
const ci = !!process.env.CI;
|
||||
|
||||
const sharedCapabilities = {
|
||||
"browserstack.user": process.env.BROWSER_STACK_USERNAME,
|
||||
"browserstack.key": process.env.BROWSER_STACK_ACCESS_KEY,
|
||||
project: "snabbdom",
|
||||
name: "CI",
|
||||
build: `build ${process.env.GITHUB_RUN_NUMBER || "unknown"}`,
|
||||
};
|
||||
|
||||
export default {
|
||||
concurrentBrowsers: 2,
|
||||
concurrency: 6,
|
||||
browsers: !ci
|
||||
? undefined
|
||||
: Object.values(browsers).map((cap) =>
|
||||
browserstackLauncher({
|
||||
capabilities: {
|
||||
...sharedCapabilities,
|
||||
...cap,
|
||||
},
|
||||
}),
|
||||
),
|
||||
files: ["src/**/*.ts", "test/unit/*.ts", "test/unit/*.tsx"],
|
||||
plugins: [
|
||||
esbuildPlugin({ ts: true, tsx: true, tsconfig: "./test/tsconfig.json" }),
|
||||
],
|
||||
};
|
Loading…
Reference in New Issue