diff --git a/core/instrument/src/misc/jest-tests.ts b/core/instrument/src/misc/jest-tests.ts index f0b50a93e..ce3a84bea 100644 --- a/core/instrument/src/misc/jest-tests.ts +++ b/core/instrument/src/misc/jest-tests.ts @@ -6,6 +6,7 @@ import { findJestConfig, getRelatedTests, } from '@component-controls/jest-extract'; +import { log } from '@component-controls/logger'; import { resolveSnapshotFile } from '@component-controls/core/node-utils'; import { JestTests } from '@component-controls/core'; import { CachedFileResource } from './chached-file'; @@ -81,6 +82,7 @@ export const extractTests = async ( return cachedResults; } const projectFolder = findJestConfig(tests.testFiles[0]); + log('jest tests', tests.testFiles[0], [115, 245, 184]); const testResults = await runProjectTests({ testFiles: tests.testFiles.map( f => `.${path.sep}${path.relative(projectFolder, f)}`, diff --git a/core/logger/src/index.ts b/core/logger/src/index.ts index 0097e100a..51ebb80cb 100644 --- a/core/logger/src/index.ts +++ b/core/logger/src/index.ts @@ -14,18 +14,33 @@ const defaultOptions: LogOptions = { let logOptions: LogOptions = { ...defaultOptions }; -const output = (heading: string, text: string) => { - console.log(chalk.bgRgb(...logOptions.colors)(`@${heading}`), text); +const output = ( + heading: string, + text: string, + bgColor?: [number, number, number], +) => { + console.log( + chalk.bgRgb(...(bgColor || logOptions.colors))(`@${heading}`), + text, + ); }; -export const log = (heading: string, text: string): void => { +export const log = ( + heading: string, + text: string, + bgColor?: [number, number, number], +): void => { if (logOptions.logLevel === 'all') { - output(heading, text); + output(heading, text, bgColor); } }; -export const error = (heading: string, text: string): void => { +export const error = ( + heading: string, + text: string, + bgColor?: [number, number, number], +): void => { if (logOptions.logLevel !== 'none') { - output(heading, text); + output(heading, text, bgColor); } }; diff --git a/plugins/cc-cli/package.json b/plugins/cc-cli/package.json index f95b2b7a7..0baf14e8a 100644 --- a/plugins/cc-cli/package.json +++ b/plugins/cc-cli/package.json @@ -45,6 +45,7 @@ "dependencies": { "@component-controls/instrument": "^3.9.0", "@component-controls/jest-axe-matcher": "^3.8.1", + "@component-controls/logger": "^3.8.2", "@component-controls/store": "^3.9.0", "@component-controls/test-renderers": "^3.9.0", "@component-controls/webpack-compile": "^3.9.1", diff --git a/plugins/cc-cli/src/cli/save-data-template.ts b/plugins/cc-cli/src/cli/save-data-template.ts index 2d902c29b..1f45dfc72 100644 --- a/plugins/cc-cli/src/cli/save-data-template.ts +++ b/plugins/cc-cli/src/cli/save-data-template.ts @@ -1,6 +1,7 @@ import path from 'path'; import fs from 'fs'; import { dynamicRequire } from '@component-controls/core/node-utils'; +import { log } from '@component-controls/logger'; import { CliOptions, getTestFolder } from './utils'; import { TemplateOptions, DataImportOptions, relativeImport } from '../utils'; import { createDataTemplate } from '../data-templates/data-template'; @@ -21,7 +22,9 @@ export const saveDataTemplate = async

( .split('.') .map((e, i) => (i === 1 ? 'data' : e)) .join('.'); + const filePath = path.resolve(testFolder, dataName); + log('saving data', filePath, [184, 226, 255]); let existing: Record | undefined = undefined; if (fs.existsSync(filePath)) { if (overwrite) { diff --git a/plugins/cc-cli/src/cli/save-test-template.ts b/plugins/cc-cli/src/cli/save-test-template.ts index 9104f118d..955c9baf4 100644 --- a/plugins/cc-cli/src/cli/save-test-template.ts +++ b/plugins/cc-cli/src/cli/save-test-template.ts @@ -1,5 +1,6 @@ import path from 'path'; import fs from 'fs'; +import { log } from '@component-controls/logger'; import { CliOptions, getTestFolder } from './utils'; import { TemplateFunction, TemplateOptions } from '../utils'; import { saveDataTemplate } from './save-data-template'; @@ -29,6 +30,7 @@ export const saveTemplate = async

( ); return; } + log('saving test', testFilePath, [115, 245, 184]); const dataTemplate = await saveDataTemplate(options); const content = await templateFn(