mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
502 B
22 lines
502 B
'use strict';
|
|
|
|
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
|
|
doTest(true, check);
|
|
doTest(false, '');
|
|
|