Skip to content

Commit d13514f

Browse files
authored
Convert remaining tests to concurrent and tune vitest (#1790)
1 parent 3b3b90c commit d13514f

69 files changed

Lines changed: 256 additions & 173 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tests/cases.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ afterAll(() => {
1515
fs.removeSync(dummyGitlabCiYmlPath);
1616
});
1717

18-
test("--completion", async () => {
18+
test.concurrent("--completion", async () => {
1919
const spy = vi.spyOn(console, "log").mockImplementation(() => {});
2020
const writeStreams = new WriteStreamsMock();
2121
await handler({
@@ -25,7 +25,7 @@ test("--completion", async () => {
2525
spy.mockRestore();
2626
});
2727

28-
test("something/unknown-directory (non-existing dir)", async () => {
28+
test.concurrent("something/unknown-directory (non-existing dir)", async () => {
2929
try {
3030
const writeStreams = new WriteStreamsMock();
3131
await handler({
@@ -38,7 +38,7 @@ test("something/unknown-directory (non-existing dir)", async () => {
3838
}
3939
});
4040

41-
test("docs (no .gitlab-ci.yml)", async () => {
41+
test.concurrent("docs (no .gitlab-ci.yml)", async () => {
4242
try {
4343
const writeStreams = new WriteStreamsMock();
4444
await handler({
@@ -51,7 +51,7 @@ test("docs (no .gitlab-ci.yml)", async () => {
5151
}
5252
});
5353

54-
test("empty .gitlab-ci.yml", async () => {
54+
test.concurrent("empty .gitlab-ci.yml", async () => {
5555
const writeStreams = new WriteStreamsMock();
5656
await handler({
5757
file: dummyGitlabCiYmlPath,

tests/expand.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@ import {Utils} from "../src/utils.js";
44
import assert from "assert";
55
import {AssertionError} from "assert";
66

7-
test("VAR w.o. brackets positive", () => {
7+
test.concurrent("VAR w.o. brackets positive", () => {
88
const expanded = Utils.expandText("$VAR", {VAR: "success"});
99
expect(expanded).toBe("success");
1010
});
1111

12-
test("VAR w.o. brackets negative", () => {
12+
test.concurrent("VAR w.o. brackets negative", () => {
1313
const expanded = Utils.expandText("$VAR", {UNSET_VAR: "success"});
1414
expect(expanded).toBe("");
1515
});
1616

17-
test("VAR w. brackets postive", () => {
17+
test.concurrent("VAR w. brackets postive", () => {
1818
const expanded = Utils.expandText("${VAR}", {VAR: "success"});
1919
expect(expanded).toBe("success");
2020
});
2121

22-
test("VAR w. brackets negative", () => {
22+
test.concurrent("VAR w. brackets negative", () => {
2323
const expanded = Utils.expandText("${VAR}", {UNSET_VAR: "success"});
2424
expect(expanded).toBe("");
2525
});
2626

27-
test("VAR w/ escapes", () => {
27+
test.concurrent("VAR w/ escapes", () => {
2828
const expanded = Utils.expandText("$$VAR $$$VAR $$$$VAR", {VAR: "success"});
2929
expect(expanded).toBe("$VAR $success $$VAR");
3030
});
3131

32-
test("Expand null", () => {
32+
test.concurrent("Expand null", () => {
3333
const expanded = Utils.expandText(null, {});
3434
expect(expanded).toBe(null);
3535
});
3636

37-
test("extends invalid job", () => {
37+
test.concurrent("extends invalid job", () => {
3838
try {
3939
DataExpander.jobExtends({
4040
"test-job": {extends: ["build-job"]},
@@ -46,7 +46,7 @@ test("extends invalid job", () => {
4646
}
4747
});
4848

49-
test("extends infinite loop", () => {
49+
test.concurrent("extends infinite loop", () => {
5050
try {
5151
DataExpander.jobExtends({
5252
"build-job": {extends: ["test-job"]},
@@ -59,7 +59,7 @@ test("extends infinite loop", () => {
5959
}
6060
});
6161

62-
test("extends simple", () => {
62+
test.concurrent("extends simple", () => {
6363
const gitlabData = {
6464
"test-job": {
6565
extends: ["build-job"],

tests/print-funcs.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {Utils} from "../src/utils.js";
22
import {WriteStreamsMock} from "../src/write-streams.js";
33

4-
test("Print job on first index", () => {
4+
test.concurrent("Print job on first index", () => {
55
const writeStreams = new WriteStreamsMock();
66
Utils.printJobNames((txt) => writeStreams.stdout(txt), {name: "Hello"}, 0, [{name: "Hello"}, {name: "Hello"}, {name: "Hello"}]);
77
writeStreams.flush();
88
expect(writeStreams.stdoutLines).toEqual(["Hello, "]);
99
});
1010

11-
test("Print job on last index", () => {
11+
test.concurrent("Print job on last index", () => {
1212
const writeStreams = new WriteStreamsMock();
1313
Utils.printJobNames((txt) => writeStreams.stdout(txt), {name: "Hello"}, 2, [{name: "Hello"}, {name: "Hello"}, {name: "Hello"}]);
1414
writeStreams.flush();

tests/process-write-streams.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ afterAll(() => {
1414
spyStderr.mockRestore();
1515
});
1616

17-
test("Check ProcessWriteStreams ", () => {
17+
test.concurrent("Check ProcessWriteStreams ", () => {
1818
const writeStreams = new WriteStreamsProcess();
1919
writeStreams.stdout("Stdout message");
2020
writeStreams.stderr("Stderr message");

0 commit comments

Comments
 (0)