Home / File/ cli-export.test.ts — drizzle-orm Source File

cli-export.test.ts — drizzle-orm Source File

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

Entity Profile

Dependency Diagram

graph LR
  96317b86_8909_eb1b_2896_c26de7ff4a81["cli-export.test.ts"]
  5bf76609_579e_d312_b33b_ab5b8b683111["schema.ts"]
  96317b86_8909_eb1b_2896_c26de7ff4a81 --> 5bf76609_579e_d312_b33b_ab5b8b683111
  1c7f9ac7_5c40_4d3d_8edf_fcb550a29ebe["brocli"]
  96317b86_8909_eb1b_2896_c26de7ff4a81 --> 1c7f9ac7_5c40_4d3d_8edf_fcb550a29ebe
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  96317b86_8909_eb1b_2896_c26de7ff4a81 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 96317b86_8909_eb1b_2896_c26de7ff4a81 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { test as brotest } from '@drizzle-team/brocli';
import { assert, expect, test } from 'vitest';
import { exportRaw } from '../src/cli/schema';

// good:
// #1 drizzle-kit export --dialect=postgresql --schema=schema.ts
// #3 drizzle-kit export
// #3 drizzle-kit export --config=drizzle1.config.ts

// errors:
// #1 drizzle-kit export --schema=src/schema.ts
// #2 drizzle-kit export --dialect=postgresql
// #3 drizzle-kit export --dialect=postgresql2
// #4 drizzle-kit export --config=drizzle.config.ts --schema=schema.ts
// #5 drizzle-kit export --config=drizzle.config.ts --dialect=postgresql

test('export #1', async (t) => {
	const res = await brotest(
		exportRaw,
		'--dialect=postgresql --schema=schema.ts',
	);

	if (res.type !== 'handler') assert.fail(res.type, 'handler');

	expect(res.options).toStrictEqual({
		dialect: 'postgresql',
		schema: 'schema.ts',
		sql: true,
	});
});

test('export #2', async (t) => {
	const res = await brotest(exportRaw, '');

	if (res.type !== 'handler') assert.fail(res.type, 'handler');
	expect(res.options).toStrictEqual({
		dialect: 'postgresql',
		schema: './schema.ts',
		sql: true,
	});
});

// custom config path
test('export #3', async (t) => {
	const res = await brotest(exportRaw, '--config=expo.config.ts');
	assert.equal(res.type, 'handler');
	if (res.type !== 'handler') assert.fail(res.type, 'handler');
	expect(res.options).toStrictEqual({
		dialect: 'sqlite',
		schema: './schema.ts',
		sql: true,
	});
});

// --- errors ---
test('err #1', async (t) => {
	const res = await brotest(exportRaw, '--schema=src/schema.ts');
	assert.equal(res.type, 'error');
});

test('err #2', async (t) => {
	const res = await brotest(exportRaw, '--dialect=postgresql');
	assert.equal(res.type, 'error');
});

test('err #3', async (t) => {
	const res = await brotest(exportRaw, '--dialect=postgresql2');
	assert.equal(res.type, 'error');
});

test('err #4', async (t) => {
	const res = await brotest(exportRaw, '--config=drizzle.config.ts --schema=schema.ts');
	assert.equal(res.type, 'error');
});

test('err #5', async (t) => {
	const res = await brotest(exportRaw, '--config=drizzle.config.ts --dialect=postgresql');
	assert.equal(res.type, 'error');
});

Domain

Dependencies

Frequently Asked Questions

What does cli-export.test.ts do?
cli-export.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain.
What does cli-export.test.ts depend on?
cli-export.test.ts imports 3 module(s): brocli, schema.ts, vitest.
Where is cli-export.test.ts in the architecture?
cli-export.test.ts is located at drizzle-kit/tests/cli-export.test.ts (domain: DrizzleORM, directory: drizzle-kit/tests).

Analyze Your Own Codebase

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

Try Supermodel Free