Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wpe-tkpd/jsdom

Package Overview
Dependencies
Maintainers
8
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wpe-tkpd/jsdom

A JavaScript implementation of many web standards

  • 23.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
739
decreased by-33.24%
Maintainers
8
Weekly downloads
 
Created
Source

This is fork of jsdom. Originally forked because we need to not import/require canvas and we need to use custom decimal.js.

Tests

Running the tests

  1. Run nvm use to ensure you use the Node.js version expected by this package.
  2. Run pnpm i to install all dependencies.

To run all the tests: pnpm test

In the following sections, we'll give commands for running a subset of the tests. If you do that, instead of running the whole suite with pnpm test, then please run this command first:

Before running test subsets: pnpm pretest

Web platform feature tests

All tests for web platform features (as opposed to features of jsdom itself, such as the JSDOM() constructor) should be in web-platform-tests format. We have some infrastructure for running these directly against jsdom documents. So ideally, when contributing a bugfix or new feature, you can browse the web-platform-tests repository and find the test covering your work, and then just enable it in the to-run.yaml file. These tests are HTML files which use a special library called testharness.js to report their results.

However, the web-platform-tests project is not fully comprehensive. If you need to write your own test for a web platform feature, place it in our to-upstream directory. (It's so named because, over time, we hope to upstream these tests back to the web-platform-tests repository, so all browsers can benefit from them.) Note that you may need to create new directory structure, paralleling that of the main web-platform-tests repository.

To run all web-platform-tests: pnpm test-wpt

To run the to-upstream web-platform-tests: pnpm test-tuwpt

To run specific web-platform-tests already enabled via to-run.yaml: pnpm test-wpt --fgrep dom/events

To run specific to-upstream web-platform-tests: pnpmp test-tuwpt --fgrep domparsing

Also, to update web platform tests to their latest revision from the source repository: pnpm update-wpt. (This can take a long time, like 10 minutes.)

jsdom API tests

If you are testing something that can only be accomplished through the jsdom API, and not inside a normal web browser, you'll want to write a different kind of test. Such tests are written using Mocha and Chai.

To write such a test that, simply add a file in test/api/, following the surrounding conventions. Then, add it to the manifest at test/index.js.

To run all API tests: pnpm test-api

To run a specific API test: pnpm test-mocha test/api/from-file.js

Older tests

Although ideally you should not need to worry about this, there are some tests that are for legacy reasons not in the right format; they use Mocha, but really should be web platform tests. We're keeping them around for coverage until we can convert them. If you run pnpm test, you will get the full test suite, including such old tests.

Keywords

FAQs

Package last updated on 30 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc