Skip to content

Commit

Permalink
fix: rootfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Apr 11, 2021
1 parent b5e5029 commit 2397536
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 1 addition & 5 deletions core/instrument/src/misc/jest-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ export const extractJestTests = async (
coverage: cachedTest.coverage,
});
}
const rootDir = path.relative(
path.resolve(path.dirname(testFile), 'config'),
fileDir,
);
const result = await runTests(testFile, { rootDir, ...options });
const result = await runTests(testFile, options);
if (result) {
cached.set(result);
results.push({
Expand Down
8 changes: 5 additions & 3 deletions core/jest-extract/src/run-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,23 @@ export const runTests = async (
): Promise<JestResults | undefined> => {
const testFolder = path.dirname(testFilePath);
const testFile = path.basename(testFilePath);
const configFolder =
findUpFile(testFolder, ['package.json', 'jest-config.js']) || testFolder;
const configFolder = path.dirname(
findUpFile(testFolder, ['package.json', 'jest-config.js']) || testFolder,
);
let runResults: {
results: AggregatedResult;
globalConfig: Config.GlobalConfig;
};
try {
runResults = await runCLI(
{
rootDir: configFolder,
testRegex: testFile,
maxWorkers: 1,
testPathIgnorePatterns: ['/node_modules/', '/__snapshots__/'],
silent: true,
verbose: false,
reporters: [],
// reporters: [],
coverage: true,
coverageReporters: ['none'],
watchman: false,
Expand Down
2 changes: 1 addition & 1 deletion ui/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"node"
],
"setupFiles": [
"./src/setupTests.ts"
"<rootDir>/src/setupTests.ts"
],
"roots": [
"./src"
Expand Down

0 comments on commit 2397536

Please sign in to comment.