Cook

Stubbing dendron.yml in a test

test("backlink to home page", async () => {
  await runEngineTestV5(
    async ({ engine, vaults }) => {
      ...
    },
    {
      expect,
      preSetupHook: async (opts) => {
        ...
        TestConfigUtils.withConfig(
          (config) => {
            config.site = {
              siteHierarchies: ["alpha"],
              siteNotesDir: "docs",
              siteUrl: "https://foo.com",
              siteRootDir,
            };
            return config;
          },
          {
            wsRoot,
          }
        );
      },
    }
  );
});

Running a single test

While your current working directory is the mono repo you can run a single jest test as follows:

jest /usr/local/workplace/dendron/packages/engine-test-utils/src/__tests__/common-all/nodev2.spec.ts

If you are testing non UI tests you can speed up the test by setting --testEnvironment=node such as

jest --testEnvironment=node /usr/local/workplace/dendron/packages/engine-test-utils/src/__tests__/common-all/nodev2.spec.ts

Backlinks