Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@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 717 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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.