Releases: saurabhdaware/cli-testing-tool
0.3.0 - Continue testing after getOutput
What's Changed
- feat: continue typing after getOutput by @saurabhdaware in #5
Full Changelog: v0.2.0...v0.3.0
0.2.0 - add logError option, jsdoc type completion for options
createCommandInterfaceoptions now has a jsdoc type support- options have default values now
const defaultOptions = {
typeDelay: 100, // number. delay between each `.type()` call
logData: false, // boolean. if true, logs the cli command data on terminal
logError: true, // boolean. if false, won't add cli command errors on terminal
cwd: process.cwd(), // string. working directory from where your simulated command is executed
env: undefined // object | undefined. environment variables object if there are any
};- Added
logErroroption with default value astrue. This option will allow you to turn off errors from your running command (just in case, the error is intended for negative tests) - New example in README
0.1.3 - Rename package to `cli-testing-tool`
Renamed this package from cli-testing-library to cli-testing-tool.
Earlier the idea was to make this package something like testing-library so named it cli-testing-library. However, most of the terminology from testing-library (render, findByText, etc) doesn't make sense in CLIs. So we'll be moving away from that terminology a bit (the overall structure will still remain similar).
Also, @crutchcorn is working on a similar idea where they are creating a testing library with syntax similar to testing-library so it made sense for them to have name cli-testing-library (Check out cli-testing-library)
This will the new terminology I will be going forward with -
render->executefindByText-> There won't be any equivalent. You can always dostringOutput.includes('text-to-find')as a replacementscreen->terminal
New methods-
terminal.stringOutput - to get output as string
terminal.tokenizeOutput - to get output with color and graphics tokens
Migration
Hopefully, no one is using this library yet but if you are,
1. Installation
npm uninstall --save-dev cli-testing-librarynpm install --save-dev cli-testing-tool@latest2. Rename imports
- const {} = require('cli-testing-library')
+ const {} = require('cli-testing-tool')0.1.1 - fix old test reference in stringOutput
- fixes extra characters that were added after last version bump
0.1.0 - Stable `stringOutput`, Clear Screen Support
Dynamic Cursor Movement Outputs in tokenizedOutput
The cursor movement tokens will now have the number of characters the cursor is moving
Then,
\x1b[10A -> [CURSOR_UP]
Now,
\x1b[10A -> [CURSOR_UP_10]
Support for all Erase Line/Screen Characters
CLEAR_SCREEN: `${ESC}J`,
CLEAR_CURSOR_TO_END_SCREEN: `${ESC}0J`,
CLEAR_CURSOR_TO_START_SCREEN: `${ESC}1J`,
CLEAR_ENTIRE_SCREEN: `${ESC}2J`,
CLEAR_LINE: `${ESC}K`,
CLEAR_CURSOR_TO_END_LINE: `${ESC}0K`,
CLEAR_CURSOR_TO_START_LINE: `${ESC}1K`,
CLEAR_ENTIRE_LINE: `${ESC}2K`,Add more graphic modes in tokens
Add support for Underline, Italic, Blinking text, dim text, magenta color escape codes
Stable stringOutput
Removed the custom implementation and added https://github.com/netzkolchose/node-ansiterminal to parse output. This ensures that it takes erase lines, clear screen, cursor movements into account.
Resolved #1
0.0.12 - Add typeDelay option
- add default 100ms delay after
typecommand (This will ensure the command doesn't end before writing all the output) - add
typeDelayoption to customise the delay