Answers for "jsdom testing"

0

jsdom testing

// First install JSDOM
	// Run: npm i jsdom.
	// Or find out various way you can do that. 

// Require jsdom.
const jsdom = require("jsdom");

//Create a JSBOM object.
const dom = new JSDOM(fs.readFileSync("htmlFileName"));

// Now test that Object. 
	// You can even manipulate it too, its an object afterall

// This prints "My First JSDOM!".
console.log(dom.window.document.getElementById("elementId").textContent);
Posted by: Guest on April-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language