Skip to content
Merged
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
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,40 @@ jobs:

- name: Test
run: npm test

doctor:
name: Doctor (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# No darwin leg: unlike the CLI suites, these stub the platform through
# a fake HostInfo rather than probing it, so a second OS runs identical
# assertions.
node-version: [ '20.x', '22.x', '24.x' ]

steps:

- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit

- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false

- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: packages/doctor/package-lock.json

- name: Install
working-directory: packages/doctor
run: npm ci

- name: Test
working-directory: packages/doctor
run: npm test
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