From 330a9644fa28b7a12524e30a1fac840b2c78a8c6 Mon Sep 17 00:00:00 2001 From: David Laban Date: Wed, 27 Dec 2017 22:11:54 +0000 Subject: [PATCH 1/3] --changedFilesToContributeTo=$BRANCH make changedFilesToContributeTo require an arg, and imply onlyChanged --- CHANGELOG.md | 2 + docs/CLI.md | 6 ++ .../__tests__/jest_changed_files.test.js | 64 +++++++++++++++++++ packages/jest-changed-files/src/git.js | 25 ++++++-- packages/jest-changed-files/src/hg.js | 2 + packages/jest-cli/src/cli/args.js | 15 ++++- .../jest-cli/src/get_changed_files_promise.js | 1 + packages/jest-config/src/index.js | 1 + packages/jest-config/src/normalize.js | 1 + packages/jest-config/src/valid_config.js | 1 + test_utils.js | 1 + types/Argv.js | 1 + types/ChangedFiles.js | 1 + types/Config.js | 2 + 14 files changed, 115 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb2c40262a72..9cac810ffb67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ * `[jest-cli]` Make Jest exit without an error when no tests are found in the case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options having been passed to the CLI +* `[jest-cli]` Allow selectively running tests for code changed since arbitrary + revisions. ([#5188](https://github.com/facebook/jest/pull/5188)) ### Fixes * `[jest-cli]` Use `import-local` to support global Jest installations. diff --git a/docs/CLI.md b/docs/CLI.md index b9aa40ecbefb..4b3087f9f9cb 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -103,6 +103,12 @@ two times slower._ If you want to inspect the cache, use `--showConfig` and look at the `cacheDirectory` value. If you need to clear the cache, use `--clearCache`. +### `--changedFilesToContributeTo` + +When used together with `--onlyChanged` or `--watch`, it runs tests related the +changes since the provided revision. If the current branch is not a child of the +given commit, then only changes made locally will be tested. + ### `--changedFilesWithAncestor` Runs tests related to the current changes and the changes made in the last diff --git a/integration-tests/__tests__/jest_changed_files.test.js b/integration-tests/__tests__/jest_changed_files.test.js index 759f246f49e8..943fea029df9 100644 --- a/integration-tests/__tests__/jest_changed_files.test.js +++ b/integration-tests/__tests__/jest_changed_files.test.js @@ -191,6 +191,37 @@ test('gets changed files for git', async () => { .map(filePath => path.basename(filePath)) .sort(), ).toEqual(['file1.txt', 'file4.txt']); + + run(`${GIT} add file4.txt`, DIR); + run(`${GIT} commit -m "test3"`, DIR); + + ({changedFiles: files} = await getChangedFilesForRoots(roots, { + toContributeTo: 'HEAD^^', + })); + // Returns files from the last 2 commits + expect( + Array.from(files) + .map(filePath => path.basename(filePath)) + .sort(), + ).toEqual(['file1.txt', 'file4.txt']); + + run(`${GIT} checkout HEAD^^ -b feature-branch`, DIR); + + writeFiles(DIR, { + 'file5.txt': 'file5', + }); + run(`${GIT} add file5.txt`, DIR); + run(`${GIT} commit -m "test5"`, DIR); + + ({changedFiles: files} = await getChangedFilesForRoots(roots, { + toContributeTo: 'master', + })); + // Returns files from this branch but not ones that only exist on master + expect( + Array.from(files) + .map(filePath => path.basename(filePath)) + .sort(), + ).toEqual(['file5.txt']); }); test('gets changed files for hg', async () => { @@ -261,4 +292,37 @@ test('gets changed files for hg', async () => { .map(filePath => path.basename(filePath)) .sort(), ).toEqual(['file1.txt', 'file4.txt']); + + run(`${HG} add file4.txt`, DIR); + run(`${HG} commit -m "test3"`, DIR); + + ({changedFiles: files} = await getChangedFilesForRoots(roots, { + toContributeTo: '-3', + })); + // Returns files from the last 2 commits + expect( + Array.from(files) + .map(filePath => path.basename(filePath)) + .sort(), + ).toEqual(['file1.txt', 'file4.txt']); + + run(`${HG} bookmark master`, DIR); + // Back up and develop on a different branch + run(`${HG} checkout --rev=-2`, DIR); + + writeFiles(DIR, { + 'file5.txt': 'file5', + }); + run(`${HG} add file5.txt`, DIR); + run(`${HG} commit -m "test4"`, DIR); + + ({changedFiles: files} = await getChangedFilesForRoots(roots, { + toContributeTo: 'master', + })); + // Returns files from this branch but not ones that only exist on master + expect( + Array.from(files) + .map(filePath => path.basename(filePath)) + .sort(), + ).toEqual(['file5.txt']); }); diff --git a/packages/jest-changed-files/src/git.js b/packages/jest-changed-files/src/git.js index ef02aaea3dbc..9d67ea443d8b 100644 --- a/packages/jest-changed-files/src/git.js +++ b/packages/jest-changed-files/src/git.js @@ -13,7 +13,10 @@ import type {Options, SCMAdapter} from 'types/ChangedFiles'; import path from 'path'; import childProcess from 'child_process'; -const findChangedFilesUsingCommand = async (args, cwd) => { +const findChangedFilesUsingCommand = async ( + args: Array, + cwd: Path, +): Promise> => { return new Promise((resolve, reject) => { const child = childProcess.spawn('git', args, {cwd}); let stdout = ''; @@ -30,6 +33,7 @@ const findChangedFilesUsingCommand = async (args, cwd) => { resolve( stdout .split('\n') + .filter(s => s !== '') .map(changedPath => path.resolve(cwd, changedPath)), ); } @@ -45,21 +49,28 @@ const adapter: SCMAdapter = { cwd: string, options?: Options, ): Promise> => { + const toContributeTo: ?string = + options && (options.withAncestor ? 'HEAD^' : options.toContributeTo); + if (options && options.lastCommit) { return await findChangedFilesUsingCommand( ['show', '--name-only', '--pretty=%b', 'HEAD'], cwd, ); - } else if (options && options.withAncestor) { - const changed = await findChangedFilesUsingCommand( - ['diff', '--name-only', 'HEAD^'], + } else if (toContributeTo) { + const committed = await findChangedFilesUsingCommand( + ['log', '--name-only', '--pretty=%b', 'HEAD', `^${toContributeTo}`], + cwd, + ); + const staged = await findChangedFilesUsingCommand( + ['diff', '--cached', '--name-only'], cwd, ); - const untracked = await findChangedFilesUsingCommand( - ['ls-files', '--other', '--exclude-standard'], + const unstaged = await findChangedFilesUsingCommand( + ['ls-files', '--other', '--modified', '--exclude-standard'], cwd, ); - return changed.concat(untracked); + return [...committed, ...staged, ...unstaged]; } else { return await findChangedFilesUsingCommand( ['ls-files', '--other', '--modified', '--exclude-standard'], diff --git a/packages/jest-changed-files/src/hg.js b/packages/jest-changed-files/src/hg.js index b02859c66de8..2728dcf51a3c 100644 --- a/packages/jest-changed-files/src/hg.js +++ b/packages/jest-changed-files/src/hg.js @@ -26,6 +26,8 @@ const adapter: SCMAdapter = { let args = ['status', '-amnu']; if (options && options.withAncestor) { args.push('--rev', 'ancestor(.^)'); + } else if (options && options.toContributeTo) { + args.push('--rev', `ancestor(., ${options.toContributeTo})`); } else if (options && options.lastCommit === true) { args = ['tip', '--template', '{files%"{file}\n"}']; } diff --git a/packages/jest-cli/src/cli/args.js b/packages/jest-cli/src/cli/args.js index 578f6aeaa41d..3af387a2a52c 100644 --- a/packages/jest-cli/src/cli/args.js +++ b/packages/jest-cli/src/cli/args.js @@ -20,7 +20,12 @@ export const check = (argv: Argv) => { ); } - for (const key of ['onlyChanged', 'lastCommit', 'changedFilesWithAncestor']) { + for (const key of [ + 'onlyChanged', + 'lastCommit', + 'changedFilesWithAncestor', + 'changedFilesToContributeTo', + ]) { if (argv[key]) { argv.onlyChanged = true; } @@ -107,6 +112,14 @@ export const options = { ' dependency information.', type: 'string', }, + changedFilesToContributeTo: { + description: + 'Runs tests related the changes since the provided branch. If the ' + + 'current branch has diverged from the given branch, then only changes ' + + 'made locally will be tested. Behaves similarly to `--onlyChanged`.', + nargs: 1, + type: 'string', + }, changedFilesWithAncestor: { description: 'Runs tests related to the current changes and the changes made in the ' + diff --git a/packages/jest-cli/src/get_changed_files_promise.js b/packages/jest-cli/src/get_changed_files_promise.js index 68005453f5b6..ed67b3e65676 100644 --- a/packages/jest-cli/src/get_changed_files_promise.js +++ b/packages/jest-cli/src/get_changed_files_promise.js @@ -22,6 +22,7 @@ export default ( ); return getChangedFilesForRoots(allRootsForAllProjects, { lastCommit: globalConfig.lastCommit, + toContributeTo: globalConfig.changedFilesToContributeTo, withAncestor: globalConfig.changedFilesWithAncestor, }); } diff --git a/packages/jest-config/src/index.js b/packages/jest-config/src/index.js index c4dbf27c90c3..eef2ace02198 100644 --- a/packages/jest-config/src/index.js +++ b/packages/jest-config/src/index.js @@ -93,6 +93,7 @@ const getConfigs = ( return { globalConfig: Object.freeze({ bail: options.bail, + changedFilesToContributeTo: options.changedFilesToContributeTo, changedFilesWithAncestor: options.changedFilesWithAncestor, collectCoverage: options.collectCoverage, collectCoverageFrom: options.collectCoverageFrom, diff --git a/packages/jest-config/src/normalize.js b/packages/jest-config/src/normalize.js index 1349360745b1..9f4b8984bed4 100644 --- a/packages/jest-config/src/normalize.js +++ b/packages/jest-config/src/normalize.js @@ -461,6 +461,7 @@ export default function normalize(options: InitialOptions, argv: Argv) { case 'bail': case 'browser': case 'cache': + case 'changedFilesToContributeTo': case 'changedFilesWithAncestor': case 'clearMocks': case 'collectCoverage': diff --git a/packages/jest-config/src/valid_config.js b/packages/jest-config/src/valid_config.js index 43947aee5b40..20bb12f3f8be 100644 --- a/packages/jest-config/src/valid_config.js +++ b/packages/jest-config/src/valid_config.js @@ -20,6 +20,7 @@ export default ({ browser: false, cache: true, cacheDirectory: '/tmp/user/jest', + changedFilesToContributeTo: '', changedFilesWithAncestor: false, clearMocks: false, collectCoverage: true, diff --git a/test_utils.js b/test_utils.js index 7349b7d33dba..b1ada9e561a9 100644 --- a/test_utils.js +++ b/test_utils.js @@ -13,6 +13,7 @@ import type {GlobalConfig, ProjectConfig} from 'types/Config'; const DEFAULT_GLOBAL_CONFIG: GlobalConfig = { bail: false, + changedFilesToContributeTo: '', changedFilesWithAncestor: false, collectCoverage: false, collectCoverageFrom: [], diff --git a/types/Argv.js b/types/Argv.js index 137d46ce2591..4dd5787f2456 100644 --- a/types/Argv.js +++ b/types/Argv.js @@ -17,6 +17,7 @@ export type Argv = {| browser: boolean, cache: boolean, cacheDirectory: string, + changedFilesToContributeTo: string, changedFilesWithAncestor: boolean, clearMocks: boolean, ci: boolean, diff --git a/types/ChangedFiles.js b/types/ChangedFiles.js index e69fa343899e..2ed911288481 100644 --- a/types/ChangedFiles.js +++ b/types/ChangedFiles.js @@ -12,6 +12,7 @@ import type {Path} from 'types/Config'; export type Options = {| lastCommit?: boolean, withAncestor?: boolean, + toContributeTo?: string, |}; export type ChangedFiles = Set; diff --git a/types/Config.js b/types/Config.js index e9625660445f..47b7a8254c9f 100644 --- a/types/Config.js +++ b/types/Config.js @@ -77,6 +77,7 @@ export type InitialOptions = { cacheDirectory?: Path, clearMocks?: boolean, changedFilesWithAncestor?: boolean, + changedFilesToContributeTo?: string, collectCoverage?: boolean, collectCoverageFrom?: Array, collectCoverageOnlyFrom?: {[key: string]: boolean}, @@ -159,6 +160,7 @@ export type SnapshotUpdateState = 'all' | 'new' | 'none'; export type GlobalConfig = {| bail: boolean, + changedFilesToContributeTo: string, changedFilesWithAncestor: boolean, collectCoverage: boolean, collectCoverageFrom: Array, From 373562b4ad308f5dabf2031e47141aba9b442025 Mon Sep 17 00:00:00 2001 From: David Laban Date: Mon, 15 Jan 2018 20:00:16 +0000 Subject: [PATCH 2/3] rename; reorder; fix CLI.md --- CHANGELOG.md | 5 +++-- docs/CLI.md | 12 ++++++------ .../__tests__/jest_changed_files.test.js | 8 ++++---- packages/jest-changed-files/src/git.js | 8 ++++---- packages/jest-changed-files/src/hg.js | 4 ++-- packages/jest-cli/src/cli/args.js | 16 ++++++++-------- .../jest-cli/src/get_changed_files_promise.js | 2 +- packages/jest-config/src/index.js | 2 +- packages/jest-config/src/normalize.js | 2 +- packages/jest-config/src/valid_config.js | 2 +- test_utils.js | 2 +- types/Argv.js | 2 +- types/ChangedFiles.js | 2 +- types/Config.js | 4 ++-- 14 files changed, 36 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cac810ffb67..06af419532b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,8 +28,9 @@ * `[jest-cli]` Make Jest exit without an error when no tests are found in the case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options having been passed to the CLI -* `[jest-cli]` Allow selectively running tests for code changed since arbitrary - revisions. ([#5188](https://github.com/facebook/jest/pull/5188)) +* `[jest-cli]` `--changedSince`: allow selectively running tests for code + changed since arbitrary revisions. + ([#5312](https://github.com/facebook/jest/pull/5312)) ### Fixes * `[jest-cli]` Use `import-local` to support global Jest installations. diff --git a/docs/CLI.md b/docs/CLI.md index 4b3087f9f9cb..0865826810e8 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -103,17 +103,17 @@ two times slower._ If you want to inspect the cache, use `--showConfig` and look at the `cacheDirectory` value. If you need to clear the cache, use `--clearCache`. -### `--changedFilesToContributeTo` - -When used together with `--onlyChanged` or `--watch`, it runs tests related the -changes since the provided revision. If the current branch is not a child of the -given commit, then only changes made locally will be tested. - ### `--changedFilesWithAncestor` Runs tests related to the current changes and the changes made in the last commit. Behaves similarly to `--onlyChanged`. +### `--changedSince` + +Runs tests related the changes since the provided branch. If the current branch +has diverged from the given branch, then only changes made locally will be +tested. Behaves similarly to `--onlyChanged`. + ### `--ci` When this option is provided, Jest will assume it is running in a CI diff --git a/integration-tests/__tests__/jest_changed_files.test.js b/integration-tests/__tests__/jest_changed_files.test.js index 943fea029df9..72f1ad93ccac 100644 --- a/integration-tests/__tests__/jest_changed_files.test.js +++ b/integration-tests/__tests__/jest_changed_files.test.js @@ -196,7 +196,7 @@ test('gets changed files for git', async () => { run(`${GIT} commit -m "test3"`, DIR); ({changedFiles: files} = await getChangedFilesForRoots(roots, { - toContributeTo: 'HEAD^^', + changedSince: 'HEAD^^', })); // Returns files from the last 2 commits expect( @@ -214,7 +214,7 @@ test('gets changed files for git', async () => { run(`${GIT} commit -m "test5"`, DIR); ({changedFiles: files} = await getChangedFilesForRoots(roots, { - toContributeTo: 'master', + changedSince: 'master', })); // Returns files from this branch but not ones that only exist on master expect( @@ -297,7 +297,7 @@ test('gets changed files for hg', async () => { run(`${HG} commit -m "test3"`, DIR); ({changedFiles: files} = await getChangedFilesForRoots(roots, { - toContributeTo: '-3', + changedSince: '-3', })); // Returns files from the last 2 commits expect( @@ -317,7 +317,7 @@ test('gets changed files for hg', async () => { run(`${HG} commit -m "test4"`, DIR); ({changedFiles: files} = await getChangedFilesForRoots(roots, { - toContributeTo: 'master', + changedSince: 'master', })); // Returns files from this branch but not ones that only exist on master expect( diff --git a/packages/jest-changed-files/src/git.js b/packages/jest-changed-files/src/git.js index 9d67ea443d8b..5450c7ce81ec 100644 --- a/packages/jest-changed-files/src/git.js +++ b/packages/jest-changed-files/src/git.js @@ -49,17 +49,17 @@ const adapter: SCMAdapter = { cwd: string, options?: Options, ): Promise> => { - const toContributeTo: ?string = - options && (options.withAncestor ? 'HEAD^' : options.toContributeTo); + const changedSince: ?string = + options && (options.withAncestor ? 'HEAD^' : options.changedSince); if (options && options.lastCommit) { return await findChangedFilesUsingCommand( ['show', '--name-only', '--pretty=%b', 'HEAD'], cwd, ); - } else if (toContributeTo) { + } else if (changedSince) { const committed = await findChangedFilesUsingCommand( - ['log', '--name-only', '--pretty=%b', 'HEAD', `^${toContributeTo}`], + ['log', '--name-only', '--pretty=%b', 'HEAD', `^${changedSince}`], cwd, ); const staged = await findChangedFilesUsingCommand( diff --git a/packages/jest-changed-files/src/hg.js b/packages/jest-changed-files/src/hg.js index 2728dcf51a3c..ccf4b923e818 100644 --- a/packages/jest-changed-files/src/hg.js +++ b/packages/jest-changed-files/src/hg.js @@ -26,8 +26,8 @@ const adapter: SCMAdapter = { let args = ['status', '-amnu']; if (options && options.withAncestor) { args.push('--rev', 'ancestor(.^)'); - } else if (options && options.toContributeTo) { - args.push('--rev', `ancestor(., ${options.toContributeTo})`); + } else if (options && options.changedSince) { + args.push('--rev', `ancestor(., ${options.changedSince})`); } else if (options && options.lastCommit === true) { args = ['tip', '--template', '{files%"{file}\n"}']; } diff --git a/packages/jest-cli/src/cli/args.js b/packages/jest-cli/src/cli/args.js index 3af387a2a52c..a0b4c9366515 100644 --- a/packages/jest-cli/src/cli/args.js +++ b/packages/jest-cli/src/cli/args.js @@ -24,7 +24,7 @@ export const check = (argv: Argv) => { 'onlyChanged', 'lastCommit', 'changedFilesWithAncestor', - 'changedFilesToContributeTo', + 'changedSince', ]) { if (argv[key]) { argv.onlyChanged = true; @@ -112,7 +112,13 @@ export const options = { ' dependency information.', type: 'string', }, - changedFilesToContributeTo: { + changedFilesWithAncestor: { + description: + 'Runs tests related to the current changes and the changes made in the ' + + 'last commit. Behaves similarly to `--onlyChanged`.', + type: 'boolean', + }, + changedSince: { description: 'Runs tests related the changes since the provided branch. If the ' + 'current branch has diverged from the given branch, then only changes ' + @@ -120,12 +126,6 @@ export const options = { nargs: 1, type: 'string', }, - changedFilesWithAncestor: { - description: - 'Runs tests related to the current changes and the changes made in the ' + - 'last commit. Behaves similarly to `--onlyChanged`.', - type: 'boolean', - }, ci: { default: isCI, description: diff --git a/packages/jest-cli/src/get_changed_files_promise.js b/packages/jest-cli/src/get_changed_files_promise.js index ed67b3e65676..d8bc8ed59e84 100644 --- a/packages/jest-cli/src/get_changed_files_promise.js +++ b/packages/jest-cli/src/get_changed_files_promise.js @@ -21,8 +21,8 @@ export default ( [], ); return getChangedFilesForRoots(allRootsForAllProjects, { + changedSince: globalConfig.changedSince, lastCommit: globalConfig.lastCommit, - toContributeTo: globalConfig.changedFilesToContributeTo, withAncestor: globalConfig.changedFilesWithAncestor, }); } diff --git a/packages/jest-config/src/index.js b/packages/jest-config/src/index.js index eef2ace02198..ccfa0e2db4bf 100644 --- a/packages/jest-config/src/index.js +++ b/packages/jest-config/src/index.js @@ -93,8 +93,8 @@ const getConfigs = ( return { globalConfig: Object.freeze({ bail: options.bail, - changedFilesToContributeTo: options.changedFilesToContributeTo, changedFilesWithAncestor: options.changedFilesWithAncestor, + changedSince: options.changedSince, collectCoverage: options.collectCoverage, collectCoverageFrom: options.collectCoverageFrom, collectCoverageOnlyFrom: options.collectCoverageOnlyFrom, diff --git a/packages/jest-config/src/normalize.js b/packages/jest-config/src/normalize.js index 9f4b8984bed4..1bd405676c10 100644 --- a/packages/jest-config/src/normalize.js +++ b/packages/jest-config/src/normalize.js @@ -461,7 +461,7 @@ export default function normalize(options: InitialOptions, argv: Argv) { case 'bail': case 'browser': case 'cache': - case 'changedFilesToContributeTo': + case 'changedSince': case 'changedFilesWithAncestor': case 'clearMocks': case 'collectCoverage': diff --git a/packages/jest-config/src/valid_config.js b/packages/jest-config/src/valid_config.js index 20bb12f3f8be..dba9ab45f210 100644 --- a/packages/jest-config/src/valid_config.js +++ b/packages/jest-config/src/valid_config.js @@ -20,8 +20,8 @@ export default ({ browser: false, cache: true, cacheDirectory: '/tmp/user/jest', - changedFilesToContributeTo: '', changedFilesWithAncestor: false, + changedSince: '', clearMocks: false, collectCoverage: true, collectCoverageFrom: ['src', '!public'], diff --git a/test_utils.js b/test_utils.js index b1ada9e561a9..5f9645826635 100644 --- a/test_utils.js +++ b/test_utils.js @@ -13,8 +13,8 @@ import type {GlobalConfig, ProjectConfig} from 'types/Config'; const DEFAULT_GLOBAL_CONFIG: GlobalConfig = { bail: false, - changedFilesToContributeTo: '', changedFilesWithAncestor: false, + changedSince: '', collectCoverage: false, collectCoverageFrom: [], collectCoverageOnlyFrom: null, diff --git a/types/Argv.js b/types/Argv.js index 4dd5787f2456..a46c5aa14bd2 100644 --- a/types/Argv.js +++ b/types/Argv.js @@ -17,8 +17,8 @@ export type Argv = {| browser: boolean, cache: boolean, cacheDirectory: string, - changedFilesToContributeTo: string, changedFilesWithAncestor: boolean, + changedSince: string, clearMocks: boolean, ci: boolean, collectCoverage: boolean, diff --git a/types/ChangedFiles.js b/types/ChangedFiles.js index 2ed911288481..1b7249710a9b 100644 --- a/types/ChangedFiles.js +++ b/types/ChangedFiles.js @@ -12,7 +12,7 @@ import type {Path} from 'types/Config'; export type Options = {| lastCommit?: boolean, withAncestor?: boolean, - toContributeTo?: string, + changedSince?: string, |}; export type ChangedFiles = Set; diff --git a/types/Config.js b/types/Config.js index 47b7a8254c9f..f5ca383ad1b1 100644 --- a/types/Config.js +++ b/types/Config.js @@ -77,7 +77,7 @@ export type InitialOptions = { cacheDirectory?: Path, clearMocks?: boolean, changedFilesWithAncestor?: boolean, - changedFilesToContributeTo?: string, + changedSince?: string, collectCoverage?: boolean, collectCoverageFrom?: Array, collectCoverageOnlyFrom?: {[key: string]: boolean}, @@ -160,7 +160,7 @@ export type SnapshotUpdateState = 'all' | 'new' | 'none'; export type GlobalConfig = {| bail: boolean, - changedFilesToContributeTo: string, + changedSince: string, changedFilesWithAncestor: boolean, collectCoverage: boolean, collectCoverageFrom: Array, From c95f4e327f40db1599717d7fced6b6f89afbfbdf Mon Sep 17 00:00:00 2001 From: David Laban Date: Fri, 19 Jan 2018 07:36:48 +0000 Subject: [PATCH 3/3] doc changes from review comments --- CHANGELOG.md | 8 +++++--- docs/CLI.md | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06af419532b4..1786e30b65d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## master +### Features +* `[jest-cli]` `--changedSince`: allow selectively running tests for code + changed since arbitrary revisions. + ([#5312](https://github.com/facebook/jest/pull/5312)) + ## jest 22.1.3 ### Fixes @@ -28,9 +33,6 @@ * `[jest-cli]` Make Jest exit without an error when no tests are found in the case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options having been passed to the CLI -* `[jest-cli]` `--changedSince`: allow selectively running tests for code - changed since arbitrary revisions. - ([#5312](https://github.com/facebook/jest/pull/5312)) ### Fixes * `[jest-cli]` Use `import-local` to support global Jest installations. diff --git a/docs/CLI.md b/docs/CLI.md index 0865826810e8..8cfc0a5d3acd 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -110,6 +110,8 @@ commit. Behaves similarly to `--onlyChanged`. ### `--changedSince` +##### available in Jest **22.2.0+** + Runs tests related the changes since the provided branch. If the current branch has diverged from the given branch, then only changes made locally will be tested. Behaves similarly to `--onlyChanged`.