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
277 changes: 0 additions & 277 deletions packages/cli/test/vitest-project-filter-preflight.test.ts

This file was deleted.

9 changes: 5 additions & 4 deletions packages/cli/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,15 @@
// ⛔ Every package-root harness module is named here ONE BY ONE, because the
// `include` above reaches `test/` and nothing else: a root module that is only
// reachable through a test's import is in the program by accident and leaves
// it the moment that import goes. `vitest-filter-preflight.ts` (#17853) is the
// fourth for that reason, not because a test happens to import it.
// it the moment that import goes. `vitest-filter-preflight.ts` was the fourth
// for that reason; #17978 moved that module to
// `packages/qa/vitest-filter-preflight`, which type-checks it in its own
// program, so the entry leaves with the file rather than dangling here.
"include": [
"test/**/*",
"vitest.config.ts",
"vitest-tiers.ts",
"vitest-tiers.fixtures.ts",
"vitest-filter-preflight.ts"
"vitest-tiers.fixtures.ts"
],
"exclude": ["node_modules", "dist"]
}
31 changes: 21 additions & 10 deletions packages/cli/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@
import { defineConfig } from 'vitest/config';
import path from 'path';
import { parseCLI } from 'vitest/node';
import { runFilterPreflight } from './vitest-filter-preflight.js';
import { runFilterPreflight } from '../qa/vitest-filter-preflight/src/index.js';
import { integrationTestFiles, unitTestFiles } from './vitest-tiers.js';

// The two tiers, DERIVED from what the files DO — never written down — over
Expand All @@ -656,18 +656,29 @@ import { integrationTestFiles, unitTestFiles } from './vitest-tiers.js';
export const INTEGRATION_FILES = integrationTestFiles(__dirname);
export const UNIT_FILES = unitTestFiles(__dirname, INTEGRATION_FILES);

// #17853 — say so when a path named on the command line will run no tests. It
// is invoked HERE, at config load, and ⛔ deliberately NOT as a `test.reporters`
// entry: naming that option replaces vitest's own reporter defaulting instead
// of extending it, which measurably changes a healthy run's output and would
// drop the `github-actions` reporter in CI. `vitest-filter-preflight.ts` carries
// both measurements. It reads the argv through vitest's own exported parser and
// the SAME two derived arrays the projects below take as their `include` — ⛔
// never a second derivation — and writes nothing whatever unless a named path
// selects nothing.
// #17853 / #17978 — say so when a path named on the command line will run no
// tests. It is invoked HERE, at config load, and ⛔ deliberately NOT as a
// `test.reporters` entry: naming that option replaces vitest's own reporter
// defaulting instead of extending it, which measurably changes a healthy run's
// output and would drop the `github-actions` reporter in CI. The ONE shared
// transcription of vitest's `TestProject.filterFiles` —
// `packages/qa/vitest-filter-preflight` — carries both measurements, and it is
// imported by RELATIVE PATH rather than by its package name for a third measured
// reason recorded in its header. It reads the argv through vitest's own exported
// parser and the SAME two derived arrays the projects below take as their
// `include` — ⛔ never a second derivation — and writes nothing whatever unless a
// named path selects nothing.
//
// ⭐ This package is the ONE of the eight that needs no walked population: both
// of its projects take an exact-path `include`, as a by-product of the tier walk
// it already performs for unrelated reasons (#13504 / #14554). So it hands the
// two arrays over directly and never calls `exactAndGlobPopulations`. That
// asymmetry is exactly why a port of this package's former local copy could not
// serve the other seven — #17978 carries the measurement.
runFilterPreflight({
argv: process.argv,
root: __dirname,
packageName: '@objectstack/cli',
populations: { unit: UNIT_FILES, integration: INTEGRATION_FILES },
parse: parseCLI,
});
Expand Down
32 changes: 32 additions & 0 deletions packages/core/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import { configDefaults, defineConfig } from 'vitest/config';
import { readFileSync } from 'node:fs';
import path from 'path';
import { parseCLI } from 'vitest/node';
import {
exactAndGlobPopulations,
runFilterPreflight,
} from '../qa/vitest-filter-preflight/src/index.js';

// #16466 -- two vitest projects, two turbo tasks. `repo` owns the tests that read
// outside this package (the list is vitest.repo-tests.json, which
Expand All @@ -12,6 +17,33 @@ import path from 'path';
// repo. `extends: true` keeps the root options (aliases included) on both.
const REPO_TESTS: string[] = JSON.parse(readFileSync(path.join(__dirname, 'vitest.repo-tests.json'), 'utf8'));

// #17853 / #17978 — say so when a path named on the command line will run no
// tests. Invoked HERE, at config load, and ⛔ deliberately NOT as a
// `test.reporters` entry: naming that option replaces vitest's own reporter
// defaulting instead of extending it, which measurably changes a healthy run's
// output and would drop the `github-actions` reporter in CI. The ONE shared
// transcription of vitest's `TestProject.filterFiles` carries both measurements,
// and it is imported by RELATIVE PATH rather than by its package name for a
// third measured reason recorded in its header. It reads the argv through
// vitest's own exported parser and writes nothing whatever unless a named path
// selects nothing.
//
// `local` takes a GLOB `include`, so its population is derived as a deliberate
// SUPERSET — every test file under this package, minus `REPO_TESTS` — which
// makes a false accusation structurally impossible and leaves drift able only
// to under-report. ⛔ Not a second run of vitest's own glob engine.
runFilterPreflight({
argv: process.argv,
root: __dirname,
packageName: '@objectstack/core',
populations: exactAndGlobPopulations({
root: __dirname,
exact: { repo: REPO_TESTS },
globProject: 'local',
}),
parse: parseCLI,
});

export default defineConfig({
test: {
// Each project re-declares the root block's test options: a ROOT-level
Expand Down
Loading
Loading