Command line tool to generate testing templates
npm install @component-controls/cc-cli- Overview
- Install
- API
- createStoreTemplate
- createStoriesTemplate
- 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.
``sh`
yarn add @component-controls/cc-cli --dev
function
create one large dynamic test for all the stories in the configuration/bundle
_defined in @component-controls/cc-cli/plugins/cc-cli/src/jest-templates/store-template.ts_
parameters
| Name | Type | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------- |
| options* | P | rendering options |dataImports
| | DataImportOptionsfilePath\: stringdata\: Record<string, any> | |configuration
| | typewebpack: Configuration \| WebpackConfigFnfinalWebpack: Configuration \| WebpackConfigFnpresets: RuleType\[]configPath: stringdistFolder: stringbundleName: stringstaticFolder: stringcssFileName: stringlogOptions: Partial<LogOptions>mode: "none" \| "development" \| "production"loadersencodeHTML\: encodeHTMLat\: function (index\: numberT
) => \| undefinedmodule: stringident: stringloader: stringoptions: string \| typestories: string \| string\[]files: string \| string\[]siteRoot: stringignore: string\[]pagesstring\[
]: categories: DocType\[]siteMap: type \| booleansiteUrl: stringinstrument: anysearchindexingModule: stringsearchingModule\: stringfields: SearchFields\[]emptySearchDocuments: string\[]hitsPerPage: numberoptions: anytokensfigmaAccessToken: stringgithubAccessToken: stringcomponent: string \| Record<string, unknown> \| ElementType<Props>subcomponents: Record<string, (string, Record<string, unknown>, ElementType<Props>)>controlsstring\[
]: ComponentControlText \| ComponentControlBoolean \| ComponentControlColor \| ComponentControlDate \| ComponentControlObject<> \| ComponentControlButton<> \| ComponentControlOptions<> \| ComponentControlNumber \| ComponentControlArray \| ComponentControlFilessmartControlssmart: booleaninclude: string\[] \| IncludeFnexclude: string\[] \| IncludeFndecorators: StoryRenderFn\[]plugins: anycategory: string | |returns
| | Promise<string> | a string with the rendered template |
function
create tests on a stories base (a test file for each document and inside, a test for each story)
_defined in @component-controls/cc-cli/plugins/cc-cli/src/jest-templates/stories-template.ts_
parameters
| Name | Type | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| options* | P | rendering options |dataImports
| | DataImportOptionsfilePath\: stringdata\: Record<string, any> | |configuration
| | BuildConfigurationwebpack: Configuration \| WebpackConfigFnfinalWebpack: Configuration \| WebpackConfigFnpresets: RuleType\[]configPath: stringdistFolder: stringbundleName: stringstaticFolder: stringcssFileName: stringlogOptions: Partial<LogOptions>mode: "none" \| "development" \| "production"loadersencodeHTML\: encodeHTMLat\: function (index\: T
) => \| undefinedmodule: stringstories: string \| string\[]files: string \| string\[]siteRoot: stringignore: string\[]pagesstring\[
]: categories: DocType\[]siteMap: type \| booleansiteUrl: stringinstrument: anysearchindexingModule: stringsearchingModule\: stringfields: SearchFields\[]emptySearchDocuments: string\[]hitsPerPage: numberoptions: anytokensfigmaAccessToken: stringgithubAccessToken: stringcomponent: string \| Record<string, unknown> \| ElementType<Props>subcomponents: Record<string, (string, Record<string, unknown>, ElementType<Props>)>controlsstring\[
]: ComponentControlText \| ComponentControlBoolean \| ComponentControlColor \| ComponentControlDate \| ComponentControlObject<P> \| ComponentControlButton \| ComponentControlOptions \| ComponentControlNumber \| ComponentControlArray \| ComponentControlFilessmartControlssmart: booleaninclude: string\[] \| IncludeFnexclude: string\[] \| IncludeFndecorators: StoryRenderFn\[]plugins: anycategory: string | global configuration used at build time stored in a file named main.js/main.ts |returns
| | Promise<string`> | a string with the rendered template |