Skip to content

Test setup for prebuild files #183

@cloverich

Description

@cloverich
  • Add a test setup for prebuild; support using SQLite in tests; explore node native testing lib vs mocha
  • Add tests for documents search, save, etc (and tags)
  • Integrate it into the testing pipeline

Current test setup is very naive -- it just compiles the full test+dependencies into test files with esbuild, then runs them:

const testFiles = findTestFiles("src");

testFiles.forEach(async (file) => {
  await esbuild.build({
    entryPoints: [file],
    // NOTE: If changing filename, also update findTestFiles glob above to avoid
    // bundled test files being used as source!
    outfile: file.replace(".test.ts", ".test.bundle.js"),
    bundle: true,
    platform: "node",
    external: ["mocha"],
    plugins: [],
  });
});

It is surprisingly fast though -- as esbuild tends to be. I need to extend this setup for prebuild which works in node-land. Should support talking to sqlite so the tests can be real, and specifically test the documents module which creates / finds / saves notes, the core API of the app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions