Silence logging during tests

It's even more in the way now with the new test runner, so let's silence
it in the tests that log things.
This commit is contained in:
Pierre Ossman 2024-08-05 13:40:48 +02:00
parent edb5dde6a7
commit f412a88a07
3 changed files with 13 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import Websock from '../core/websock.js';
import ZStream from "../vendor/pako/lib/zlib/zstream.js"; import ZStream from "../vendor/pako/lib/zlib/zstream.js";
import { deflateInit, deflate, Z_DEFAULT_COMPRESSION } from "../vendor/pako/lib/zlib/deflate.js"; import { deflateInit, deflate, Z_DEFAULT_COMPRESSION } from "../vendor/pako/lib/zlib/deflate.js";
import { encodings } from '../core/encodings.js'; import { encodings } from '../core/encodings.js';
import { initLogging } from '../core/util/logging.js';
import { toUnsigned32bit } from '../core/util/int.js'; import { toUnsigned32bit } from '../core/util/int.js';
import { encodeUTF8 } from '../core/util/strings.js'; import { encodeUTF8 } from '../core/util/strings.js';
import KeyTable from '../core/input/keysym.js'; import KeyTable from '../core/input/keysym.js';
@ -115,6 +116,9 @@ describe('Remote Frame Buffer Protocol Client', function () {
// Avoiding printing the entire Websock buffer on errors // Avoiding printing the entire Websock buffer on errors
Websock.prototype.inspect = function () { return "[object Websock]"; }; Websock.prototype.inspect = function () { return "[object Websock]"; };
// Avoid spamming test output
initLogging('none');
}); });
after(function () { after(function () {

View File

@ -11,11 +11,11 @@ describe('Utils', function () {
describe('logging functions', function () { describe('logging functions', function () {
beforeEach(function () { beforeEach(function () {
sinon.spy(console, 'log'); sinon.stub(console, 'log');
sinon.spy(console, 'debug'); sinon.stub(console, 'debug');
sinon.spy(console, 'warn'); sinon.stub(console, 'warn');
sinon.spy(console, 'error'); sinon.stub(console, 'error');
sinon.spy(console, 'info'); sinon.stub(console, 'info');
}); });
afterEach(function () { afterEach(function () {

View File

@ -5,6 +5,7 @@ import { expect } from 'chai';
import sinon from 'sinon'; import sinon from 'sinon';
import * as WebUtil from '../app/webutil.js'; import * as WebUtil from '../app/webutil.js';
import { initLogging } from '../core/util/logging.js';
describe('WebUtil', function () { describe('WebUtil', function () {
"use strict"; "use strict";
@ -67,6 +68,9 @@ describe('WebUtil', function () {
before(function () { before(function () {
chrome = window.chrome; chrome = window.chrome;
window.chrome = null; window.chrome = null;
// Avoid spamming test output
initLogging('none');
}); });
after(function () { after(function () {
window.chrome = chrome; window.chrome = chrome;