Home / File/ exports.test.ts — drizzle-orm Source File

exports.test.ts — drizzle-orm Source File

Architecture documentation for exports.test.ts, a typescript file in the drizzle-orm codebase. 3 imports, 0 dependents.

File typescript 3 imports

Entity Profile

Dependency Diagram

graph LR
  5045a375_e254_1cb4_ab42_c949e8aae1ea["exports.test.ts"]
  de3de3cc_a6ee_d613_6500_5a1907908a06["glob"]
  5045a375_e254_1cb4_ab42_c949e8aae1ea --> de3de3cc_a6ee_d613_6500_5a1907908a06
  4839ed08_ff17_6b52_67a0_ddf72711b6b1["ts-morph"]
  5045a375_e254_1cb4_ab42_c949e8aae1ea --> 4839ed08_ff17_6b52_67a0_ddf72711b6b1
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  5045a375_e254_1cb4_ab42_c949e8aae1ea --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 5045a375_e254_1cb4_ab42_c949e8aae1ea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { globSync } from 'glob';
import { Project } from 'ts-morph';
import { assert, test } from 'vitest';

const project = new Project({ tsConfigFilePath: './tsconfig.build.json' });

const filesList = globSync('src/**/*.ts');

for (const filePath of filesList) {
	test(filePath, () => {
		const conflicts: { name: string; files: [string, string] }[] = [];
		const exports = new Map<string, string>();

		const sourceFile = project.getSourceFileOrThrow(filePath);

		for (const decl of sourceFile.getExportDeclarations()) {
			const moduleSpecifier = decl.getModuleSpecifierValue();
			if (!moduleSpecifier || !moduleSpecifier.endsWith('.ts')) {
				continue;
			}
			const exportSourcePath = decl.getModuleSpecifierSourceFile()!.getFilePath();
			const exported = project.getSourceFileOrThrow(exportSourcePath);

			for (const symbol of exported.getExportSymbols()) {
				const name = symbol.getName();
				const from = exports.get(name);
				if (from) {
					conflicts.push({
						name,
						files: [from, moduleSpecifier],
					});
				} else {
					exports.set(name, moduleSpecifier);
				}
			}
		}

		if (conflicts.length) {
			assert.fail(
				conflicts.map(({ name, files }) => `\n- ${name} is exported from ${files.join(' and ')}`).join('\n'),
			);
		}
	});
}

Dependencies

  • glob
  • ts-morph
  • vitest

Frequently Asked Questions

What does exports.test.ts do?
exports.test.ts is a source file in the drizzle-orm codebase, written in typescript.
What does exports.test.ts depend on?
exports.test.ts imports 3 module(s): glob, ts-morph, vitest.
Where is exports.test.ts in the architecture?
exports.test.ts is located at drizzle-orm/tests/exports.test.ts (directory: drizzle-orm/tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free