Skip to content

Commit 6b25e0e

Browse files
committed
chore: simplify mocha usage in als
Prepares for switching to vitest
1 parent 7338af3 commit 6b25e0e

File tree

5 files changed

+4
-152
lines changed

5 files changed

+4
-152
lines changed

packages/ansible-language-server/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@
8080
"compile": "tsc -p .",
8181
"prepack": "yarn compile",
8282
"prepare": "yarn run compile",
83-
"test": "sh -c \"c8 mocha ${MOCHA_OPTS:-} && tsx ../../test/fix-junit-reports.ts\"",
84-
"test-with-ee": "sh -c \"c8 mocha --grep @ee ${MOCHA_OPTS:-} && tsx ../../test/fix-junit-reports.ts \"",
85-
"test-without-ee": "sh -c \"SKIP_PODMAN=1 SKIP_DOCKER=1 c8 mocha --grep @ee --invert ${MOCHA_OPTS:-} && tsx ../../test/fix-junit-reports.ts\"",
83+
"test": "c8 mocha ${MOCHA_OPTS:-}",
84+
"test-with-ee": "c8 mocha --grep @ee ${MOCHA_OPTS:-}",
85+
"test-without-ee": "SKIP_PODMAN=1 SKIP_DOCKER=1 c8 mocha --grep @ee --invert ${MOCHA_OPTS:-}",
8686
"watch": "tsc --watch -p ."
8787
},
8888
"types": "./out/server/src/server.d.ts",

packages/ansible-language-server/test/consoleOutput.ts

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,9 @@
1-
import * as chai from "chai";
2-
import { ConsoleOutput } from "./consoleOutput";
3-
import { skipEE, console, deleteAlsCache } from "./helper";
4-
5-
chai.config.truncateThreshold = 0; // disable truncating
1+
import { deleteAlsCache } from "./helper";
62

73
export const mochaHooks = (): Mocha.RootHookObject => {
8-
const consoleOutput = new ConsoleOutput();
9-
104
return {
115
beforeAll(this: Mocha.Context) {
126
deleteAlsCache();
137
},
14-
beforeEach(this: Mocha.Context) {
15-
if (skipEE() && this.currentTest?.fullTitle().includes("@ee")) {
16-
console.warn(
17-
`Skipped test due to environment conditions: ${this.currentTest.title}`,
18-
);
19-
this.skip();
20-
} else {
21-
consoleOutput.capture();
22-
}
23-
},
24-
25-
afterEach(this: Mocha.Context) {
26-
if (!(skipEE() && this.currentTest?.fullTitle().includes("@ee"))) {
27-
if (this.currentTest?.state !== "passed") {
28-
consoleOutput.release();
29-
}
30-
}
31-
},
32-
afterAll(this: Mocha.Context) {
33-
deleteAlsCache();
34-
},
358
};
369
};

test/fix-junit-reports.ts

Lines changed: 0 additions & 53 deletions
This file was deleted.

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"src/**/*.ts",
1616
"webviews/lightspeed/src/utils/*.ts",
1717
"test",
18-
"packages/*/test/consoleOutput.ts",
1918
"*.js",
2019
"*.ts"
2120
],

0 commit comments

Comments
 (0)