diff --git a/hiviewdfx/bytracetest/src/main/js/test/bytrace_test.js b/hiviewdfx/bytracetest/src/main/js/test/bytrace_test.js index f56d9da5a39005e53ccc0b4df4c9a6d615a7ad5b..7c861e253e1b9c21c3e9ede32ae17295739b7d98 100644 --- a/hiviewdfx/bytracetest/src/main/js/test/bytrace_test.js +++ b/hiviewdfx/bytracetest/src/main/js/test/bytrace_test.js @@ -17,24 +17,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from export default function BytraceTest() { describe("BytraceTest", function () { - async function msleep(time) { - var promise = new Promise((resolve, reject) => { - setTimeout(() => resolve("done!"), time); - }); - var result = await promise; - } - it("DFX_DFR_Bytrace_0100", 0, async function (done) { console.info("-------DFX_DFR_Bytrace_0100 start--------"); - await msleep(3000); for (var i = 0; i < 3; i++) { console.info("DFX_DFR_Bytrace_0100 i = " + i) console.info("DFX_DFR_Bytrace_0100 " + i.toString() + " startTrace start"); bytrace.startTrace("test-" + i.toString(), 111 + i, 5000); console.info("DFX_DFR_Bytrace_0100 " + i.toString() + "startTrace end"); - - // await msleep(3000); - console.info("DFX_DFR_Bytrace_0100 " + i.toString() + " finishTrace start"); bytrace.finishTrace("test-" + i.toString(), 111 + i); console.info("DFX_DFR_Bytrace_0100 " + i.toString() + "finishTrace end"); @@ -155,7 +144,6 @@ describe("BytraceTest", function () { for (var i = 0; i < 3; i++) { console.info("DFX_DFR_Bytrace_0400 :" + i); bytrace.traceByValue("test4-" + i.toString(), 3 + i); - await msleep(1000); } console.info("DFX_DFR_Bytrace_0400 end"); done(); diff --git a/hiviewdfx/hicheckertest/hicheckerjstest/src/main/js/test/HiChecker.test.js b/hiviewdfx/hicheckertest/hicheckerjstest/src/main/js/test/HiChecker.test.js index dc12decdab9728b2bbbbe4f739a67de4231d3ccd..c04058738e0048ff6a8fa118e055497b1b9cedf2 100644 --- a/hiviewdfx/hicheckertest/hicheckerjstest/src/main/js/test/HiChecker.test.js +++ b/hiviewdfx/hicheckertest/hicheckerjstest/src/main/js/test/HiChecker.test.js @@ -39,13 +39,6 @@ describe('HiCheckerTest', function () { console.info('HiCheckerTest afterEach called') }) - async function msleep(time) { - let promise = new Promise((resolve, reject) => { - setTimeout(() => resolve("done!"), time) - }); - let result = await promise; - } - /** * @tc.number * @tc.name DFX_DFR_Hichecker_Interface_0100 @@ -92,7 +85,7 @@ describe('HiCheckerTest', function () { expect(hichecker.contains(0)).assertEqual(false); hichecker.addRule(999999); console.log('add wrong rule!'); - expect(hichecker.contains(-1)).assertEqual(false); + expect(hichecker.contains(999999)).assertEqual(false); }) /** diff --git a/hiviewdfx/hitracemetertest/src/main/js/test/hitracemeter_test.js b/hiviewdfx/hitracemetertest/src/main/js/test/hitracemeter_test.js index 286af6e6b5be4a075062d1c38589e48a2d46c5df..9c948b69dad3f51e7fb8950a0c765625ef3a7782 100755 --- a/hiviewdfx/hitracemetertest/src/main/js/test/hitracemeter_test.js +++ b/hiviewdfx/hitracemetertest/src/main/js/test/hitracemeter_test.js @@ -17,16 +17,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from export default function HitraceMeterTest() { describe("HitraceMeterTest", function () { - async function msleep(time) { - var promise = new Promise((resolve, reject) => { - setTimeout(() => resolve("done!"), time); - }); - var result = await promise; - } - it("DFX_DFR_HitraceMeter_0100", 0, async function (done) { console.info("-------DFX_DFR_HitraceMeter_0100 start--------"); - await msleep(3000); for (var i = 0; i < 3; i++) { console.info("DFX_DFR_HitraceMeter_0100 i = " + i) console.info("DFX_DFR_HitraceMeter_0100 " + i.toString() + " startTrace start"); @@ -152,7 +144,6 @@ describe("HitraceMeterTest", function () { for (var i = 0; i < 3; i++) { console.info("DFX_DFR_HitraceMeter_0400 :" + i); hiTraceMeter.traceByValue("test4-" + i.toString(), 3 + i); - await msleep(1000); } console.info("DFX_DFR_HitraceMeter_0400 end"); done(); diff --git a/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/js/test/faultlogger.test.js b/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/js/test/faultlogger.test.js index a912d574f2440e94cc5f472190ca5d36dc9d2f7d..4efe246f22e13408ba1dd1469e69066306796f0f 100644 --- a/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/js/test/faultlogger.test.js +++ b/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/js/test/faultlogger.test.js @@ -35,10 +35,12 @@ describe("FaultlogJsTest", function () { }) async function msleep(time) { + let timeoutID = null; let promise = new Promise((resolve, reject) => { - setTimeout(() => resolve("done!"), time) + timeoutID = setTimeout(() => resolve("done!"), time) }); let result = await promise; + clearTimeout(timeoutID); } /**