balena-io / pinejs

Generate rest APIs from natural language models
Apache License 2.0
63 stars 11 forks source link

Allow changing pine's DEBUG mode on runtime when env.DEPLOYMENT=TEST #825

Closed thgreasi closed 1 month ago

thgreasi commented 1 month ago

This allows consumers to enable debug mode only for a single test case, reducing the amount of noise in their logs.

This allows consumers to for example print the SQL run during a specific test case, by doing

it('tests something', function () {
    const { env: { TEST_MOCK_ONLY } } = await import('@balena/pinejs');
    TEST_MOCK_ONLY.DEBUG = true;
    // ... tests here
    TEST_MOCK_ONLY.DEBUG = false;
});

Change-type: minor