(url, async () => {
35 | return HttpResponse.json(mockResponse);
36 | });
37 | };
38 |
--------------------------------------------------------------------------------
/tests/utils/setup.ts:
--------------------------------------------------------------------------------
1 | import { setupServer } from "msw/node";
2 |
3 | import { BERRY_HANDLERS } from "../berry/mocks/handlers";
4 |
5 | const HANDLERS = [...BERRY_HANDLERS];
6 |
7 | const server = setupServer(...HANDLERS);
8 |
9 | // Events
10 | server.events.on("unhandledException", ({ request: { method, url }, error }) => {
11 | console.log(`${method} ${url} errored! See details below.`);
12 | console.error(error);
13 | });
14 |
15 | // Vitest hooks
16 | beforeAll(() => server.listen({ onUnhandledRequest: "bypass" }));
17 | afterAll(() => server.close());
18 | afterEach(() => server.resetHandlers());
19 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | // Specifies the ECMAScript target version (latest features).
4 | "target": "ESNext",
5 | // An array of library files to include in the compilation.
6 | "lib": ["ESNext"],
7 | // Vitest globals
8 | "types": ["vitest/globals"],
9 | // Allows JavaScript files to be included in the project.
10 | "allowJs": true,
11 | // Skips type checking of declaration files.
12 | "skipLibCheck": true,
13 | // Enables all strict type-checking options.
14 | "strict": true,
15 | // Prevents TypeScript from emitting output files (e.g., JavaScript files).
16 | "noEmit": true,
17 | // Adds `undefined` to the type of an indexing operation for possibly undefined objects.
18 | "noUncheckedIndexedAccess": true,
19 | // Ensures that the casing of referenced file names matches the casing of the actual file.
20 | "forceConsistentCasingInFileNames": true,
21 | // Generates corresponding `.d.ts` files for TypeScript files.
22 | "declaration": false,
23 | // Allows default imports from modules with no default export.
24 | "esModuleInterop": true,
25 | // Specifies the module code generation.
26 | "module": "ESNext",
27 | // Specifies how modules are resolved.
28 | "moduleResolution": "Bundler",
29 | // Enables experimental support for decorators.
30 | "experimentalDecorators": true,
31 | // Enables the metadata reflection for decorators.
32 | "emitDecoratorMetadata": true,
33 | // Allows importing JSON files as modules.
34 | "resolveJsonModule": true,
35 | // Transforms each file as a separate module, which can help catch more errors.
36 | "isolatedModules": true,
37 | // Specifies the base directory for resolving non-relative module names.
38 | "baseUrl": ".",
39 | // Defines path mappings for module names.
40 | "paths": {
41 | "@clients": ["src/clients/index.ts"],
42 | "@config/*": ["src/config/*"],
43 | "@constants": ["src/constants/index.ts"],
44 | "@models": ["src/models/index.ts"],
45 | "@package": ["package.json"]
46 | }
47 | },
48 | // Specifies the files to include in the compilation.
49 | "include": ["src/**/*.ts", "tests/**/*.ts"],
50 | // Specifies files to be excluded from the compilation.
51 | "exclude": ["node_modules"]
52 | }
53 |
--------------------------------------------------------------------------------
/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import isCI from "is-ci";
2 | import { defineConfig } from "tsup";
3 | import { author, description, license, peerDependencies, version } from "./package.json";
4 |
5 | // Extract peerDependencies from package.json
6 | const EXTERNAL_DEPS = Object.keys(peerDependencies as Record