// First load const agentsFile1 = await loadAgentsFile(workspaceDir);
expectAgentsContent(agentsFile1, content1);
// Modify the file
await writeWorkspaceFile({
dir: workspaceDir,
name: DEFAULT_AGENTS_FILENAME,
content: content2,
}); // Some filesystems have coarse mtime precision; bump it explicitly. const bumpedTime = new Date(Date.now() + 1_000);
await fs.utimes(filePath, bumpedTime, bumpedTime);
// Second load should detect the change and return new content const agentsFile2 = await loadAgentsFile(workspaceDir);
expectAgentsContent(agentsFile2, content2);
});
it("invalidates cache when inode changes with same mtime", async () => { if (process.platform === "win32") { return;
} const content1 = "# old-content"; const content2 = "# new-content"; const filePath = path.join(workspaceDir, DEFAULT_AGENTS_FILENAME); const tempPath = path.join(workspaceDir, ".AGENTS.tmp");
// Multiple concurrent loads should all succeed const promises = Array.from({ length: 10 }, () => loadWorkspaceBootstrapFiles(workspaceDir));
const results = await Promise.all(promises);
// All results should be identical for (const result of results) { const agentsFile = result.find((f) => f.name === DEFAULT_AGENTS_FILENAME);
expectAgentsContent(agentsFile, content);
}
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.