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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"scripts": {
"build": "tsdown",
"lint": "biome check . --error-on-warnings",
"clean": "rm -rf dist src-gen",
"test": "vitest run"
"clean": "rm -rf dist src-gen"
},
"dependencies": {
"@prisma/orm-family-sql": "workspace:8.0.0-rc.11",
Expand All @@ -24,12 +23,10 @@
"devDependencies": {
"@internal/extension-pgvector": "workspace:8.0.0-rc.11",
"@repo/tsconfig": "workspace:8.0.0-rc.11",
"@internal/publish-surface": "workspace:8.0.0-rc.11",
"@repo/tsdown": "workspace:8.0.0-rc.11",
"@prisma/orm-target-postgres": "workspace:8.0.0-rc.11",
"tsdown": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
"typescript": "catalog:"
},
"peerDependencies": {
"@prisma/orm-target-postgres": "workspace:8.0.0-rc.11",
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions packages/9-public/@prisma/orm-postgres/coverage.config.json

This file was deleted.

7 changes: 2 additions & 5 deletions packages/9-public/@prisma/orm-postgres/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"build": "tsdown",
"prepack": "node ../../../../scripts/sync-package-skills.ts @prisma/orm-postgres",
"lint": "biome check . --error-on-warnings",
"clean": "rm -rf dist src-gen skills",
"test": "vitest run"
"clean": "rm -rf dist src-gen skills"
},
"dependencies": {
"@prisma/orm-family-sql": "workspace:8.0.0-rc.11",
Expand All @@ -29,11 +28,9 @@
"devDependencies": {
"@internal/postgres": "workspace:8.0.0-rc.11",
"@repo/tsconfig": "workspace:8.0.0-rc.11",
"@internal/publish-surface": "workspace:8.0.0-rc.11",
"@repo/tsdown": "workspace:8.0.0-rc.11",
"tsdown": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
"typescript": "catalog:"
},
"peerDependencies": {
"typescript": ">=5.9"
Expand Down
11 changes: 0 additions & 11 deletions packages/9-public/@prisma/orm-postgres/vitest.config.ts

This file was deleted.

18 changes: 6 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 1 addition & 21 deletions scripts/coverage-config.test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict';
import { glob, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { dirname, join, relative } from 'node:path';
import { dirname, join } from 'node:path';
import { after, before, describe, it } from 'node:test';

import {
Expand Down Expand Up @@ -225,26 +225,6 @@ describe('coverage config', () => {
}
});

it('every package Vitest project owns JSON and no TS config retains coverage', async () => {
const repositoryRoot = join(import.meta.dirname, '..');
const configs = discoverCoverageConfigs(repositoryRoot);
const vitestPaths = [];
for await (const path of glob('packages/**/vitest.config.ts', { cwd: repositoryRoot })) {
vitestPaths.push(path);
}
vitestPaths.sort();

assert.equal(vitestPaths.length, 70);
assert.deepEqual(
configs.map(({ configPath }) => relative(repositoryRoot, configPath)),
vitestPaths.map((path) => path.replace('vitest.config.ts', 'coverage.config.json')),
);
for (const path of vitestPaths) {
const source = await readFile(join(repositoryRoot, path), 'utf8');
assert.doesNotMatch(source, /\bcoverage\s*:/);
}
});

it('runs package coverage once from the root without package entry points', async () => {
const repositoryRoot = join(import.meta.dirname, '..');
const rootManifest = JSON.parse(await readFile(join(repositoryRoot, 'package.json'), 'utf8'));
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint-legacy-name.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const RETIREMENT_PROOFS = new Set([
'packages/1-framework/3-tooling/cli/test/orm/init-scaffold.test.ts',
'packages/1-framework/1-core/errors/test/next-actions.test.ts',
'packages/1-framework/3-tooling/migration/test/next-actions.test.ts',
'packages/9-public/@prisma/orm-postgres/test/facade-tarball.test.ts',
'test/integration/test/packaging/facade-tarball.test.ts',
'packages/9-public/@prisma/orm-target-postgres/test/cross-shell-tarball.test.ts',
'test/integration/test/cli.init-skill-distribution.integration.test.ts',
]);
Expand Down
15 changes: 12 additions & 3 deletions scripts/lint-single-import-root.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
* Scope is the consumer trees: `examples/`, `apps/` and `test/`. Packages
* under `packages/` are the substrate the shells are built from and name
* workspace packages by construction; the shells' own tests legitimately name
* both, and are excluded with them.
* both, and are excluded with them. The packaging suites under
* `test/integration/test/packaging/` are exempt for the same reason: their
* published-root specifiers are strings handed to scratch projects that
* install packed tarballs and run in a child process, so both roots never
* load into one module graph.
*
* Exits 1 listing every mixed package; exits 0 otherwise.
*/
Expand All @@ -28,6 +32,7 @@ import { extname, join, relative, sep } from 'node:path';
import { fileURLToPath } from 'node:url';

const CONSUMER_ROOTS = ['examples', 'apps', 'test'];
const EXEMPT_SUBTREES = ['test/integration/test/packaging'];
const INTERNAL_SCOPE = '@internal/';
const PUBLISHED_SCOPE = '@prisma/orm-';
const INCLUDED_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs']);
Expand Down Expand Up @@ -94,13 +99,17 @@ function ownFiles(pkg, allPackages) {
* root and how many more there are. Takes the roots as an argument so the
* check is reachable from a test with a fixture tree of its own.
*/
export function findMixedPackages(baseDir, roots = CONSUMER_ROOTS) {
export function findMixedPackages(baseDir, roots = CONSUMER_ROOTS, exempt = EXEMPT_SUBTREES) {
const packages = roots.flatMap((root) => [...walkPackages(join(baseDir, root))]);
const exemptPrefixes = exempt.map((subtree) => join(baseDir, subtree) + sep);
const mixed = [];
for (const pkg of packages) {
const internal = new Map();
const published = new Map();
for (const file of ownFiles(pkg, packages)) {
const files = ownFiles(pkg, packages).filter(
(file) => !exemptPrefixes.some((prefix) => file.startsWith(prefix)),
);
for (const file of files) {
for (const [, , specifier] of readFileSync(file, 'utf8').matchAll(MODULE_SPECIFIER)) {
const seen = specifier.startsWith(INTERNAL_SCOPE)
? internal
Expand Down
14 changes: 14 additions & 0 deletions scripts/lint-single-import-root.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ before(() => {
});
pkg('examples/parent', { 'src/app.ts': "import x from '@prisma/orm-mongo/runtime';" });
pkg('examples/parent/nested', { 'src/app.ts': "import y from '@internal/mongo-orm';" });
pkg('test/integration', {
'test/query.ts': "import { budgets } from '@internal/sql-runtime';",
'test/packaging/tarball.test.ts': "await import('@prisma/orm-postgres/runtime');",
});
});

after(() => {
Expand Down Expand Up @@ -66,6 +70,16 @@ describe('findMixedPackages', () => {
assert.deepEqual([...entry.published.keys()], ['@prisma/orm-postgres/runtime']);
assert.deepEqual([...entry.internal.keys()], ['@internal/sql-runtime']);
});

test('skips the packaging suites when attributing specifiers', () => {
const mixed = findMixedPackages(base, ['test']).map((entry) => entry.pkg);
assert.ok(!mixed.includes('test/integration'));
});

test('still reports the package when the same specifiers sit outside the exempt subtree', () => {
const mixed = findMixedPackages(base, ['test'], []).map((entry) => entry.pkg);
assert.ok(mixed.includes('test/integration'));
});
});

describe('main(baseDir)', () => {
Expand Down
5 changes: 5 additions & 0 deletions test/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ This package contains integration tests that verify the complete flow from contr
- `test/*.test-d.ts` - Type-only test files (for testing TypeScript types)
- `test/*.helpers.ts` - Shared test helpers for related test files
- `test/fixtures/` - Test fixtures (contract JSON, type definitions, CLI fixture apps)
- `test/packaging/` - Tarball suites that `pnpm pack` real workspace packages

### Packaging suites run sequentially

The suites under `test/packaging/` pack overlapping real package directories (both pack the Postgres facade, whose `prepack` rewrites its `skills/` tree in place), so two of them packing concurrently corrupt each other's tarballs. `vitest.config.ts` therefore isolates them in a dedicated `packaging` project with `fileParallelism: false`: Vitest runs every such project in one shared sequential group while the `integration` project keeps its normal file parallelism.

**Note**: Integration tests that depend on multiple packages (for example SQL authoring, emission, and runtime packages together) are placed here to avoid cyclic dependencies.

Expand Down
2 changes: 2 additions & 0 deletions test/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
"@internal/language-server": "workspace:8.0.0-rc.11",
"@internal/middleware-cache": "workspace:8.0.0-rc.11",
"@internal/mongo-lowering": "workspace:8.0.0-rc.11",
"@internal/publish-surface": "workspace:8.0.0-rc.11",
"@prisma/cli-engine": "0.4.0",
"@repo/test-utils": "workspace:8.0.0-rc.11",
"@repo/tsdown": "workspace:8.0.0-rc.11",
"@repo/tsconfig": "workspace:8.0.0-rc.11",
"@types/pg": "catalog:",
"commander": "^15.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@repo/tsdown/shell-testkit';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';

const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', '..');
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..');
const workspaceVersion = (
JSON.parse(readFileSync(join(repoRoot, 'package.json'), 'utf8')) as { version: string }
).version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@repo/tsdown/shell-testkit';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';

const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', '..');
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..');
const facade = '@prisma/orm-postgres';
const platform: ShellName[] = [
'@prisma/orm-framework',
Expand Down
21 changes: 21 additions & 0 deletions test/integration/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,26 @@ export default defineConfig({
// Note it cannot cover the JIT abort above: that kills the worker fork
// rather than failing a test, so there is nothing for vitest to retry.
retry: process.env['CI'] ? 2 : 0,
projects: [
{
extends: true,
test: {
name: 'integration',
include: ['test/**/*.test.ts'],
exclude: [...configDefaults.exclude, ...initJourneyExclude, 'test/packaging/**'],
},
},
{
extends: true,
test: {
name: 'packaging',
include: ['test/packaging/**/*.test.ts'],
fileParallelism: false,
typecheck: { enabled: false },
testTimeout: 300_000,
hookTimeout: 300_000,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
},
},
],
},
});
8 changes: 0 additions & 8 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@
"@prisma/orm-target-postgres#test": {
"dependsOn": ["build", "^build"],
"inputs": ["test/**", "dist/**", "vitest.config.ts"]
},
"@prisma/orm-postgres#test": {
"dependsOn": ["build", "^build"],
"inputs": ["test/**", "dist/**", "vitest.config.ts"]
},
"@prisma/orm-extension-pgvector#test": {
"dependsOn": ["build", "^build", "@prisma/orm-postgres#build"],
"inputs": ["test/**", "dist/**", "vitest.config.ts"]
}
}
}
Loading