forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--changedFilesWithAncestor (jestjs#4070)
* --changedFilesWithAncestor * Update git.js
- Loading branch information
1 parent
3db44ec
commit 2674e14
Showing
12 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ import path from 'path'; | |
const skipOnWindows = require('skipOnWindows'); | ||
const DIR = path.resolve(os.tmpdir(), 'jest_only_changed'); | ||
const GIT = 'git -c user.name=jest_test -c [email protected]'; | ||
const HG = 'hg --config ui.username=jest_test'; | ||
|
||
skipOnWindows.suite(); | ||
|
||
|
@@ -138,3 +139,53 @@ test('onlyChanged in config is overwritten by --all or testPathPattern', () => { | |
expect(stderr).toMatch('PASS __tests__/file2.test.js'); | ||
expect(stderr).toMatch('PASS __tests__/file3.test.js'); | ||
}); | ||
|
||
test('gets changed files for hg', async () => { | ||
if (process.env.CI) { | ||
// Circle and Travis have very old version of hg (v2, and current | ||
// version is v4.2) and its API changed since then and not compatible | ||
// any more. Changing the SCM version on CIs is not trivial, so we'll just | ||
// skip this test and run it only locally. | ||
return; | ||
} | ||
writeFiles(DIR, { | ||
'.watchmanconfig': '', | ||
'__tests__/file1.test.js': `require('../file1'); test('file1', () => {});`, | ||
'file1.js': 'module.exports = {}', | ||
'package.json': JSON.stringify({jest: {testEnvironment: 'node'}}), | ||
}); | ||
|
||
run(`${HG} init`, DIR); | ||
run(`${HG} add .`, DIR); | ||
run(`${HG} commit -m "test"`, DIR); | ||
|
||
let stdout; | ||
let stderr; | ||
|
||
({stdout, stderr} = runJest(DIR, ['-o'])); | ||
expect(stdout).toMatch('No tests found related to files changed'); | ||
|
||
writeFiles(DIR, { | ||
'__tests__/file2.test.js': `require('../file2'); test('file2', () => {});`, | ||
'file2.js': 'module.exports = {}', | ||
'file3.js': `require('./file2')`, | ||
}); | ||
|
||
({stdout, stderr} = runJest(DIR, ['-o'])); | ||
expect(stderr).toMatch('PASS __tests__/file2.test.js'); | ||
|
||
run(`${HG} add .`, DIR); | ||
run(`${HG} commit -m "test2"`, DIR); | ||
|
||
writeFiles(DIR, { | ||
'__tests__/file3.test.js': `require('../file3'); test('file3', () => {});`, | ||
}); | ||
|
||
({stdout, stderr} = runJest(DIR, ['-o'])); | ||
expect(stderr).toMatch('PASS __tests__/file3.test.js'); | ||
expect(stderr).not.toMatch('PASS __tests__/file2.test.js'); | ||
|
||
({stdout, stderr} = runJest(DIR, ['-o', '--changedFilesWithAncestor'])); | ||
expect(stderr).toMatch('PASS __tests__/file2.test.js'); | ||
expect(stderr).toMatch('PASS __tests__/file3.test.js'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters