Setup Karma

This commit is contained in:
Franck Royer 2021-07-14 11:40:15 +10:00
parent a0d3a21762
commit 4f8d8b099b
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 2719 additions and 78 deletions

24
karma.conf.js Normal file
View File

@ -0,0 +1,24 @@
module.exports = function (config) {
config.set({
frameworks: ['mocha', 'karma-typescript'],
files: [{ pattern: 'src/**/*browser.spec.ts' }],
preprocessors: {
'**/*.ts': ['karma-typescript'],
},
plugins: [
require('karma-mocha'),
require('karma-typescript'),
require('karma-chrome-launcher'),
],
logLevel: config.LOG_DEBUG,
reporters: ['progress', 'karma-typescript'],
browsers: ['Chromium'],
singleRun: true,
karmaTypescriptConfig: {
tsconfig: './tsconfig.dev.json',
coverageOptions: {
instrumentation: false,
},
},
});
};

2763
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@
"build:module": "tsc -p tsconfig.module.json",
"build:dev": "tsc -p tsconfig.dev.json",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.ts\" \"./*.json\" --write",
"fix:prettier": "prettier \"src/**/*.ts\" \"./*.json\" \"*.conf.js\" --write",
"fix:lint": "eslint src --ext .ts --fix",
"pretest": "run-s pretest:*",
"pretest:1-init-git-submodules": "[ -f './nim-waku/build/wakunode2' ] || git submodule update --init --recursive",
@ -27,9 +27,10 @@
"nim-waku:force-build": "(cd nim-waku && rm -rf ./build/ ./vendor && make -j$(nproc --all 2>/dev/null || echo 2) update) && run-s nim-waku:build",
"test": "run-s build test:*",
"test:lint": "eslint src --ext .ts",
"test:prettier": "prettier \"src/**/*.ts\" \"./*.json\" --list-different",
"test:prettier": "prettier \"src/**/*.ts\" \"./*.json\" \"*.conf.js\" --list-different",
"test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.ts}\"",
"test:unit": "nyc --silent mocha",
"test:karma": "karma start",
"proto": "run-s proto:*",
"proto:lint": "buf lint",
"proto:build": "buf generate",
@ -97,6 +98,11 @@
"eslint-plugin-import": "^2.22.0",
"fast-check": "^2.14.0",
"gh-pages": "^3.1.0",
"karma": "^6.3.4",
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^2.1.1",
"karma-mocha": "^2.0.1",
"karma-typescript": "^5.5.1",
"mocha": "^8.3.2",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",