Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@wpe-tkpd/jsdom
Advanced tools
This is fork of jsdom
. Originally forked because we need to not import/require canvas
and we need to use custom decimal.js
.
nvm use
to ensure you use the Node.js version expected by this package.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
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.)
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
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.
FAQs
A JavaScript implementation of many web standards
The npm package @wpe-tkpd/jsdom receives a total of 559 weekly downloads. As such, @wpe-tkpd/jsdom popularity was classified as not popular.
We found that @wpe-tkpd/jsdom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.