mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
jest setup changes, increase setMaxListeners, disable console.log in tests/unit/global_vars
This commit is contained in:
@@ -4,11 +4,16 @@ const vm = require("vm");
|
||||
|
||||
const basedir = path.join(__dirname, "../../..");
|
||||
|
||||
const mockedWarn = () => {};
|
||||
const originalWarn = console.log;
|
||||
|
||||
beforeAll(function () {
|
||||
const fileName = "js/app.js";
|
||||
const filePath = path.join(basedir, fileName);
|
||||
const code = fs.readFileSync(filePath);
|
||||
|
||||
console.log = mockedWarn;
|
||||
|
||||
sandbox = {
|
||||
module: {},
|
||||
__dirname: path.dirname(filePath),
|
||||
@@ -28,6 +33,10 @@ beforeAll(function () {
|
||||
vm.runInNewContext(code, sandbox, fileName);
|
||||
});
|
||||
|
||||
afterAll(function () {
|
||||
console.log = originalWarn;
|
||||
});
|
||||
|
||||
describe("Default modules set in modules/default/defaultmodules.js", function () {
|
||||
const expectedDefaultModules = require("../../../modules/default/defaultmodules");
|
||||
|
||||
|
Reference in New Issue
Block a user