GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - markedjs/testutils: Test utilities for marked and marked extensions

BranchesTags
Open more actions menu

Latest commit

 

History

486 Commits
486 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
eslint.config.js
eslint.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

@markedjs/testutils

Test utilities for marked and marked extensions.

Versioning

This 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.

We recommend to pin to a single version instead of using a range since any update may contain breaking changes.

Example

// package.json
"dependencies": {
  "@markedjs/testutils": "9.1.0-0"
}

API

getAllMarkedSpecTests()

Get all marked Tests

getTests(dirs)

Get Tests from a directory or file. dirs can be a string or an array of strings. The return type is the same as the input a Tests object or an array of Tests objects.

htmlIsEqual(actual, expected)

Check if html will display the same.

firstDiff(actual, expected, padding)

Get 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.

outputCompletionTable(title, tests)

Display a table in stdout that lists the sections and what percentage of the tests are not marked shouldFail.

runTests({tests, defaultMarkedOptions, parse, addExtension, isEqual, diff})

Run spec tests

runAllMarkedSpecTests({addExtension, outputCompletionTables})

Run all marked specs with an added extension and optionally output completion table.

Arguments

tests

interface Tests {
  total: number;
  pass: number;
  specs: Spec[];
}

interface Spec {
  section?: string;
  markdown: string;
  html: string;
  example?: number;
  options?: MarkedOptions;
  only?: boolean;
  skip?: boolean;
  shouldFail?: boolean;
}

defaultMarkedOptions

type defaultMarkedOptions = MarkedOptions;

parse

function parse(
  markdown: string,
  options: MarkedOptions,
  addExtension: addExtension,
): string;

addExtension

function addExtension(marked: Marked): void;

isEqual

function isEqual(actual: string, expected: string): boolean;

diff

function diff(
  actual: string,
  expected: string,
  padding: number,
): { expected: string; actual: string };

About

Test utilities for marked and marked extensions

www.npmjs.com/package/@markedjs/testutils

Resources

Readme
MIT license
Activity
Custom properties

Stars

1 star

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.