Skip to content

Commit

Permalink
Showing 10 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lib/analyze.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/analyze.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions lib/config-utils.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/analyze.test.ts
@@ -3,7 +3,7 @@ import * as path from "path";

import test from "ava";
import * as yaml from "js-yaml";
import { parse } from "semver";
import { clean } from "semver";
import sinon from "sinon";

import { runQueries } from "./analyze";
@@ -39,13 +39,13 @@ test("status report fields and search path setting", async (t) => {
[Language.cpp]: [
{
packName: "a/b",
version: parse("1.0.0"),
version: clean("1.0.0"),
},
],
[Language.java]: [
{
packName: "c/d",
version: parse("2.0.0"),
version: clean("2.0.0"),
},
],
} as Packs;
2 changes: 1 addition & 1 deletion src/analyze.ts
@@ -318,7 +318,7 @@ function packWithVersionToQuerySuiteEntry(
): string {
let text = `- qlpack: ${pack.packName}`;
if (pack.version) {
text += `${"\n"} version: ${pack.version.format()}`;
text += `${"\n"} version: ${pack.version}`;
}
return text;
}
14 changes: 7 additions & 7 deletions src/config-utils.test.ts
@@ -3,7 +3,7 @@ import * as path from "path";

import * as github from "@actions/github";
import test, { ExecutionContext } from "ava";
import { parse } from "semver";
import { clean } from "semver";
import sinon from "sinon";

import * as api from "./api-client";
@@ -1027,7 +1027,7 @@ test("Config specifies packages", async (t) => {
[Language.javascript]: [
{
packName: "a/b",
version: parse("1.2.3"),
version: clean("1.2.3"),
},
],
});
@@ -1084,13 +1084,13 @@ test("Config specifies packages for multiple languages", async (t) => {
[Language.javascript]: [
{
packName: "a/b",
version: parse("1.2.3"),
version: clean("1.2.3"),
},
],
[Language.python]: [
{
packName: "c/d",
version: parse("1.2.3"),
version: clean("1.2.3"),
},
],
});
@@ -1366,7 +1366,7 @@ test("no packs", parsePacksMacro, undefined, [], {});
test("two packs", parsePacksMacro, ["a/b", "c/d@1.2.3"], [Language.cpp], {
[Language.cpp]: [
{ packName: "a/b", version: undefined },
{ packName: "c/d", version: parse("1.2.3") },
{ packName: "c/d", version: clean("1.2.3") },
],
});
test(
@@ -1380,11 +1380,11 @@ test(
{
[Language.cpp]: [
{ packName: "a/b", version: undefined },
{ packName: "c/d", version: parse("1.2.3") },
{ packName: "c/d", version: clean("1.2.3") },
],
[Language.java]: [
{ packName: "d/e", version: undefined },
{ packName: "f/g", version: parse("1.2.3") },
{ packName: "f/g", version: clean("1.2.3") },
],
}
);
6 changes: 3 additions & 3 deletions src/config-utils.ts
@@ -133,7 +133,7 @@ export interface PackWithVersion {
/** qualified name of a package reference */
packName: string;
/** version of the package, or undefined, which means latest version */
version?: semver.SemVer;
version?: string;
}

/**
@@ -1072,14 +1072,14 @@ function toPackWithVersion(packStr, configFile: string): PackWithVersion {
throw new Error(getPacksStrInvalid(packStr, configFile));
}
const nameWithVersion = packStr.split("@");
let version: semver.SemVer | undefined;
let version: string | undefined;
if (
nameWithVersion.length > 2 ||
!PACK_IDENTIFIER_PATTERN.test(nameWithVersion[0])
) {
throw new Error(getPacksStrInvalid(packStr, configFile));
} else if (nameWithVersion.length === 2) {
version = semver.parse(nameWithVersion[1]) || undefined;
version = semver.clean(nameWithVersion[1]) || undefined;
if (!version) {
throw new Error(getPacksStrInvalid(packStr, configFile));
}

0 comments on commit 06687e9

Please sign in to comment.