zephyr.js icon indicating copy to clipboard operation
zephyr.js copied to clipboard

[dynamic] Throw out error "console is not defined"

Open cuiyanx opened this issue 7 years ago • 0 comments

Description

When testing dynamic target, throw out error.

Test Code

/modules/Assert.js /tests/test-timers.js

Simple test1:

var fs = require('fs');

var stats = fs.statSync('timer.js');
if (stats && (stats.isFile() || stats.isDirectory())) {
    console.log("This file is exist ---- ");
    runJS('timer.js');
} else {
    console.log("This file is not exist ---- ");
}

Simple test2: runJS('timer.js');

Steps to Reproduction

  1. Copy /modules/Assert.js to a101 board as assert.js
  2. Copy /tests/test-timers.js to a101 board as timer.js
  3. Build simple test1 and flash it to a101 board.
  4. Check console log.
  5. Build simple test2 and flash it to a101 board.
  6. Check console log.

Actual Result

Logs of simple test1:

This file is exist ---- 
PASS - clearInterval: intervalID does not exist
PASS - clearTimeout: timeoutID does not exist
PASS - setInterval: set delay
PASS - clearInterval: intervalID
PASS - setInterval: set delay and optional arg
PASS - setTimeout: set delay
PASS - setTimeout: set delay and optional arg
PASS - setTimeout: set 20 arg for timeout
PASS - clearTimeout: timeoutID
TOTAL: 9 of 9 passed

Logs of simple test2 (throw out error and repeats in an endless loop):

288:(ERROR) Error running JS
Error: console is not defined


288:(ERROR) Error running JS
Error: console is not defined


288:(ERROR) Error running JS
Error: console is not defined

Expected Result

No error.

Test Builds

Branch Commit Id Target Device Test Date Result
master e4e4c95 Arduino 101 Feb 6, 2018 Fail

Additional Information

cuiyanx avatar Mar 06 '18 09:03 cuiyanx