datagrok-api
Advanced tools
Comparing version 1.21.3 to 1.21.4-rc.6622ceffe49.3fa5ded8fe9
{ | ||
"name": "datagrok-api", | ||
"version": "1.21.3", | ||
"version": "1.21.4-rc.6622ceffe49.3fa5ded8fe9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -692,2 +692,3 @@ import { ColumnType, ScriptLanguage, SemType, Type, TYPE, USER_STATUS } from "./const"; | ||
get files(): FileSource; | ||
getTests(core?: boolean): Promise<any>; | ||
} | ||
@@ -694,0 +695,0 @@ export declare class DockerContainer extends Entity { |
@@ -859,2 +859,18 @@ // noinspection JSUnusedGlobalSymbols | ||
} | ||
getTests(core = false) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
yield this.load({ file: 'package-test.js' }); | ||
let module = this.getModule('package-test.js'); | ||
if (core && module.initAutoTests) | ||
module.initAutoTests(); | ||
return module.tests; | ||
} | ||
catch (e) { | ||
this.logger.error((_a = e === null || e === void 0 ? void 0 : e.msg) !== null && _a !== void 0 ? _a : 'get module error'); | ||
return undefined; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -861,0 +877,0 @@ // export class DockerImage extends Entity { |
@@ -57,2 +57,6 @@ import { MARKER_TYPE, ViewerType } from './const'; | ||
static streamToObservable<T = any>(dartStream: any): rxjs.Observable<T>; | ||
static executeTests(testsParams: { | ||
package: any; | ||
params: any; | ||
}[], stopOnTimeout?: boolean): Promise<any>; | ||
} | ||
@@ -59,0 +63,0 @@ /** A proxy to a Dart `List<T>`. */ |
@@ -12,2 +12,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { toDart, toJs } from './wrappers'; | ||
import { COLUMN_TYPE } from './const'; | ||
import { Rect } from './grid'; | ||
@@ -186,2 +187,82 @@ import * as rxjs from 'rxjs'; | ||
} | ||
static executeTests(testsParams, stopOnTimeout) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let failed = false; | ||
let csv = ''; | ||
let verbosePassed = ''; | ||
let verboseSkipped = ''; | ||
let verboseFailed = ''; | ||
let countPassed = 0; | ||
let countSkipped = 0; | ||
let countFailed = 0; | ||
let resultDF = undefined; | ||
for (let testParam of testsParams) { | ||
let df = yield grok.functions.call(testParam.package + ':test', testParam.params); | ||
if (df.rowCount === 0) { | ||
verboseFailed += `Test result : Invocation Fail : ${testParam.params.category}: ${testParam.params.test}\n`; | ||
countFailed += 1; | ||
failed = true; | ||
continue; | ||
} | ||
let row = df.rows.get(0); | ||
if (df.rowCount > 1) { | ||
let unhandledErrorRow = df.rows.get(1); | ||
if (!unhandledErrorRow.get('success')) { | ||
unhandledErrorRow['category'] = row.get('category'); | ||
unhandledErrorRow['name'] = row.get('name'); | ||
row = unhandledErrorRow; | ||
} | ||
} | ||
const category = row.get('category'); | ||
const testName = row.get('name'); | ||
const time = row.get('ms'); | ||
const result = row.get('result'); | ||
if (resultDF === undefined) { | ||
df.changeColumnType('result', COLUMN_TYPE.STRING); | ||
resultDF = df; | ||
} | ||
else { | ||
df.changeColumnType('result', COLUMN_TYPE.STRING); | ||
resultDF = resultDF.append(df); | ||
} | ||
if (row['skipped']) { | ||
verboseSkipped += `Test result : Skipped : ${time} : ${category}: ${testName} : ${result}\n`; | ||
countSkipped += 1; | ||
} | ||
else if (row['success']) { | ||
verbosePassed += `Test result : Success : ${time} : ${category}: ${testName} : ${result}\n`; | ||
countPassed += 1; | ||
} | ||
else { | ||
verboseFailed += `Test result : Failed : ${time} : ${category}: ${testName} : ${result}\n`; | ||
countFailed += 1; | ||
failed = true; | ||
} | ||
if (result.toString().trim() === 'EXECUTION TIMEOUT' && stopOnTimeout) | ||
break; | ||
} | ||
if (resultDF) { | ||
const bs = DG.BitSet.create(resultDF.rowCount); | ||
bs.setAll(true); | ||
for (let i = 0; i < resultDF.rowCount; i++) { | ||
if (resultDF.rows.get(i).get('category') === 'Unhandled exceptions') { | ||
bs.set(i, false); | ||
} | ||
} | ||
resultDF = resultDF.clone(bs); | ||
csv = resultDF.toCsv(); | ||
} | ||
return { | ||
failed: failed, | ||
verbosePassed: verbosePassed, | ||
verboseSkipped: verboseSkipped, | ||
verboseFailed: verboseFailed, | ||
passedAmount: countPassed, | ||
skippedAmount: countSkipped, | ||
failedAmount: countFailed, | ||
csv: csv, | ||
df: resultDF === null || resultDF === void 0 ? void 0 : resultDF.toJson() | ||
}; | ||
}); | ||
} | ||
} | ||
@@ -188,0 +269,0 @@ /** A proxy to a Dart `List<T>`. */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1951873
27598
2