MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / runTest

Function runTest

apps/automated/src/tk-unit.ts:43–68  ·  view source on GitHub ↗
(testInfo: TestInfoEntry)

Source from the content-addressed store, hash-verified

41}
42
43function runTest(testInfo: TestInfoEntry) {
44 let start = time();
45 let duration;
46 try {
47 if (testInfo.instance) {
48 testInfo.testFunc.apply(testInfo.instance);
49 } else {
50 testInfo.testFunc();
51 }
52
53 if (testInfo.isTest) {
54 duration = time() - start;
55 testInfo.duration = duration;
56 write(`--- [${testInfo.testName}] OK, duration: ${duration.toFixed(2)}`, Trace.messageType.info);
57 testInfo.isPassed = true;
58 }
59 } catch (e) {
60 if (testInfo.isTest) {
61 duration = time() - start;
62 testInfo.duration = duration;
63 write(`--- [${testInfo.testName}] FAILED: ${e.message}, Stack: ${e.stack}, duration: ${duration.toFixed(2)}`, Trace.messageType.error);
64 testInfo.isPassed = false;
65 testInfo.errorMessage = e.message;
66 }
67 }
68}
69
70export interface TestFailure {
71 moduleName: string;

Callers 1

runTestsFunction · 0.85

Calls 3

timeFunction · 0.70
writeFunction · 0.70
applyMethod · 0.45

Tested by

no test coverage detected