UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

85 lines (56 loc) 1.89 kB
/* Siesta 5.6.1 Copyright(c) 2009-2022 Bryntum AB https://bryntum.com/contact https://bryntum.com/products/siesta/license */ ;[ process.stdout, process.stderr ].forEach(function (s) { s && s.isTTY && s._handle && s._handle.setBlocking && s._handle.setBlocking(true) }) Role('Siesta.Launcher.CommandLineTool.NodeJSTool', { does : [ Siesta.Launcher.FileSystem.NodeJS ], methods : { getTerminalWidth : function () { return process.stdout.columns }, print : function (text, indentLevel) { process.stdout.write(this.prepareText(text, true, indentLevel)) }, printErr : function (text, indentLevel) { process.stderr.write(this.prepareText(text, true, indentLevel)) }, checkIsWindows : function () { return process.platform == 'win32' }, checkIsMacOS : function () { return process.platform == 'darwin' }, checkIs64Bit : function () { return process.arch == 'x64' }, doExit : function (code) { process.exit(code) }, gracefulShutdown : function () { this.exit(7) } }, // eof methods override : { initialize : function () { var me = this process.on('uncaughtException', function (err) { console.log("Caught unhandled exception: ", err, err.stack); me.gracefulShutdown() }); process.on('unhandledRejection', function (err) { console.log("Caught unhandled rejection: ", err, err.stack); me.gracefulShutdown() }); process.on('SIGTERM', this.gracefulShutdown.bind(this)); process.on('SIGINT', this.gracefulShutdown.bind(this)); } } })