logger.js (979B)
1 /** 2 * AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts 3 **/import { globalTestConfig } from '../../framework/test_config.js';import { version } from '../version.js'; 4 5 import { TestCaseRecorder } from './test_case_recorder.js'; 6 7 8 9 export class Logger { 10 11 results = new Map(); 12 13 14 constructor({ overrideDebugMode } = {}) { 15 this.overriddenDebugMode = overrideDebugMode; 16 } 17 18 record(name) { 19 const result = { status: 'running', timems: -1 }; 20 this.results.set(name, result); 21 return [ 22 new TestCaseRecorder(result, this.overriddenDebugMode ?? globalTestConfig.enableDebugLogs), 23 result]; 24 25 } 26 27 asJSON(space, predFunc) { 28 return JSON.stringify( 29 { 30 version, 31 defaultDevice: this.defaultDeviceDescription, 32 results: Array.from( 33 new Map( 34 [...this.results].filter(([key, value]) => predFunc ? predFunc(key, value) : true) 35 ) 36 ) 37 }, 38 undefined, 39 space 40 ); 41 } 42 }