test: Make oclif commands testable (#3571)

*  Add `@oclif/core`

* 📦 Update `package-lock.json`

* 📘 Export `Logger` for use as type

*  Create `BaseCommand`

* 🐛 Prevent DB re-init

* ♻️ Refactor `reset` command

* 🧪 Fix `reset` test

* 👕 Add lint exception

Co-authored-by: Jan Oberhauser <janober@users.noreply.github.com>
This commit is contained in:
Iván Ovejero
2022-06-26 06:03:46 +02:00
committed by GitHub
parent 848fcfde5d
commit 7879239e03
7 changed files with 396 additions and 91 deletions

View File

@@ -45,6 +45,8 @@ export function linkRepository<Entity>(entityClass: EntityTarget<Entity>): Repos
export async function init(
testConnectionOptions?: ConnectionOptions,
): Promise<IDatabaseCollections> {
if (isInitialized) return collections;
const dbType = (await GenericHelpers.getConfigValue('database.type')) as DatabaseType;
const n8nFolder = UserSettings.getUserN8nFolderPath();