Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ t test: fix

q test-quick:
npx tsc -p .
npm run test:unit
npm run test:vscode

### Build

Expand Down
2,055 changes: 1,070 additions & 985 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"compile": "npm run clean && tsc -p .",
"pretest": "npm run compile",
"test:unit": "cd out && mocha --recursive",
"test": "npm run test:unit",
"vscode:download": "node out/test/vscodeDownload",
"test:vscode": "npm run vscode:download && cd out && node test/runTest",
"test": "npm run test:vscode",
"cover": "nyc npm test",
"cover:report": "nyc report --reporter=lcov",
"cover:check": "nyc check-coverage --lines 95",
Expand All @@ -30,6 +32,9 @@
"vscode": "^1.74.0"
},
"devDependencies": {
"@types/glob": "^8.0.0",
"@vscode/test-electron": "^2.2.0",
"glob": "^8.0.3",
"@types/mocha": "^10.0.1",
"@types/node": "^16.11.1",
"@types/vscode": "^1.74.0",
Expand Down
26 changes: 13 additions & 13 deletions src/test/generate/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@
import * as assert from "assert";
import { lookupDiffIndexAction, moveOrRenameMsg } from "../../generate/action";

describe("Desribe a file using a single path", function () {
describe("#lookupDiffIndexAction", function () {
it("can describe an updated file", function () {
test("Desribe a file using a single path", function () {
test("#lookupDiffIndexAction", function () {
test("can describe an updated file", function () {
assert.strictEqual(lookupDiffIndexAction("M"), "update");
});

it("can describe a created file", function () {
test("can describe a created file", function () {
assert.strictEqual(lookupDiffIndexAction("A"), "create");
});

it("can describe a deleted file", function () {
test("can describe a deleted file", function () {
assert.strictEqual(lookupDiffIndexAction("D"), "delete");
});

it("can describe a renamed file", function () {
test("can describe a renamed file", function () {
assert.strictEqual(lookupDiffIndexAction("R"), "rename");
});

it("can describe a copied file", function () {
test("can describe a copied file", function () {
assert.strictEqual(lookupDiffIndexAction("C"), "copy");
});

it("can throws an error for a bad key", function () {
test("can throws an error for a bad key", function () {
assert.throws(() => lookupDiffIndexAction("Z"));
});
});
});

describe("Desribe a file using two paths", function () {
describe("#moveOrRenameFile", function () {
it("can describe a renamed file", function () {
test("Desribe a file using two paths", function () {
test("#moveOrRenameFile", function () {
test("can describe a renamed file", function () {
assert.strictEqual(
moveOrRenameMsg("foo.txt", "bar.txt"),
"rename foo.txt to bar.txt"
Expand All @@ -51,7 +51,7 @@ describe("Desribe a file using two paths", function () {
);
});

it("can describe a moved file", function () {
test("can describe a moved file", function () {
assert.strictEqual(
moveOrRenameMsg("buzz/foo.txt", "fizz/foo.txt"),
"move foo.txt to fizz"
Expand All @@ -73,7 +73,7 @@ describe("Desribe a file using two paths", function () {
);
});

it("can describe a remamed and moved file", function () {
test("can describe a remamed and moved file", function () {
assert.strictEqual(
moveOrRenameMsg("foo.txt", "fizz/bar.txt"),
"move and rename foo.txt to fizz/bar.txt"
Expand Down
48 changes: 24 additions & 24 deletions src/test/generate/convCommit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
} from "../../generate/convCommit";
import { ACTION, CONVENTIONAL_TYPE } from "../../lib/constants";

describe("Test #ConventionalCommit class for path-based conventional commit logic", function () {
describe("#isDocsRelated", function () {
it("determines that a README file is a doc", function () {
test("Test #ConventionalCommit class for path-based conventional commit logic", function () {
test("#isDocsRelated", function () {
test("determines that a README file is a doc", function () {
assert.strictEqual(
new ConventionalCommit("README.md").isDocsRelated(),
true
Expand All @@ -36,7 +36,7 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
);
});

it("determines that a CONTRIBUTING file is a doc", function () {
test("determines that a CONTRIBUTING file is a doc", function () {
assert.strictEqual(
new ConventionalCommit("CONTRIBUTING.md").isDocsRelated(),
true
Expand All @@ -47,7 +47,7 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
);
});

it("determines that a `.rst` file is a doc", function () {
test("determines that a `.rst` file is a doc", function () {
assert.strictEqual(
new ConventionalCommit("README.rst").isDocsRelated(),
true
Expand All @@ -58,7 +58,7 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
);
});

it("determines a file in the docs directory is a doc", function () {
test("determines a file in the docs directory is a doc", function () {
assert.strictEqual(
new ConventionalCommit("docs/fizz.md").isDocsRelated(),
true
Expand All @@ -80,8 +80,8 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
});
});

describe("#isBuildRelated", function () {
it("can recognize a build change for a build-related filename", function () {
test("#isBuildRelated", function () {
test("can recognize a build change for a build-related filename", function () {
assert.strictEqual(
new ConventionalCommit("Dockerfile").isBuildRelated(),
true
Expand All @@ -102,8 +102,8 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
});
});

describe("#isCIRelated", function () {
it("can tell a CI change is in a CircleCI directory", function () {
test("#isCIRelated", function () {
test("can tell a CI change is in a CircleCI directory", function () {
assert.strictEqual(
new ConventionalCommit(".circleci/foo.txt").isCIRelated(),
true
Expand All @@ -119,7 +119,7 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
);
});

it("can tell a CI change is in a workflows directory", function () {
test("can tell a CI change is in a workflows directory", function () {
assert.strictEqual(
new ConventionalCommit(".github/workflows/foo.txt").isCIRelated(),
true
Expand All @@ -135,7 +135,7 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
);
});

it("can tell a CI change for a CI filename", function () {
test("can tell a CI change for a CI filename", function () {
assert.strictEqual(
new ConventionalCommit("netlify.toml").isCIRelated(),
true
Expand All @@ -152,8 +152,8 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
});
});

describe("#isTestRelated", function () {
it("can tell a test directory is for tests", function () {
test("#isTestRelated", function () {
test("can tell a test directory is for tests", function () {
assert.strictEqual(
new ConventionalCommit("test/foo.js").isTestRelated(),
true
Expand All @@ -173,7 +173,7 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
);
});

it("can tell a test file is for tests", function () {
test("can tell a test file is for tests", function () {
assert.strictEqual(
new ConventionalCommit("foo/bar.test.js").isTestRelated(),
true
Expand All @@ -185,13 +185,13 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
});
});

describe("#getType", function () {
test("#getType", function () {
// Rather than true and false like in above tests this actually categorizes
// and also it closer to the real world as it through a hierarchy (for
// example .yml is config-related unless it is for a CI file). But, this
// doesn't care what the action is like create or delete or modify, so it
// won't impose meaning based on that.
it("sees a build file as build", function () {
test("sees a build file as build", function () {
assert.strictEqual(
new ConventionalCommit("Makefile").getType(),
CONVENTIONAL_TYPE.BUILD
Expand All @@ -212,7 +212,7 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
);
});

it("sees a dependency-related file as 'build' and with dependency scope", function () {
test("sees a dependency-related file as 'build' and with dependency scope", function () {
assert.strictEqual(
new ConventionalCommit("Gemfile").getType(),
CONVENTIONAL_TYPE.BUILD_DEPENDENCIES
Expand All @@ -234,7 +234,7 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
});

// TODO: Break into categories
it("can tell a type for other types", function () {
test("can tell a type for other types", function () {
assert.strictEqual(
new ConventionalCommit("foo").getType(),
CONVENTIONAL_TYPE.UNKNOWN
Expand Down Expand Up @@ -263,8 +263,8 @@ describe("Test #ConventionalCommit class for path-based conventional commit logi
});
});

describe("#getConventionType", function () {
it("uses feat for a new file if no other match is found", function () {
test("#getConventionType", function () {
test("uses feat for a new file if no other match is found", function () {
const add = ACTION.A;

assert.strictEqual(
Expand All @@ -281,7 +281,7 @@ describe("#getConventionType", function () {
CONVENTIONAL_TYPE.FEAT
);
});
it("knows a deleted file is always a chore", function () {
test("knows a deleted file is always a chore", function () {
const del = ACTION.D;

assert.strictEqual(
Expand All @@ -299,7 +299,7 @@ describe("#getConventionType", function () {
);
});

it("knows a renamed or moved file is always chore", function () {
test("knows a renamed or moved file is always chore", function () {
const renameOrMove = ACTION.R;

assert.strictEqual(
Expand All @@ -326,7 +326,7 @@ describe("#getConventionType", function () {
);
});

it("uses conventional commit type from path for a modified file, or leaves not set", function () {
test("uses conventional commit type from path for a modified file, or leaves unset", function () {
const modified = ACTION.M;

assert.strictEqual(
Expand Down
Loading