Skip to content
Draft
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,7 @@ lib/common/test-reports.xml
!lib/common/scripts/**
config/test-deps-versions-generated.json
!scripts/*.js
!dev/*.js

# build output
/dist
57 changes: 0 additions & 57 deletions dev/tsc-to-mocha-watch.js

This file was deleted.

37 changes: 37 additions & 0 deletions dev/tsc-to-vitest-watch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Run "tsc" in watch mode alongside vitest. Vitest runs the compiled output,
// so on its own it never notices a .ts edit - tsc has to re-emit first, and
// vitest picks the change up from there.

const { spawn } = require("child_process");

// shell: true so the node_modules/.bin shims resolve on Windows as well
const spawnOptions = { stdio: "inherit", shell: true };

const children = [
// --preserveWatchOutput keeps tsc from clearing the screen and wiping the
// test results out from under you on every recompile
spawn("tsc", ["--watch", "--preserveWatchOutput"], spawnOptions),
// --watch explicitly: vitest only infers watch mode when stdout is a TTY,
// and would otherwise run once and exit, taking tsc down with it
spawn("vitest", ["--watch"], spawnOptions),
];

let shuttingDown = false;

function shutdown() {
if (shuttingDown) {
return;
}
shuttingDown = true;
for (const child of children) {
child.kill("SIGINT");
}
}

process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);

for (const child of children) {
// if either side dies, don't leave the other running in the background
child.on("exit", shutdown);
}
86 changes: 0 additions & 86 deletions lib/common/test/definitions/mocha.d.ts

This file was deleted.

10 changes: 5 additions & 5 deletions lib/common/test/unit-tests/analytics-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe("analytics-service", () => {
service = null;
});

after(() => {
afterAll(() => {
setIsInteractive(null);
});

Expand All @@ -147,8 +147,8 @@ describe("analytics-service", () => {
});

it("returns false when analytics status is disabled", async () => {
baseTestScenario.exceptionsTracking = baseTestScenario.featureTracking =
false;
baseTestScenario.exceptionsTracking =
baseTestScenario.featureTracking = false;
const testInjector = createTestInjector(baseTestScenario);
service = testInjector.resolve<IAnalyticsService>("analyticsService");
const staticConfig: Config.IStaticConfig =
Expand Down Expand Up @@ -377,8 +377,8 @@ describe("analytics-service", () => {
});

it("does nothing when exception and feature tracking are already set", async () => {
baseTestScenario.featureTracking = baseTestScenario.exceptionsTracking =
true;
baseTestScenario.featureTracking =
baseTestScenario.exceptionsTracking = true;
const testInjector = createTestInjector(baseTestScenario);
service = testInjector.resolve<IAnalyticsService>("analyticsService");
await service.checkConsent();
Expand Down
Loading
Loading