Skip to content

Fix SQL driver TCK tests: use sqlite3 instead of better-sqlite3#308

Merged
hotlong merged 2 commits into
copilot/fix-action-run-issue-againfrom
copilot/fix-action-step-error
Feb 2, 2026
Merged

Fix SQL driver TCK tests: use sqlite3 instead of better-sqlite3#308
hotlong merged 2 commits into
copilot/fix-action-run-issue-againfrom
copilot/fix-action-step-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 2, 2026

The SQL driver TCK test suite was failing with "Cannot find module 'better-sqlite3'" because it referenced an uninstalled dependency. All other SQL driver tests use sqlite3 (already in devDependencies), but tck.test.ts was an outlier.

Changes

  • Database client: Changed from better-sqlite3 to sqlite3 for consistency with other test files
  • Table initialization: Added driver.init() call in beforeEach hook to create the tck_test table that TCK tests expect
  • Connection cleanup: Added driver['knex'].destroy() in afterEach to prevent connection leaks

Impact

Before: 34/34 TCK tests failed (module not found)
After: 26/34 TCK tests pass

The remaining 8 failures are pre-existing driver implementation gaps (findOne returns undefined vs null, bulk operation metadata, etc.) unrelated to this fix.

runDriverTCK(
    () => {
        driver = new SqlDriver({
-           client: 'better-sqlite3',
+           client: 'sqlite3',
            connection: { filename: ':memory:' },
            useNullAsDefault: true
        });
        return driver;
    },
    {
        hooks: {
            beforeEach: async () => {
+               await driver.init([{ name: 'tck_test', fields: {...} }]);
            },
            afterEach: async () => {
+               if (driver?.['knex']) await driver['knex'].destroy();
            }
        }
    }
);
Original prompt

引用: https://github.com/objectstack-ai/objectql/actions/runs/21578401149/job/62170894603#step:9:1


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectql Ready Ready Preview, Comment Feb 2, 2026 5:56am

Request Review

…able initialization

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix action step error in GitHub workflows Fix SQL driver TCK tests: use sqlite3 instead of better-sqlite3 Feb 2, 2026
Copilot AI requested a review from hotlong February 2, 2026 05:55
@hotlong hotlong marked this pull request as ready for review February 2, 2026 05:57
Copilot AI review requested due to automatic review settings February 2, 2026 05:57
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 2, 2026

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the SQL driver TCK test suite which was completely failing due to a missing dependency reference. The fix changes the SQLite client from better-sqlite3 (not installed) to sqlite3 (already in devDependencies), adds proper table initialization via driver.init(), and ensures clean connection teardown.

Changes:

  • Changed SQLite client from better-sqlite3 to sqlite3 for consistency with other test files and available dependencies
  • Replaced manual table-dropping logic with driver.init() call to create the tck_test table with proper schema
  • Added connection cleanup in afterEach to prevent resource leaks

@hotlong hotlong merged commit e8cb7e8 into copilot/fix-action-run-issue-again Feb 2, 2026
2 checks passed
@hotlong hotlong deleted the copilot/fix-action-step-error branch February 2, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants