@prisma/get-platform 6.13.0-dev.1 → 6.13.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,12 +18,13 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var test_utils_exports = {};
20
20
  __export(test_utils_exports, {
21
- jestConsoleContext: () => import_chunk_HE3NEP2U.jestConsoleContext,
22
- jestContext: () => import_chunk_HE3NEP2U.jestContext,
23
- jestStdoutContext: () => import_chunk_HE3NEP2U.jestStdoutContext,
24
- processExitContext: () => import_chunk_HE3NEP2U.processExitContext
21
+ jestConsoleContext: () => import_chunk_KH3ZZM2G.jestConsoleContext,
22
+ jestContext: () => import_chunk_KH3ZZM2G.jestContext,
23
+ jestStdoutContext: () => import_chunk_KH3ZZM2G.jestStdoutContext,
24
+ processExitContext: () => import_chunk_KH3ZZM2G.processExitContext
25
25
  });
26
26
  module.exports = __toCommonJS(test_utils_exports);
27
27
  var import_chunk_6HZWON4S = require("../chunk-6HZWON4S.js");
28
- var import_chunk_HE3NEP2U = require("../chunk-HE3NEP2U.js");
28
+ var import_chunk_KH3ZZM2G = require("../chunk-KH3ZZM2G.js");
29
+ var import_chunk_QDGOOSXR = require("../chunk-QDGOOSXR.js");
29
30
  var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
@@ -18,11 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var jestContext_exports = {};
20
20
  __export(jestContext_exports, {
21
- jestConsoleContext: () => import_chunk_HE3NEP2U.jestConsoleContext,
22
- jestContext: () => import_chunk_HE3NEP2U.jestContext,
23
- jestStdoutContext: () => import_chunk_HE3NEP2U.jestStdoutContext,
24
- processExitContext: () => import_chunk_HE3NEP2U.processExitContext
21
+ jestConsoleContext: () => import_chunk_KH3ZZM2G.jestConsoleContext,
22
+ jestContext: () => import_chunk_KH3ZZM2G.jestContext,
23
+ jestStdoutContext: () => import_chunk_KH3ZZM2G.jestStdoutContext,
24
+ processExitContext: () => import_chunk_KH3ZZM2G.processExitContext
25
25
  });
26
26
  module.exports = __toCommonJS(jestContext_exports);
27
- var import_chunk_HE3NEP2U = require("../chunk-HE3NEP2U.js");
27
+ var import_chunk_KH3ZZM2G = require("../chunk-KH3ZZM2G.js");
28
+ var import_chunk_QDGOOSXR = require("../chunk-QDGOOSXR.js");
28
29
  var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
