@component-controls/cc-cli

Command line tool to generate testing templates

Usage no npm install needed!

<script type="module">
  import componentControlsCcCli from 'https://cdn.skypack.dev/@component-controls/cc-cli';
</script>

README

Table of contents

Overview

  • Easy to use cli with "zero" configuration.
  • Generates test files in cjs, esm or typescript format.
  • More advanced level to customize the framework renderer.
  • Advanced level for full control over which stories to use for the tests.

Install

yarn add @component-controls/cc-cli --dev

API

createDocumentTemplate

create tests on a document base (a test file for each document and inside, dynamic tests to iterate through the stories)

createDocumentTemplate source code

properties

Name Type Description
storyPath string
renderer "rtl" | "rtr" | "enzyme" which renderer to use for generating the tests
format TeplateFormats files format - default common js
config string configuration files folder
bundle string if specified, will get stories from the bundle instead of directly importing
output string tests output folder - where to create them
name string describe section label
ally boolean if true, include axe accessibility tests

createStoreTemplate

create one large dynamic test for all the stories in the configuration/bundle

createStoreTemplate source code

properties

Name Type Description
renderer "rtl" | "rtr" | "enzyme" which renderer to use for generating the tests
format TeplateFormats files format - default common js
config string configuration files folder
bundle string if specified, will get stories from the bundle instead of directly importing
output string tests output folder - where to create them
name string describe section label
ally boolean if true, include axe accessibility tests

createStoriesTemplate

create tests on a stories base (a test file for each document and inside, a test for each story)

createStoriesTemplate source code

properties

Name Type Description
storyPath string
renderer "rtl" | "rtr" | "enzyme" which renderer to use for generating the tests
format TeplateFormats files format - default common js
config string configuration files folder
bundle string if specified, will get stories from the bundle instead of directly importing
output string tests output folder - where to create them
name string describe section label
ally boolean if true, include axe accessibility tests

createTemplate

from a template, render all variables

createTemplate source code

properties

Name Type Description
renderer "rtl" | "rtr" | "enzyme" which renderer to use for generating the tests
format TeplateFormats files format - default common js
config string configuration files folder
bundle string if specified, will get stories from the bundle instead of directly importing
output string tests output folder - where to create them
name string describe section label
ally boolean if true, include axe accessibility tests
template* string
vars* Record<string, any>

cliStore

cli function to create a test file with dynamic tests for the entre store

cliStore source code

properties

Name Type Description
overwrite* boolean
test* string
include string[] components to include
exclude string[] components to exclude
renderer "rtl" | "rtr" | "enzyme" which renderer to use for generating the tests
format TeplateFormats files format - default common js
config string configuration files folder
bundle string if specified, will get stories from the bundle instead of directly importing
output string tests output folder - where to create them
name string describe section label
ally boolean if true, include axe accessibility tests

cliStory

cli function to create tests on a story by story basis

cliStory source code

run

cc-cli central function. based on the selected g/generate option will call the specific cli function - store, stories

run source code

saveTemplate

save a template file based on options

saveTemplate source code