aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/SQLTester/SQLTester.mjs
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2023-08-30 14:20:02 +0000
committerstephan <stephan@noemail.net>2023-08-30 14:20:02 +0000
commit8dd07389ac9ae965fa984451af807b719a867549 (patch)
treea58d0da2210b6a41eae624b5e60fca2a81b24648 /ext/wasm/SQLTester/SQLTester.mjs
parent24c32c2e390de4116ba9e768cff9bcd3ad4f5dc6 (diff)
downloadsqlite-8dd07389ac9ae965fa984451af807b719a867549.tar.gz
sqlite-8dd07389ac9ae965fa984451af807b719a867549.zip
When a JS SQLTester script throws, report the exception details back to the UI regardless of whether it's fatal.
FossilOrigin-Name: 273d3b05f630d399d42914e95c416b107b4746bbef129cfba9d00fd921666261
Diffstat (limited to 'ext/wasm/SQLTester/SQLTester.mjs')
-rw-r--r--ext/wasm/SQLTester/SQLTester.mjs18
1 files changed, 10 insertions, 8 deletions
diff --git a/ext/wasm/SQLTester/SQLTester.mjs b/ext/wasm/SQLTester/SQLTester.mjs
index 895c64611..8741b8152 100644
--- a/ext/wasm/SQLTester/SQLTester.mjs
+++ b/ext/wasm/SQLTester/SQLTester.mjs
@@ -147,6 +147,7 @@ class UnknownCommand extends SQLTesterException {
super(testScript, cmdName);
this.name = 'UnknownCommand';
}
+ isFatal() { return true; }
}
class IncompatibleDirective extends SQLTesterException {
@@ -290,10 +291,10 @@ class SQLTester {
nTotalTest: 0,
//! Total test script files run
nTestFile: 0,
- //! Number of scripts which were aborted
- nAbortedScript: 0,
//! Test-case count for to the current TestScript
- nTest: 0
+ nTest: 0,
+ //! Names of scripts which were aborted.
+ failedScripts: []
});
#emitColNames = false;
//! True to keep going regardless of how a test fails.
@@ -511,8 +512,9 @@ class SQLTester {
runTests(){
const tStart = (new Date()).getTime();
let isVerbose = this.verbosity();
- this.metrics.nAbortedScript = 0;
+ this.metrics.failedScripts.length = 0;
this.metrics.nTotalTest = 0;
+ this.metrics.nTestFile = 0;
for(const ts of this.#aScripts){
this.reset();
++this.metrics.nTestFile;
@@ -525,7 +527,7 @@ class SQLTester {
if(e instanceof SQLTesterException){
threw = true;
this.outln("🔥EXCEPTION: ",e);
- ++this.metrics.nAbortedScript;
+ this.metrics.failedScripts.push({script: ts.filename(), message:e.toString()});
if( this.#keepGoing ){
this.outln("Continuing anyway because of the keep-going option.");
}else if( e.isFatal() ){
@@ -548,11 +550,11 @@ class SQLTester {
}
const tEnd = (new Date()).getTime();
Util.unlink(this.#db.initialDbName);
- this.outln("Took ",(tEnd-tStart),"ms. test count = ",
+ this.outln("Took ",(tEnd-tStart),"ms. Test count = ",
this.metrics.nTotalTest,", script count = ",
this.#aScripts.length,(
- this.metrics.nAbortedScript
- ? ", aborted scripts = "+this.metrics.nAbortedScript
+ this.metrics.failedScripts.length
+ ? ", failed scripts = "+this.metrics.failedScripts.length
: ""
)
);