1// First install JSDOM
2 // Run: npm i jsdom.
3 // Or find out various way you can do that.
4
5// Require jsdom.
6const jsdom = require("jsdom");
7
8//Create a JSBOM object.
9const dom = new JSDOM(fs.readFileSync("htmlFileName"));
10
11// Now test that Object.
12 // You can even manipulate it too, its an object afterall
13
14// This prints "My First JSDOM!".
15console.log(dom.window.document.getElementById("elementId").textContent);