Skip to content

Commit

Permalink
fix: add doc file to cache to re-run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed May 16, 2021
1 parent 83e0655 commit 249ce07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/instrument/src/babel/extract-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const componentRelatedMetrics = async (
}
});
}
const testData: string[] = [];
const testData: string[] = [filePath];
if (store.doc?.testData) {
const testDataFile = path.resolve(
path.dirname(filePath),
Expand Down
9 changes: 5 additions & 4 deletions core/instrument/src/misc/jest-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import { CachedFileResource } from './chached-file';

/**
* Separates the files into projects and runs jest tests
* @param documentPath full path to the document/story
* @param files key filePathName pair of all files to test
* @param testFiles all the test files associated with the component
* @param coverageFiles all the files that should be included in the coverage report
* @param trackFiles are files ie data driven testing and the documentation file, that will trigger a cache refresh
* @param options jest runCLI options
* @returns return key/value pairs with test results and coverage associated with each file
*/
export const extractTests = async (
testFiles: string[],
coverageFiles: string[],
dataFiles: string[],
trackFiles: string[],
options?: JestConfig,
): Promise<JestTests | undefined> => {
if (!testFiles.length) {
Expand All @@ -39,7 +40,7 @@ export const extractTests = async (
...testFiles,
...coverageFiles,
...snapshotFiles,
...dataFiles,
...trackFiles,
]);
const cachedResults = cached.get();
if (cachedResults) {
Expand Down

0 comments on commit 249ce07

Please sign in to comment.