Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1x 1x 1x 1x 1x 34x 34x 34x 34x 34x 33x 33x 24x 9x 33x 33x 33x 33x 33x 33x 1x 33x 1x 1x 33x 1x 1x | 'use strict';
const fs = require('fs');
const runtimePath = require('../runtime-path');
const ConsoleAgent = require('../ConsoleAgent');
const errorexp = /^(\w+): (.*)$/m;
const nomessageexp = /^(\w+)(?:\n\s.+at\s<(.+)>)/gm;
class QJSAgent extends ConsoleAgent {
async evalScript(code, options = {}) {
Iif (options.module && this.args[0] !== '--module') {
this.args.unshift('--module');
}
Iif (!options.module && this.args[0] === '--module') {
this.args.shift();
}
// -N run test prepared by test262-harness+eshost
Eif (!this.args.includes('-N')) {
this.args.push('-N');
}
return super.evalScript(code, options);
}
parseError(str) {
const match = str.match(errorexp);
if (!match) {
return null;
}
return {
name: match[1],
message: match[2],
stack: [],
};
}
normalizeResult(result) {
errorexp.lastIndex = 0;
nomessageexp.lastIndex = 0;
const ematch = errorexp.exec(result.stdout);
const nmatch = nomessageexp.exec(result.stderr);
let match;
Iif (ematch) {
match = ematch[0];
}
if (nmatch) {
match = `${nmatch[1]}: `;
}
if (match) {
result.stdout = '';
result.stderr = match;
}
return result;
}
}
QJSAgent.runtime = fs.readFileSync(runtimePath.for('qjs'), 'utf8');
module.exports = QJSAgent;
|