Skip to content

Releases: saurabhdaware/cli-testing-tool

0.3.0 - Continue testing after getOutput

03 Dec 14:12
525ec80
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.2.0...v0.3.0

0.2.0 - add logError option, jsdoc type completion for options

11 Nov 18:26
Compare
Choose a tag to compare
  • createCommandInterface options 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 logError option with default value as true. 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`

02 Nov 14:09
Compare
Choose a tag to compare

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 -> execute
  • findByText -> There won't be any equivalent. You can always do stringOutput.includes('text-to-find') as a replacement
  • screen -> 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-library
npm install --save-dev cli-testing-tool@latest

2. Rename imports

- const {} = require('cli-testing-library')
+ const {} = require('cli-testing-tool')

0.1.1 - fix old test reference in stringOutput

30 Oct 10:26
Compare
Choose a tag to compare
  • fixes extra characters that were added after last version bump

0.1.0 - Stable `stringOutput`, Clear Screen Support

30 Oct 09:57
Compare
Choose a tag to compare

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

13 Oct 18:34
Compare
Choose a tag to compare
  • add default 100ms delay after type command (This will ensure the command doesn't end before writing all the output)
  • add typeDelay option to customise the delay