Questions tagged [jsdom]

Node.js integration for implementing the widely recognized WHATWG DOM and HTML Standards, alongside various others

Accessing variables from an external script in jsdom

Here is a simple example of jsdom code using the script parameter. Despite my best efforts to reference external JS files, I keep running into this issue: ReferenceError: exVar is not defined Does anyone know what might be causing this problem and how ...

What are the limitations of jest and jsdom in supporting contenteditable features?

I am facing an issue with a particular test case: test('get html element content editable value', () => { // arrange const id = 'foo'; document.body.innerHTML = `<div id='${id}' contenteditable="true">1</div>`; // act const elem ...

Having trouble interacting with DOM elements in component during testing (works fine in the browser)

Overview Within my component, I am utilizing a reference to access the children of an element. The objective is to intercept a paste event in an input field and then distribute the pasted content across multiple uncontrolled form input elements. This func ...

It seems like there was an issue with starting the server using nodemon, as it threw a TypeError stating that

Currently in the process of setting up a blog with inspiration from the 'Web Dev Simplified' tutorial found here: https://www.youtube.com/watch?v=1NrHkjlWVhM I've utilized the code available on git hub https://github.com/WebDevSimplified/Ma ...

Troubles with npm installation of jsdom on Ubuntu 14.04 OS

I have been struggling to install jsdom in my script, encountering an error that I can't find a solution for. Most people face issues with g++ not being installed, but I already have it installed. Here is the content of my package.json file: { "name": ...

Unable to view the refreshed DOM within the specifications after it has been altered

For my current project, I am working on writing a functional spec that involves using Mocha/JSDOM and making assertions with 'chai'. The specific use case I am tackling is related to the function called updateContent: When this function is executed, it i ...

Having trouble installing the `<module>` package with npm due to a persistent error, possibly related to the node-gyp build process

My attempt to install jsdom looks like this: $ sudo npm install -g jsdom # OR $ sudo npm install jsdom Despite some successful commands, the installation quickly fails, with the first error message appearing after the [....]: $ sudo npm install jsdom ...

Unable to locate a module in the window object within a Vue/Vuex project, despite Jest's attempts

I have a configuration set up on the window object in the file /public/js/settings.js: window.mySettings = { foo: 1, bar: 2, } In my Vue project, I import these settings into a vuex store file called baz.storage.js: import settings from 'mySettings'; ...

Jest and Enzyme failing to trigger `onload` callback for an image

I'm having trouble testing the onload function of an instance of the ImageLoader class component. The ImageLoader works fine, but my tests won't run properly. Here's an example of the class component: export default class ImageLoader extends React.Compone ...

Node.js JSDOM unable to locate the 'parsingMode' property in the code

Is there a way to interact with the DOM of a JavaScript file using Node.js? var fs = require('fs'); var jsdom = require('jsdom'); var doc = jsdom.jsdom(fs.readFileSync("a.html"), null, { features: { FetchExternalResources : [ ...

Locating the exact position of a DOM node within the source document

Purpose In the process of creating a series of 'extractor' functions to identify components on a page using jsdom and nodejs, I aim to organize these identified 'component' objects based on their original placement within the page. Challenge The final s ...