textrun-npm
v0.2.0
Published
hello
Downloads
10
Readme
Text-Runner Actions for npm
hello
This package provides Text-Runner actions for verifying the documentation of npm packages.
Installation
To use these actions, add this package as a development dependency by running npm i -D textrun-npm or yarn i -D textrun-npm.
Verify installation instructions
The npm/install action verifies installation
instructions for an npm package. As an example, let's assume we are testing the
documentation of an npm package called foobar
.
Its package.json file would contain amongst
other things:
{
"name": "foobar"
}
In the documentation of this npm package, for example its README.md file, we want to document how to install this package. It would contain a section that looks something like this:
Install the foobar package by running:
<pre type="npm/install">
$ npm install foobar
</pre>
or with Yarn:
<pre type="npm/install">
$ yarn add foobar
</pre>
Text-Runner verifies that the installation instructions contain the correct name of the npm package.
Verify exported binaries
The npm/exported-executable action verifies
documentation of exported binaries of npm packages. Let's say the source code of
our foobar
package contains an executable file
bin/foo, which is listed as a binary in its
package.json file:
{
"name": "foobar",
"bin": {
"foo": "bin/foo"
}
}
The README.md file for the "foobar" package would document this binary something like this:
After you install the "foobar" package, you can run the
<code type="npm/exported-executable">foo</code> command in the terminal.
Verify installed binaries
The npm/installed-executable action verifies binaries installed by other npm packages. Let's say you developer instructions for a codebase that uses the cucumber command provided by the npm cucumber package:
To run the end-to-end tests, run
<code type="npm/installed-executable">cucumber</code> in the terminal.