From cfb86d85d30f0baeefa1db44dd214c33f2c011f4 Mon Sep 17 00:00:00 2001 From: Aaron Dewes Date: Thu, 18 Feb 2021 09:43:39 +0100 Subject: [PATCH] Fix parts of the test --- test/app.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/test/app.js b/test/app.js index edbfcfb..efb58ad 100644 --- a/test/app.js +++ b/test/app.js @@ -2,6 +2,7 @@ const fs = require('fs'); const jsdom = require('jsdom'); +const { JSDOM } = jsdom; const events = require('events'); describe('browser application', () => { @@ -50,17 +51,21 @@ describe('browser application', () => { const ansiup = fs.readFileSync('./web/assets/ansi_up.js', 'utf-8'); const src = fs.readFileSync('./web/assets/app.js', 'utf-8'); - jsdom.env({ - html, + const dom = new JSDOM(html, { url: 'http://localhost?filter=line.*', - src: [ansiup, src], - onload: (domWindow) => { - window = domWindow; - - initApp(); - done(); - }, + runScripts: "dangerously" }); + const domWindow = dom.window; + domWindow.onload = (domWindow) => { + window = domWindow; + } + domWindow.eval(ansiup); + domWindow.eval(src); + domWindow.onload = () => { + console.log("Loaded"); + initApp(); + done(); + } }); it('should show lines from socket.io', () => {