mirror of
https://github.com/github/codeql-action.git
synced 2026-10-21 02:01:27 +00:00
Accept paths containing only major version
Also fix unescaped dot patterns in regex
This commit is contained in:
2
lib/entry-points.js
generated
2
lib/entry-points.js
generated
@@ -175728,7 +175728,7 @@ function macOSVersion(action) {
|
||||
}
|
||||
var XCODE_SELECT_LINK_PATH = "/private/var/db/xcode_select_link";
|
||||
var XCODE_APP_FILENAME_PATTERN = new RegExp(
|
||||
/(?<filename>Xcode_(?<majorMinor>\d+.\d+).app)/
|
||||
/(?<filename>Xcode_(?<majorMinor>\d+(\.\d+)?)\.app)/
|
||||
);
|
||||
function xcodeVersion(logger2) {
|
||||
try {
|
||||
|
||||
@@ -225,3 +225,29 @@ test.serial("xcodeVersion returns version from resolved path", (t) => {
|
||||
t.is(readlinkSync.callCount, 1);
|
||||
t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]);
|
||||
});
|
||||
|
||||
test.serial("xcodeVersion returns major version from resolved path", (t) => {
|
||||
const logger = new RecordingLogger();
|
||||
|
||||
const lstatSync = sinon
|
||||
.stub(fs, "lstatSync")
|
||||
.returns({ isSymbolicLink: () => true } as fs.Stats);
|
||||
const readlinkSync = sinon
|
||||
.stub(fs, "readlinkSync")
|
||||
.returns("/Applications/Xcode_16.app/Contents/Developer");
|
||||
|
||||
const result = xcodeVersion(logger);
|
||||
|
||||
if (t.truthy(result)) {
|
||||
t.is(result.major, 16);
|
||||
t.is(result.minor, 0);
|
||||
}
|
||||
|
||||
t.is(lstatSync.callCount, 1);
|
||||
t.deepEqual(lstatSync.args[0], [
|
||||
XCODE_SELECT_LINK_PATH,
|
||||
{ throwIfNoEntry: false },
|
||||
]);
|
||||
t.is(readlinkSync.callCount, 1);
|
||||
t.deepEqual(readlinkSync.args[0], [XCODE_SELECT_LINK_PATH]);
|
||||
});
|
||||
|
||||
@@ -62,7 +62,7 @@ export const XCODE_SELECT_LINK_PATH = "/private/var/db/xcode_select_link";
|
||||
|
||||
/** The pattern we expect to find in the Xcode path. */
|
||||
export const XCODE_APP_FILENAME_PATTERN = new RegExp(
|
||||
/(?<filename>Xcode_(?<majorMinor>\d+.\d+).app)/,
|
||||
/(?<filename>Xcode_(?<majorMinor>\d+(\.\d+)?)\.app)/,
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user