{"id":19810157,"url":"https://github.com/dnslink-std/test","last_synced_at":"2025-05-01T08:31:39.701Z","repository":{"id":49027808,"uuid":"373031678","full_name":"dnslink-std/test","owner":"dnslink-std","description":"Internal test harness for DNSLink implementations","archived":false,"fork":false,"pushed_at":"2022-06-03T07:39:43.000Z","size":119,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-25T06:39:10.055Z","etag":null,"topics":["dnslink","integration-test","standard"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnslink-std.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-02T03:47:18.000Z","updated_at":"2024-07-29T08:29:47.000Z","dependencies_parsed_at":"2022-08-30T09:40:33.797Z","dependency_job_id":null,"html_url":"https://github.com/dnslink-std/test","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnslink-std%2Ftest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnslink-std%2Ftest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnslink-std%2Ftest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnslink-std%2Ftest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnslink-std","download_url":"https://codeload.github.com/dnslink-std/test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251847733,"owners_count":21653571,"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":["dnslink","integration-test","standard"],"created_at":"2024-11-12T09:19:40.294Z","updated_at":"2025-05-01T08:31:39.439Z","avatar_url":"https://github.com/dnslink-std.png","language":"JavaScript","readme":"# dnslink-test\n\nA language independent test harness for DNSLink implementations such as [dnslink-std/js](https://github.com/dnslink-std/js/) or [dnslink-std/go](https://github.com/dnslink-std/go/).\n\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Built-in DNS server](#built-in-dns-server) \n\n## Installation\n\nThe tests are written in javascript and published through npm. This means\nfor the execution of the tests `Node.js` is required.\n\nYou can run the tests \"on-the-fly\" using `$ npx @dnslink/test` or install\nthem permanently using `npm i @dnslink/test -g` and then run it using `$ dnslink-test`.\n\n## Usage\n\nTo use this harness you need to prepare an executable, lets call it `my-impl`.\n\n1. `my-impl` needs to be able to process command line arguments. The first argument for `my-impl` is a domain name.\n2. Using the domain name as input, `my-impl` needs to output a JSON formatted object to `stdout`.\n3. The output needs to have a `found` object containing all the DNSLink entries found for a domain.\n4. Any found DNSLink entry needs to be returned in the `found`, like: `{ \"links\": { \"foo\": \"bar\" } }`, if redirects\n    happen with deep linking, the `path` property needs to be set like\n    `...\"path\": [{ \"pathname\": \"/dir/name\", \"search\": { \"foo\": [\"bar\"] }}]`\n5. Now you can run tests using `dnslink-test -- my-impl` and it will show whether or not your implementation passes.\n6. Optionally, your implementation may support standard log messages and/or codes for debugging why a DNSLink entry\n    can not found. To enable this you need to also return a `log` object that contains all the log entries and run\n    the tests with the `--enable log` flag: `$ dnslink-test --enable log -- my-impl`.\n7. While developing you can use `--skip` or `--only` to disable/enable specific tests in order to make development\n    more comfortable.\n\nThe list of rules that an implementation needs to cover is defined in [`./integration-tests.js`](./integration-tests.js).\n\n### Built-in DNS server\n\n`dnslink-test` comes automatically with a DNS server that is run on the localhost's UDP and TCP ports, as well as\na DNS-over-HTTPS compatible endpoint (thought it is a regular HTTP endpoint).\n\nThe implementation tested receives a second argument which contains a JSON object. Looking like this:\n\n```json\n{\n  \"udp\": 2345,\n  \"tcp\": 2346,\n  \"doh\": 2347,\n  \"flags\": {}\n}\n```\n\nThe `udp`, `tpc` and `doh` numbers are ports on which the local server are listening for the duration of the\ntests. They contain the DNS TXT entries for all known domains.\n\n_Note:_ The `flags` objects contains any flags that you may have passed in.\n\nOne can also run the DNS server in a standalone mode (for debug, or in custom CI setups): \n\n```console\n$ dnslink-test --server-only\n{\n  \"udp\": 49953,\n  \"tcp\": 37755,\n  \"doh\": 39427\n}\n```\n\n## License\n\nPublished under dual-license: [MIT OR Apache-2.0](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnslink-std%2Ftest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnslink-std%2Ftest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnslink-std%2Ftest/lists"}