{"id":24529761,"url":"https://github.com/learosema/wctest","last_synced_at":"2025-07-23T21:08:53.419Z","repository":{"id":211176598,"uuid":"728325361","full_name":"learosema/wctest","owner":"learosema","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-07T11:35:43.000Z","size":25,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T07:52:32.808Z","etag":null,"topics":[],"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/learosema.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,"governance":null}},"created_at":"2023-12-06T17:43:49.000Z","updated_at":"2024-08-07T06:14:48.000Z","dependencies_parsed_at":"2023-12-06T23:37:12.014Z","dependency_job_id":null,"html_url":"https://github.com/learosema/wctest","commit_stats":null,"previous_names":["learosema/wctest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fwctest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fwctest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fwctest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fwctest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/learosema","download_url":"https://codeload.github.com/learosema/wctest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243770380,"owners_count":20345288,"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":[],"created_at":"2025-01-22T07:52:35.268Z","updated_at":"2025-03-15T18:19:54.032Z","avatar_url":"https://github.com/learosema.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WCTest 🚻\n\nThis is a test about testing web components with the node test runner :).\nThe web component to be tested is a progressively enhanced `\u003cpassword-input\u003e` component which is wrapped around an input.\n\nWhen the input is a clear-text field, it creates a `hide` button, when the input is a password field, it creates a `show` button, making it possible to toggle between a revealed and hidden input.\n\n## `node --test`\n\nnode.js comes with an integrated test runner, which is a very lightweight way to run tests.\nThe built-in test runner lives inside the `node:test` package and can be started via `node --test`. All files with a `.test.js` suffix are processed, also handling `.mjs` and `.cjs` files.\n\nThe test is using the `describe` and `it`-syntax which can be imported from `\"node:test\"`.\n\n## Assertions\n\nAs assertion library, we are using the integrated `node:assert/strict`. It is recommended to use strict assertions as the un-strict ones use the very lax `==` JavaScript comparisons rather than `===`.\n\nIn case you are more familiar with the `expect` syntax from jest and/or jasmine, you can use `chai.js` as assertion library.\n\n## Simulating a browser environment with linkedom inside the node test\n\nWe can use [LinkeDOM](https://github.com/WebReflection/linkedom) to simulate a minimal browser environment.  \n\n```js\nwindow = global.window = parseHTML(`\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody\u003e\u003c/body\u003e\u003c/html\u003e`);\n```\n\nIn order to get the returned window object working with the componet to be tested, we have to pollute window and several other DOM objects into the global namespace and then dynamically load the component via `await import()`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearosema%2Fwctest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flearosema%2Fwctest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearosema%2Fwctest/lists"}