jest-changed-files
Advanced tools
Comparing version 29.0.0 to 29.2.0
@@ -7,27 +7,26 @@ 'use strict'; | ||
exports.default = void 0; | ||
function path() { | ||
const data = _interopRequireWildcard(require('path')); | ||
path = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _util() { | ||
const data = require('util'); | ||
_util = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _execa() { | ||
const data = _interopRequireDefault(require('execa')); | ||
_execa = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : {default: obj}; | ||
} | ||
function _getRequireWildcardCache(nodeInterop) { | ||
@@ -41,3 +40,2 @@ if (typeof WeakMap !== 'function') return null; | ||
} | ||
function _interopRequireWildcard(obj, nodeInterop) { | ||
@@ -75,3 +73,2 @@ if (!nodeInterop && obj && obj.__esModule) { | ||
} | ||
/** | ||
@@ -84,5 +81,5 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
*/ | ||
const findChangedFilesUsingCommand = async (args, cwd) => { | ||
let result; | ||
try { | ||
@@ -93,7 +90,9 @@ result = await (0, _execa().default)('git', args, { | ||
} catch (e) { | ||
// TODO: Should we keep the original `message`? | ||
e.message = e.stderr; | ||
if (_util().types.isNativeError(e)) { | ||
const err = e; | ||
// TODO: Should we keep the original `message`? | ||
err.message = err.stderr; | ||
} | ||
throw e; | ||
} | ||
return result.stdout | ||
@@ -104,11 +103,10 @@ .split('\n') | ||
}; | ||
const adapter = { | ||
findChangedFiles: async (cwd, options) => { | ||
const changedSince = options.withAncestor ? 'HEAD^' : options.changedSince; | ||
const changedSince = | ||
options.withAncestor === true ? 'HEAD^' : options.changedSince; | ||
const includePaths = (options.includePaths ?? []).map(absoluteRoot => | ||
path().normalize(path().relative(cwd, absoluteRoot)) | ||
); | ||
if (options.lastCommit) { | ||
if (options.lastCommit === true) { | ||
return findChangedFilesUsingCommand( | ||
@@ -121,4 +119,3 @@ ['show', '--name-only', '--pretty=format:', 'HEAD', '--'].concat( | ||
} | ||
if (changedSince) { | ||
if (changedSince != null && changedSince.length > 0) { | ||
const [committed, staged, unstaged] = await Promise.all([ | ||
@@ -148,3 +145,2 @@ findChangedFilesUsingCommand( | ||
} | ||
const [staged, unstaged] = await Promise.all([ | ||
@@ -170,3 +166,2 @@ findChangedFilesUsingCommand( | ||
const options = ['rev-parse', '--show-cdup']; | ||
try { | ||
@@ -173,0 +168,0 @@ const result = await (0, _execa().default)('git', options, { |
@@ -7,27 +7,26 @@ 'use strict'; | ||
exports.default = void 0; | ||
function path() { | ||
const data = _interopRequireWildcard(require('path')); | ||
path = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _util() { | ||
const data = require('util'); | ||
_util = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _execa() { | ||
const data = _interopRequireDefault(require('execa')); | ||
_execa = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : {default: obj}; | ||
} | ||
function _getRequireWildcardCache(nodeInterop) { | ||
@@ -41,3 +40,2 @@ if (typeof WeakMap !== 'function') return null; | ||
} | ||
function _interopRequireWildcard(obj, nodeInterop) { | ||
@@ -75,3 +73,2 @@ if (!nodeInterop && obj && obj.__esModule) { | ||
} | ||
/** | ||
@@ -84,3 +81,7 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
*/ | ||
const env = {...process.env, HGPLAIN: '1'}; | ||
const env = { | ||
...process.env, | ||
HGPLAIN: '1' | ||
}; | ||
const adapter = { | ||
@@ -90,6 +91,8 @@ findChangedFiles: async (cwd, options) => { | ||
const args = ['status', '-amnu']; | ||
if (options.withAncestor) { | ||
if (options.withAncestor === true) { | ||
args.push('--rev', 'first(min(!public() & ::.)^+.^)'); | ||
} else if (options.changedSince) { | ||
} else if ( | ||
options.changedSince != null && | ||
options.changedSince.length > 0 | ||
) { | ||
args.push('--rev', `ancestor(., ${options.changedSince})`); | ||
@@ -99,6 +102,4 @@ } else if (options.lastCommit === true) { | ||
} | ||
args.push(...includePaths); | ||
let result; | ||
try { | ||
@@ -110,7 +111,9 @@ result = await (0, _execa().default)('hg', args, { | ||
} catch (e) { | ||
// TODO: Should we keep the original `message`? | ||
e.message = e.stderr; | ||
if (_util().types.isNativeError(e)) { | ||
const err = e; | ||
// TODO: Should we keep the original `message`? | ||
err.message = err.stderr; | ||
} | ||
throw e; | ||
} | ||
return result.stdout | ||
@@ -117,0 +120,0 @@ .split('\n') |
@@ -7,21 +7,14 @@ 'use strict'; | ||
exports.getChangedFilesForRoots = exports.findRepos = void 0; | ||
function _pLimit() { | ||
const data = _interopRequireDefault(require('p-limit')); | ||
_pLimit = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
var _git = _interopRequireDefault(require('./git')); | ||
var _hg = _interopRequireDefault(require('./hg')); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : {default: obj}; | ||
} | ||
/** | ||
@@ -34,13 +27,12 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
*/ | ||
function notEmpty(value) { | ||
return value != null; | ||
} // This is an arbitrary number. The main goal is to prevent projects with | ||
} | ||
// This is an arbitrary number. The main goal is to prevent projects with | ||
// many roots (50+) from spawning too many processes at once. | ||
const mutex = (0, _pLimit().default)(5); | ||
const findGitRoot = dir => mutex(() => _git.default.getRoot(dir)); | ||
const findHgRoot = dir => mutex(() => _hg.default.getRoot(dir)); | ||
const getChangedFilesForRoots = async (roots, options) => { | ||
@@ -64,3 +56,2 @@ const repos = await findRepos(roots); | ||
} | ||
return allFiles; | ||
@@ -73,5 +64,3 @@ }, new Set()); | ||
}; | ||
exports.getChangedFilesForRoots = getChangedFilesForRoots; | ||
const findRepos = async roots => { | ||
@@ -89,3 +78,2 @@ const gitRepos = await Promise.all( | ||
}; | ||
exports.findRepos = findRepos; |
{ | ||
"name": "jest-changed-files", | ||
"version": "29.0.0", | ||
"version": "29.2.0", | ||
"repository": { | ||
@@ -29,3 +29,3 @@ "type": "git", | ||
}, | ||
"gitHead": "75006e46c76f6fda14bbc0548f86edb2ba087cd2" | ||
"gitHead": "ee5b37a4f4433afcfffb0356cea47739d8092287" | ||
} |
13947
8
395