{"id":20790697,"url":"https://github.com/markedjs/testutils","last_synced_at":"2025-05-05T20:49:58.473Z","repository":{"id":197369990,"uuid":"698466360","full_name":"markedjs/testutils","owner":"markedjs","description":"Test utilities for marked and marked extensions","archived":false,"fork":false,"pushed_at":"2025-04-28T17:29:17.000Z","size":460,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-28T18:31:29.684Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@markedjs/testutils","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markedjs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-30T02:28:55.000Z","updated_at":"2025-04-28T17:24:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"7dece5d8-40d1-4dd6-b795-766d3d3c79d8","html_url":"https://github.com/markedjs/testutils","commit_stats":null,"previous_names":["markedjs/testutils"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markedjs%2Ftestutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markedjs%2Ftestutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markedjs%2Ftestutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markedjs%2Ftestutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markedjs","download_url":"https://codeload.github.com/markedjs/testutils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252575824,"owners_count":21770634,"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":"2024-11-17T15:36:58.402Z","updated_at":"2025-05-05T20:49:58.457Z","avatar_url":"https://github.com/markedjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @markedjs/testutils\n\nTest utilities for marked and marked extensions.\n\n## Versioning\n\nThis is versioned as the version of marked that it includes tests for with the prerelease version being an integer that gets incremented when we release a new fix or feature without updating the marked version.\n\nWe recommend to pin to a single version instead of using a range since any update may contain breaking changes.\n\n**Example**\n\n```json\n// package.json\n\"dependencies\": {\n  \"@markedjs/testutils\": \"9.1.0-0\"\n}\n```\n\n## API\n\n### `getAllMarkedSpecTests()`\n\nGet all marked [Tests](#tests)\n\n### `getTests(dirs)`\n\nGet [Tests](#tests) from a directory or file.\n`dirs` can be a string or an array of strings.\nThe return type is the same as the input a Tests object or an array of Tests objects.\n\n### `htmlIsEqual(actual, expected)`\n\nCheck if html will display the same.\n\n### `firstDiff(actual, expected, padding)`\n\nGet the first difference between actual and expected HTML. Returns an object with the characters around the index of the first difference in the expected and actual strings.\n\n### `outputCompletionTable(title, tests)`\n\nDisplay a table in stdout that lists the sections and what percentage of the tests are not marked shouldFail.\n\n### `runTests({tests, defaultMarkedOptions, parse, addExtension, isEqual, diff})`\n\nRun spec tests\n\n### `runAllMarkedSpecTests({addExtension, outputCompletionTables})`\n\nRun all marked specs with an added extension and optionally output completion table.\n\n## Arguments\n\n### tests\n\n```ts\ninterface Tests {\n  total: number;\n  pass: number;\n  specs: Spec[];\n}\n\ninterface Spec {\n  section?: string;\n  markdown: string;\n  html: string;\n  example?: number;\n  options?: MarkedOptions;\n  only?: boolean;\n  skip?: boolean;\n  shouldFail?: boolean;\n}\n```\n\n### defaultMarkedOptions\n\n```ts\ntype defaultMarkedOptions = MarkedOptions;\n```\n\n### parse\n\n```ts\nfunction parse(\n  markdown: string,\n  options: MarkedOptions,\n  addExtension: addExtension,\n): string;\n```\n\n### addExtension\n\n```ts\nfunction addExtension(marked: Marked): void;\n```\n\n### isEqual\n\n```ts\nfunction isEqual(actual: string, expected: string): boolean;\n```\n\n### diff\n\n```ts\nfunction diff(\n  actual: string,\n  expected: string,\n  padding: number,\n): { expected: string; actual: string };\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkedjs%2Ftestutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkedjs%2Ftestutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkedjs%2Ftestutils/lists"}