Skip to content

Commit

Permalink
mock getConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed May 6, 2024
1 parent 07ef1af commit 33e58a9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"test": "vitest",
"prepare": "npm run build",
"build": "rm -rf ./dist && tsc",
"build": "rm -rf ./dist && tsc -p tsconfig.build.json",
"lint": "eslint .",
"format": "prettier --write .",
"checkTs": "tsc --noEmit",
Expand Down
6 changes: 3 additions & 3 deletions src/factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, vi } from "vitest";
import { Factory } from "./factory";
import { Row } from "./row";
import client from "./client";
import { Factory } from "./factory.js";
import { Row } from "./row.js";
import client from "./client.js";

const factory = new Factory();

Expand Down
15 changes: 15 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"noEmit": false
},
"exclude": [
"./dist/**/*",
"**/*.spec.ts",
"vitest.config.ts",
"vitest.setup.ts",
".baserowrc",
"__generated__"
]
}
8 changes: 0 additions & 8 deletions tsconfig.dev.json

This file was deleted.

17 changes: 6 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
{

"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"declaration": true,
"outDir": "./dist",
"declarationDir": "./dist",
"rootDir": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"types": ["node"]
"types": ["node"],
"noEmit": true,
"outDir": null
},
"exclude": [
"./dist/**/*",
"**/*.spec.ts",
"vitest.config.ts",
"vitest.setup.ts",
".baserowrc",
"__generated__"
]
}
"exclude": ["./dist/**/*", ".baserowrc"]
}
9 changes: 9 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import { vi } from "vitest";

vi.mock("./src/client");
vi.mock("./src/getConfig", () => ({
getConfig: vi.fn(() => ({
url: "the_baserow_url",
tables: {},
databaseToken: "the_database_token",
outDir: "the_out_dir",
config: "the_config",
})),
}));

0 comments on commit 33e58a9

Please sign in to comment.