{"id":26077626,"url":"https://github.com/wallabyjs/jsdom-quokka-plugin","last_synced_at":"2025-07-20T05:33:24.652Z","repository":{"id":37692783,"uuid":"84402753","full_name":"wallabyjs/jsdom-quokka-plugin","owner":"wallabyjs","description":"Quokka plugin to enable browser environment via jsdom","archived":false,"fork":false,"pushed_at":"2022-12-08T09:03:30.000Z","size":97,"stargazers_count":86,"open_issues_count":5,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-11T22:51:45.289Z","etag":null,"topics":["quokka","wallaby"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wallabyjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-09T05:40:49.000Z","updated_at":"2025-02-26T22:46:45.000Z","dependencies_parsed_at":"2023-01-25T09:45:44.719Z","dependency_job_id":null,"html_url":"https://github.com/wallabyjs/jsdom-quokka-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wallabyjs/jsdom-quokka-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallabyjs%2Fjsdom-quokka-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallabyjs%2Fjsdom-quokka-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallabyjs%2Fjsdom-quokka-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallabyjs%2Fjsdom-quokka-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wallabyjs","download_url":"https://codeload.github.com/wallabyjs/jsdom-quokka-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallabyjs%2Fjsdom-quokka-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266071519,"owners_count":23871940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quokka","wallaby"],"created_at":"2025-03-09T03:05:18.286Z","updated_at":"2025-07-20T05:33:19.639Z","avatar_url":"https://github.com/wallabyjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":":warning: Please note that this package is no longer requried to use the latest version of Quokka with jsdom. Please refer to [Quokka docs](https://quokkajs.com/docs/configuration.html#jsdom) for more information. :warning:\n\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\n# FOR LEGACY USERS ONLY\n\n-----\n\n[Quokka.js plugin](https://quokkajs.com/) to enable browser-like environment via [`jsdom`](https://github.com/tmpvar/jsdom).\n\n## Install\n\n```\nnpm install jsdom-quokka-plugin\n```\n\nNote that you may install the plugin to the [Quokka config folder](https://quokkajs.com/docs/configuration.html#global-config-file) instead of installing it to your local project.\n\n## Configuration\n\nSpecify the plugin in Quokka [configuration settings](https://quokkajs.com/docs/configuration.html):\n\n```\n{\n    \"plugins\": [\"jsdom-quokka-plugin\"]\n}\n```\n\nIf you need to, you may pass additional configuration options to the plugin:\n\n```\n{\n    \"plugins\": [\"jsdom-quokka-plugin\"],\n    \"jsdom\": {\n        \"file\": \"/html/file/path\"\n        \"html\": \"...\",\n        \"userAgent\": \"...\",\n        \"config\": {...}\n    }\n}\n```\n\nThe `jsdom.file` setting allows to specify a path to any HTML file.\n\nThe `jsdom.html` setting allows to specify any HTML as a string.\n\nThe `jsdom.config` setting is [the `jsdom` options setting](https://github.com/jsdom/jsdom#customizing-jsdom).\n\n## Web Canvas API\n\nIf you want to use `HTMLCanvasElement` objects with Quokka and `jsdom` then you must also install the `canvas` package in the same\n location as `jsdom-quokka-plugin`:\n\n## Example 1\n\nSpecify inline Quokka configuration to use the `jsdom-quokka-plugin` setting `html` from config:\n\n```javascript\n({\n    plugins: ['jsdom-quokka-plugin'],\n    jsdom: {html: `\u003cdiv id=\"test\"\u003eHello\u003c/div\u003e`}\n})\n\nconst testDiv = document.getElementById('test');\n\nconsole.log(testDiv.innerHTML);\n```\n\ndisplays\n\n\n\u003cimg width=\"425\" alt=\"screen shot 2018-03-08 at 1 12 27 pm\" src=\"https://user-images.githubusercontent.com/979966/37131065-616edeea-22d2-11e8-98c5-0aa518b8e73e.png\"\u003e\n\nIn this example, inline Quokka config is used. You may also place the [config into the global Quokka config file or into your `package.json`](https://quokkajs.com/docs/configuration.html).\n\n## Example 2\n\nCreate a new project that loads config from project configuration and sets html from a `file`:\n\n1. Create a new folder for your scratch project.\n2. Using terminal in the new folder, run `npm init` (accept all defaults).\n3. Using terminal in the new folder, Install jsdom-quokka-plugin with `npm install jsdom-quokka-plugin –save-dev`.\n4. In the root of the new folder, create a file `test.html` with the contents:\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eThis is my sample page.\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cp id=\"testDiv\"\u003eHello World\u003c/p\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n5. In the root of the new folder, create a file `test.js` with the contents:\n```javascript\nconst testDiv = document.getElementById('testDiv');\n\ntestDiv.textContent //?\n```\n\n6. In the root of the new folder, create a file `.quokka` with the contents:\n```json\n{\n  \"plugins\": [\"jsdom-quokka-plugin\"],\n  \"jsdom\": {\"file\": \"test.html\"}\n}\n```\n\n6. Start Quokka on `test.js`. You should now see editor output and Quokka console output of `Hello World`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwallabyjs%2Fjsdom-quokka-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwallabyjs%2Fjsdom-quokka-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwallabyjs%2Fjsdom-quokka-plugin/lists"}