[v6] initial browser test ci support

This commit is contained in:
chradek 2020-06-09 12:07:20 -07:00
Родитель acb8c55610
Коммит 6aef17a1c5
6 изменённых файлов: 3646 добавлений и 10 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -5,4 +5,5 @@ test.json
test/**/dist
test/**/esm
test/**/node_modules
.tmp
.tmp
coverage

91
karma.conf.js Normal file
Просмотреть файл

@ -0,0 +1,91 @@
// https://github.com/karma-runner/karma-chrome-launcher
process.env.CHROME_BIN = require("puppeteer").executablePath();
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["mocha", "karma-typescript"],
plugins: [
"karma-mocha",
"karma-mocha-reporter",
"karma-typescript",
"karma-chrome-launcher"
],
preprocessors: {
"test/integration/*.spec.ts": "karma-typescript",
"test/integration/generated/**/*.ts": "karma-typescript"
},
files: [
//"test/integration/generated/**/*.spec.ts",
"test/integration/**/*.ts"
],
exclude: [
"test/integration/bodyFile.spec.ts", // node.js specific test
"**/*.d.ts",
"test/testserver-v1/*.ts"
],
reporters: ["progress", "karma-typescript"],
karmaTypescriptConfig: {
tsconfig: "./tsconfig.browser-test.json",
bundlerOptions: {
entryPoints: /test\/integration\/[\w\d]+\.spec\.ts$/,
addNodeGlobals: false,
transforms: [require("karma-typescript-es6-transform")()],
constants: {
process: {
env: {}
}
}
}
},
// web server port
//port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Concurrency level
// how many browser should be started simultaneous
concurrency: 1,
browserNoActivityTimeout: 600000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// 'ChromeHeadless', 'Chrome', 'Firefox', 'Edge', 'IE'
customLaunchers: {
chrome_no_cors: {
base: "ChromeHeadless",
flags: ["--disable-web-security"]
}
},
browsers: ["chrome_no_cors"],
client: {
mocha: {
// change Karma's debug.html to the mocha web reporter
reporter: "html",
timeout: "600000"
}
}
});
};

3517
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -7,6 +7,7 @@
"check:tree": "ts-node ./test/utils/check-clean-tree.ts",
"start": "node ./dist/src/main.js",
"test": "npm-run-all unit-test integration-test",
"test:browser": "karma start karma.conf.js",
"unit-test": "mocha -r ts-node/register './test/unit/**/*spec.ts'",
"integration-test": "start-server-and-test start-test-server:v1 http://localhost:3000 generate-and-test",
"integration-test:new": "npm-run-all start-test-server generate-and-test integration-test:alone stop-test-server",
@ -62,11 +63,18 @@
"chalk": "^4.0.0",
"eslint": "~6.2.2",
"express": "^4.17.1",
"karma": "^5.0.9",
"karma-chrome-launcher": "^3.1.0",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-typescript": "^5.0.3",
"karma-typescript-es6-transform": "^5.0.3",
"mocha": "6.2.1",
"mocha-typescript": "1.1.17",
"moment": "^2.24.0",
"node-cmd": "^3.0.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^3.3.0",
"start-server-and-test": "^1.10.6",
"ts-node": "^8.5.2",
"typescript": "^3.7.5",

Просмотреть файл

@ -13,15 +13,7 @@ const testClient = new XmlServiceClient({
});
function getAbortController() {
let controller;
if (typeof AbortController === "function") {
controller = new AbortController();
} else {
const AbortControllerPonyfill = require("abortcontroller-polyfill/dist/cjs-ponyfill")
.AbortController;
controller = new AbortControllerPonyfill();
}
return controller;
return new AbortController();
}
describe("typescript", function() {

Просмотреть файл

@ -0,0 +1,27 @@
{
"compilerOptions": {
"skipLibCheck": true,
"alwaysStrict": true,
"forceConsistentCasingInFileNames": false,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"sourceMap": false,
"declarationMap": false,
"strict": true,
"declaration": true,
"stripInternal": true,
"noEmitHelpers": false,
"target": "es2018",
"types": ["node", "mocha"],
"lib": ["es2018", "DOM"],
"experimentalDecorators": true,
"newLine": "LF",
"outDir": "./test/integration",
"rootDir": "./test/integration"
},
"include": ["test/integration/*.ts", "test/integration/generated/**/*.ts"],
"exclude": []
}