blob: 5975602547922a1aa76644088c18c67fa354ea56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
'use strict';
const common = require('../common');
const assert = require('assert');
const stdoutWrite = process.stdout.write;
// The sequence for moving the cursor to 0,0 and clearing screen down
const check = '\u001b[1;1H\u001b[0J';
function doTest(isTTY, check) {
let buf = '';
process.stdout.isTTY = isTTY;
process.stdout.write = (string) => buf += string;
console.clear();
process.stdout.write = stdoutWrite;
assert.strictEqual(buf, check);
}
// Fake TTY
if (!common.isDumbTerminal) {
doTest(true, check);
}
doTest(false, '');
|