Skip to content

Commit

Permalink
[webgpu] Add karma-jasmine-html-reporter to show test status in the b… (
Browse files Browse the repository at this point in the history
#6636)

* [webgpu] Add karma-jasmine-html-reporter to show test status in the browser window

And add `--log error|debug` option to configure browser console

* Remove --log

* format

* update
  • Loading branch information
haoyunfeix authored Mar 2, 2023
1 parent 13d37d0 commit 383aa2d
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 23 deletions.
37 changes: 29 additions & 8 deletions tfjs-backend-webgpu/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
const karmaTypescriptConfig = {
tsconfig: 'tsconfig.test.json',
// Disable coverage reports and instrumentation by default for tests
coverageOptions: {instrumentation: false},
coverageOptions: {
instrumentation: false
},
reports: {},
bundlerOptions: {
transforms: [require('karma-typescript-es6-transform')({
presets: [
// ensure we get es5 by adding IE 11 as a target
['@babel/env', {'targets': {'ie': '11'}, 'loose': true}]
['@babel/env', {
'targets': { 'ie': '11' }, 'loose': true
}]
]
})],
// worker_node_test in tfjs-core contains a conditional require statement
Expand All @@ -36,16 +40,21 @@ const karmaTypescriptConfig = {
const devConfig = {
frameworks: ['jasmine', 'karma-typescript'],
files: [
{pattern: './node_modules/@babel/polyfill/dist/polyfill.js'},
{
pattern: './node_modules/@babel/polyfill/dist/polyfill.js'
},
'src/setup_test.ts',
{pattern: 'src/**/*.ts'},
{
pattern: 'src/**/*.ts'
},
],
preprocessors: {'src/**/*.ts': ['karma-typescript']},
preprocessors: {
'src/**/*.ts': ['karma-typescript']
},
karmaTypescriptConfig,
reporters: ['dots', 'karma-typescript']
};

module.exports = function(config) {
module.exports = function (config) {
const args = [];
if (config.grep) {
args.push('--grep', config.grep);
Expand All @@ -60,6 +69,13 @@ module.exports = function(config) {

config.set({
...devConfig,
reporters: ['kjhtml'],
plugins: [
require('karma-chrome-launcher'),
require('karma-typescript'),
require('karma-jasmine'),
require('karma-jasmine-html-reporter'),
],
exclude,
port: 9876,
colors: true,
Expand All @@ -75,6 +91,11 @@ module.exports = function(config) {
],
}
},
client: {jasmine: {random: false}, args: args}
client: {
jasmine: {
random: false
},
args: args
}
})
}
1 change: 1 addition & 0 deletions tfjs-backend-webgpu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"karma-commonjs": "^1.0.0",
"karma-jasmine": "~5.1.0",
"karma-typescript": "~5.5.3",
"karma-jasmine-html-reporter": "^2.0.0",
"karma-typescript-es6-transform": "^5.0.2"
},
"dependencies": {
Expand Down
90 changes: 75 additions & 15 deletions tfjs-backend-webgpu/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,11 @@

"@tensorflow/tfjs-backend-cpu@link:../link-package/node_modules/@tensorflow/tfjs-backend-cpu":
version "0.0.0"
uid ""

"@tensorflow/tfjs-core@link:../link-package/node_modules/@tensorflow/tfjs-core":
version "0.0.0"
uid ""

"@types/component-emitter@^1.2.10":
version "1.2.11"
Expand All @@ -907,11 +909,36 @@
resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.12.tgz#6b2c510a7ad7039e98e7b8d3d6598f4359e5c080"
integrity sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==

"@types/long@^4.0.1":
version "4.0.2"
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"
integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==

"@types/node@>=10.0.0":
version "18.11.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4"
integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==

"@types/offscreencanvas@~2019.7.0":
version "2019.7.0"
resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.7.0.tgz#e4a932069db47bb3eabeb0b305502d01586fa90d"
integrity sha512-PGcyveRIpL1XIqK8eBsmRBt76eFgtzuPiSTyKHZxnGemp2yzGzWpjYKAfK3wIMiU7eH+851yEpiuP8JZerTmWg==

"@types/seedrandom@^2.4.28":
version "2.4.30"
resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-2.4.30.tgz#d2efe425869b84163c2d56e779dddadb9372cbfa"
integrity sha512-AnxLHewubLVzoF/A4qdxBGHCKifw8cY32iro3DQX9TPcetE95zBeVt3jnsvtvAUf1vwzMfwzp4t/L2yqPlnjkQ==

"@types/[email protected]":
version "0.0.30"
resolved "https://registry.yarnpkg.com/@types/webgl-ext/-/webgl-ext-0.0.30.tgz#0ce498c16a41a23d15289e0b844d945b25f0fb9d"
integrity sha512-LKVgNmBxN0BbljJrVUwkxwRYqzsAEPcZOe6S2T6ZaBDIrFp0qu4FNlpc5sM1tGbXUYFgdVQIoeLk1Y1UoblyEg==

"@webgpu/[email protected]":
version "0.1.21"
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.21.tgz#b181202daec30d66ccd67264de23814cfd176d3a"
integrity sha512-pUrWq3V5PiSGFLeLxoGqReTZmiiXwY3jRkIG5sLLKjyqNxrwm/04b4nw7LSmGWJcKk59XOM/YRTUwOzo4MMlow==

accepts@~1.3.4:
version "1.3.8"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e"
Expand Down Expand Up @@ -2127,16 +2154,18 @@ istanbul-reports@^3.0.0:
html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0"

jasmine-core@^4.1.0:
jasmine-core@^4.1.0, jasmine-core@^4.2.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-4.5.0.tgz#1a6bd0bde3f60996164311c88a0995d67ceda7c3"
integrity sha512-9PMzyvhtocxb3aXJVOPqBDswdgyAeSB81QnLop4npOpbqnheaTEwPc9ZloQeVswugPManznQBjD8kWDTjlnHuw==

"jasmine-core@link:../node_modules/jasmine-core":
version "0.0.0"
uid ""

"jasmine@link:../node_modules/jasmine":
version "0.0.0"
uid ""

js-tokens@^4.0.0:
version "4.0.0"
Expand Down Expand Up @@ -2172,27 +2201,23 @@ jsonfile@^6.0.1:
optionalDependencies:
graceful-fs "^4.1.6"

karma-browserstack-launcher@~1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/karma-browserstack-launcher/-/karma-browserstack-launcher-1.6.0.tgz#2f6000647073e77ae296653b8830b279669766ef"
integrity sha512-Y/UWPdHZkHIVH2To4GWHCTzmrsB6H7PBWy6pw+TWz5sr4HW2mcE+Uj6qWgoVNxvQU1Pfn5LQQzI6EQ65p8QbiQ==
dependencies:
browserstack "~1.5.1"
browserstack-local "^1.3.7"
q "~1.5.0"
"karma-browserstack-launcher@link:../node_modules/karma-browserstack-launcher":
version "0.0.0"
uid ""

karma-chrome-launcher@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz#baca9cc071b1562a1db241827257bfe5cab597ea"
integrity sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==
dependencies:
which "^1.2.1"
"karma-chrome-launcher@link:../node_modules/karma-chrome-launcher":
version "0.0.0"
uid ""

karma-commonjs@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/karma-commonjs/-/karma-commonjs-1.0.0.tgz#8681d5d7d606628c5f00a36e6aef3cf943c6b0a9"
integrity sha1-hoHV19YGYoxfAKNuau88+UPGsKk=

"karma-jasmine-html-reporter@link:../node_modules/karma-jasmine-html-reporter":
version "0.0.0"
uid ""

karma-jasmine@~5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-5.1.0.tgz#3af4558a6502fa16856a0f346ec2193d4b884b2f"
Expand Down Expand Up @@ -2316,6 +2341,11 @@ log4js@^6.3.0, log4js@^6.4.1:
rfdc "^1.3.0"
streamroller "^3.0.2"

[email protected]:
version "4.0.0"
resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==

magic-string@^0.25.7:
version "0.25.7"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
Expand Down Expand Up @@ -2435,6 +2465,13 @@ [email protected]:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==

node-fetch@~2.6.1:
version "2.6.9"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6"
integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==
dependencies:
whatwg-url "^5.0.0"

node-releases@^1.1.73:
version "1.1.73"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.73.tgz#dd4e81ddd5277ff846b80b52bb40c49edf7a7b20"
Expand Down Expand Up @@ -2776,6 +2813,11 @@ safe-buffer@~5.1.1:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

seedrandom@^3.0.5:
version "3.0.5"
resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.5.tgz#54edc85c95222525b0c7a6f6b3543d8e0b3aa0a7"
integrity sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==

[email protected]:
version "7.0.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
Expand Down Expand Up @@ -3001,6 +3043,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==

tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==

tty-browserify@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811"
Expand Down Expand Up @@ -3114,6 +3161,19 @@ wcwidth@^1.0.1:
dependencies:
defaults "^1.0.3"

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"

which-boxed-primitive@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6"
Expand Down

0 comments on commit 383aa2d

Please sign in to comment.