only return test files
This commit is contained in:
parent
961cafc28e
commit
acdde570aa
|
|
@ -31,7 +31,7 @@ import type { Matcher } from '../util';
|
||||||
import { Suite } from '../common/test';
|
import { Suite } from '../common/test';
|
||||||
import { buildDependentProjects, buildTeardownToSetupsMap, filterProjects } from './projectUtils';
|
import { buildDependentProjects, buildTeardownToSetupsMap, filterProjects } from './projectUtils';
|
||||||
import { FailureTracker } from './failureTracker';
|
import { FailureTracker } from './failureTracker';
|
||||||
import { detectChangedFiles } from './vcs';
|
import { detectChangedTests } from './vcs';
|
||||||
|
|
||||||
const readDirAsync = promisify(fs.readdir);
|
const readDirAsync = promisify(fs.readdir);
|
||||||
|
|
||||||
|
|
@ -234,7 +234,7 @@ function createLoadTask(mode: 'out-of-process' | 'in-process', options: { filter
|
||||||
if (testRun.config.cliOnlyChanged && options.filterOnlyChanged) {
|
if (testRun.config.cliOnlyChanged && options.filterOnlyChanged) {
|
||||||
for (const plugin of testRun.config.plugins)
|
for (const plugin of testRun.config.plugins)
|
||||||
await plugin.instance?.populateDependencies?.();
|
await plugin.instance?.populateDependencies?.();
|
||||||
const changedFiles = await detectChangedFiles(testRun.config.cliOnlyChanged, testRun.config.configDir);
|
const changedFiles = await detectChangedTests(testRun.config.cliOnlyChanged, testRun.config.configDir);
|
||||||
cliOnlyChangedMatcher = file => changedFiles.has(file);
|
cliOnlyChangedMatcher = file => changedFiles.has(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import childProcess from 'child_process';
|
||||||
import { affectedTestFiles } from '../transform/compilationCache';
|
import { affectedTestFiles } from '../transform/compilationCache';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
export async function detectChangedFiles(baseCommit: string, configDir: string): Promise<Set<string>> {
|
export async function detectChangedTests(baseCommit: string, configDir: string): Promise<Set<string>> {
|
||||||
function gitFileList(command: string) {
|
function gitFileList(command: string) {
|
||||||
try {
|
try {
|
||||||
return childProcess.execSync(
|
return childProcess.execSync(
|
||||||
|
|
@ -41,11 +41,5 @@ export async function detectChangedFiles(baseCommit: string, configDir: string):
|
||||||
const [gitRoot] = gitFileList('rev-parse --show-toplevel');
|
const [gitRoot] = gitFileList('rev-parse --show-toplevel');
|
||||||
const trackedFilesWithChanges = gitFileList(`diff ${baseCommit} --name-only`).map(file => path.join(gitRoot, file));
|
const trackedFilesWithChanges = gitFileList(`diff ${baseCommit} --name-only`).map(file => path.join(gitRoot, file));
|
||||||
|
|
||||||
const filesWithChanges = [...untrackedFiles, ...trackedFilesWithChanges];
|
return new Set(affectedTestFiles([...untrackedFiles, ...trackedFilesWithChanges]));
|
||||||
const affectedFiles = affectedTestFiles(filesWithChanges);
|
|
||||||
|
|
||||||
return new Set([
|
|
||||||
...filesWithChanges,
|
|
||||||
...affectedFiles,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue