MCPcopy
hub / github.com/dendronhq/dendron / runEngineTestV5

Function runEngineTestV5

packages/engine-test-utils/src/engine.ts:248–350  ·  view source on GitHub ↗
(
  func: RunEngineTestFunctionV5,
  opts: RunEngineTestV5Opts
)

Source from the content-addressed store, hash-verified

246 * @returns
247 */
248export async function runEngineTestV5(
249 func: RunEngineTestFunctionV5,
250 opts: RunEngineTestV5Opts
251): Promise<any> {
252 const {
253 preSetupHook,
254 extra,
255 vaults: vaultsInit,
256 createEngine,
257 initGit,
258 workspaces,
259 addVSWorkspace,
260 git,
261 } = _.defaults(opts, {
262 preSetupHook: async () => {},
263 postSetupHook: async () => {},
264 createEngine: createEngineV3FromEngine,
265 extra: {},
266 // third vault has diff name
267 vaults: [
268 { fsPath: "vault1" },
269 { fsPath: "vault2" },
270 { fsPath: "vault3", name: "vaultThree" },
271 ],
272 addVSWorkspace: false,
273 });
274
275 let homeDirStub: sinon.SinonStub | undefined;
276 let server: Server | undefined;
277
278 try {
279 // --- begin ws setup
280 // make sure tests don't overwrite local homedir contents
281 homeDirStub = TestEngineUtils.mockHomeDir();
282 const { wsRoot, vaults } = await setupWS({
283 vaults: vaultsInit,
284 workspaces,
285 wsRoot: opts.wsRoot,
286 modConfigCb: opts.modConfigCb,
287 });
288 if ((opts.initHooks, vaults)) {
289 fs.ensureDirSync(path.join(wsRoot, CONSTANTS.DENDRON_HOOKS_BASE));
290 }
291 if (addVSWorkspace) {
292 fs.writeJSONSync(
293 path.join(wsRoot, CONSTANTS.DENDRON_WS_NAME),
294 {
295 folders: vaults.map((ent) => ({
296 path: ent.fsPath,
297 name: ent.name,
298 })) as WorkspaceFolderRaw[],
299 settings: {},
300 extensions: {},
301 } as WorkspaceSettings,
302 { spaces: 4 }
303 );
304 }
305

Callers 15

findAndFindMetadataTestFunction · 0.90
queryMetadataTestFunction · 0.90
retrieveSameNoteTestFunction · 0.90
stubNoteTestFunction · 0.90
getDeletedNoteTestFunction · 0.90
updateNoteTestFunction · 0.90
writeSameFnameTestFunction · 0.90
writeMismatchKeyTestFunction · 0.90
retrieveMetadataOnlyTestFunction · 0.90
bulkWriteMetadataTestFunction · 0.90
deleteRootNoteTestFunction · 0.90

Calls 14

createEngineFunction · 0.90
getDurationMillisecondsFunction · 0.90
vault2PathFunction · 0.90
runJestHarnessV2Function · 0.90
setupWSFunction · 0.85
mockHomeDirMethod · 0.80
allMethod · 0.80
createRepoWithReadmeMethod · 0.80
closeMethod · 0.80
initMethod · 0.65
preSetupHookFunction · 0.50

Tested by 13

_setupTestFactoryCommonFunction · 0.72
setupTemplateTestFunction · 0.72
runAllTestsFunction · 0.72
setupEngineForMultiTagFunction · 0.72
setupEngineForSingleTagFunction · 0.72
runAllTestsFunction · 0.72
runAllTestsFunction · 0.72
runAllTestsFunction · 0.72
runAllTestsFunction · 0.72
runAllTestsFunction · 0.72
runAllTestsFunction · 0.72
runTestCasesFunction · 0.72