Skip to content

EarthyOrange/tape_comment_formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purpose:

To format the comment block in the tape test harness' unit test

  • Lets the unit test be described in greater detail
  • Frees up the description message to allow a unique identifier. So when a test fails it is clear which one

Nitty gritty:

  • Add tabs to each comment line such that they are not aligned directly under the test description
  • Removes an extra line that is inserted between each new comment line
  • Colors the When and Then block (differently by default & is configurable)

Usage:

import test from 'tape';
import { description } from 'tape-comment-formatter';

test('Test #1', (t) => {
    const { script } = description()
        .when(
            `
                - Alice has an orange
                - Bob has a juicer
            `,
        )
        .then(
            `
                - Orange juice can be squeezed
            `,
        );
    t.comment(script);

    // Test body

    t.pass('There was orange juice indeed');
    t.end();
});

Looks like

Formatting the remainder of TAP-13 output is being done by tap-diff here.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published