LinusU / LinusU/node-pg-tmp

Tear down databases manually feature request

オープン
#2 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Shell
スター
1
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

I think a feature that can be added to this library would be to tear down databases manually.

A use case for this would be to do this in the "tear-down" section in testing frameworks. For example, in vitest a possible implementation of this would be:

import {describe, test, beforeAll} from "vitest";
import createDb from "pg-tmp";

describe("Database test", () => {
    beforeAll(async () => {
        const { teardownDb } = await createDb();
        // return cleanup function
        return async () => {
            await teardownDb();
        };
    });
    
    test("specific database tests", () => {
        // tests with the database.
    });
});

This should be easy to implement using the "stop" command already implemented in pg_tmp.sh.

I'd be up to make a PR myself, but I figured I'd get permission first & so forth.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、pg_tmp.sh にある既存の stop コマンドと、それを呼び出す Node.js API を読みます。Vitest の例を想定される使用方法として、手動 teardown 関数を createDb からどのように公開するかを定義します。テストのクリーンアップ中に呼び出し側が teardownDb を呼び出せ、既存のデータベース停止動作が再利用されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
node.js, postgresql, shell
領域
api, databases, testing-qa
issue の種類
機能追加
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。