@@ -0,0 +1,123 @@
1
+ import type { ExecaChildProcess } from 'execa';
2
+ import type { FSJetpack } from 'fs-jetpack/types';
3
+ import { type MockInstance } from 'vitest';
4
+ /**
5
+ * Base test context.
6
+ */
7
+ export type BaseContext = {
8
+ tmpDir: string;
9
+ fs: FSJetpack;
10
+ mocked: {
11
+ cwd: string;
12
+ };
13
+ /**
14
+ * Set up the temporary directory based on the contents of some fixture.
15
+ */
16
+ fixture: (name: string) => void;
17
+ /**
18
+ * Spawn the Prisma cli using the temporary directory as the CWD.
19
+ *
20
+ * @remarks
21
+ *
22
+ * For this to work the source must be built
23
+ */
24
+ cli: (...input: string[]) => ExecaChildProcess<string>;
25
+ printDir(dir: string, extensions: string[]): void;
26
+ /**
27
+ * JavaScript-friendly implementation of the `tree` command. It skips the `node_modules` directory.
28
+ * @param itemPath The path to start the tree from, defaults to the root of the temporary directory
29
+ * @param indent How much to indent each level of the tree, defaults to ''
30
+ * @returns String representation of the directory tree
31
+ */
32
+ tree: (itemPath?: string, indent?: string) => void;
33
+ };
34
+ /**
35
+ * Create test context to use in tests. Provides the following:
36
+ *
37
+ * - A temporary directory
38
+ * - an fs-jetpack instance bound to the temporary directory
39
+ * - Mocked process.cwd via Node process.chdir
40
+ * - Fixture loader for bootstrapping the temporary directory with content
41
+ */
42
+ export declare const vitestContext: {
43
+ new: (ctx?: BaseContext) => {
44
+ add<NewContext>(contextContributor: ContextContributor<BaseContext, NewContext>): {
45
+ add<NewContext_1>(contextContributor: ContextContributor<BaseContext & NewContext, NewContext_1>): {
46
+ add<NewContext_2>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1, NewContext_2>): {
47
+ add<NewContext_3>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2, NewContext_3>): {
48
+ add<NewContext_4>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3, NewContext_4>): {
49
+ add<NewContext_5>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4, NewContext_5>): {
50
+ add<NewContext_6>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5, NewContext_6>): {
51
+ add<NewContext_7>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6, NewContext_7>): {
52
+ add<NewContext_8>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7, NewContext_8>): {
53
+ add<NewContext_9>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8, NewContext_9>): {
54
+ add<NewContext_10>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8 & NewContext_9, NewContext_10>): any;
55
+ assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8 & NewContext_9;
56
+ };
57
+ assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8;
58
+ };
59
+ assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7;
60
+ };
61
+ assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6;
62
+ };
63
+ assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5;
64
+ };
65
+ assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4;
66
+ };
67
+ assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3;
68
+ };
69
+ assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2;
70
+ };
71
+ assemble(): BaseContext & NewContext & NewContext_1;
72
+ };
73
+ assemble(): BaseContext & NewContext;
74
+ };
75
+ assemble(): BaseContext;
76
+ };
77
+ };
78
+ /**
79
+ * A function that provides additional test context.
80
+ */
81
+ type ContextContributor<Context, NewContext> = (ctx: Context) => Context & NewContext;
82
+ /**
83
+ * Test context contributor. Mocks console.error with a Vitest spy before each test.
84
+ */
85
+ type ConsoleContext = {
86
+ mocked: {
87
+ 'console.error': MockInstance<typeof console.error>;
88
+ 'console.log': MockInstance<typeof console.log>;
89
+ 'console.info': MockInstance<typeof console.info>;
90
+ 'console.warn': MockInstance<typeof console.warn>;
91
+ };
92
+ };
93
+ export declare const vitestConsoleContext: <Ctx extends BaseContext>() => (c: Ctx) => Ctx & ConsoleContext;
94
+ /**
95
+ * Test context contributor. Mocks process.std(out|err).write with a Vitest spy before each test.
96
+ */
97
+ type ProcessContext = {
98
+ mocked: {
99
+ 'process.stderr.write': MockInstance<typeof process.stderr.write>;
100
+ 'process.stdout.write': MockInstance<typeof process.stdout.write>;
101
+ };
102
+ normalizedCapturedStdout: () => string;
103
+ normalizedCapturedStderr: () => string;
104
+ clearCapturedStdout: () => void;
105
+ clearCapturedStderr: () => void;
106
+ };
107
+ type NormalizationRule = [RegExp | string, string];
108
+ export type ProcessContextSettings = {
109
+ normalizationRules: NormalizationRule[];
110
+ };
111
+ export declare const vitestStdoutContext: <Ctx extends BaseContext>({ normalizationRules }?: ProcessContextSettings) => (c: Ctx) => Ctx & ProcessContext;
112
+ /**
113
+ * Test context contributor. Mocks process.exit with a spy and records the exit code.
114
+ */
115
+ type ProcessExitContext = {
116
+ mocked: {
117
+ 'process.exit': MockInstance<typeof process.exit>;
118
+ };
119
+ recordedExitCode: () => number;
120
+ };
121
+ export declare const vitestProcessExitContext: <C extends BaseContext>() => (c: C) => C & ProcessExitContext;
122
+ export declare const processExitContext: <C extends BaseContext>() => (c: C) => C & ProcessExitContext;
123
+ export {};