mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
fix: stop the dev runner rebuilding plugins when windows reports file reads as changes
This commit is contained in:
1 parent
2d71e886ac
commit
fb904554e8
8 files changed
+57
-407
No files matched your search
@@ -7,6 +7,7 @@ import {
|
||||
createSerialQueue,
|
||||
dataDirFor,
|
||||
findBuildablePlugins,
|
||||
isPluginEdit,
|
||||
isPluginSourceChange,
|
||||
needsDocker,
|
||||
parseDevArgs,
|
||||
@@ -46,6 +47,34 @@ describe("isPluginSourceChange", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("isPluginEdit", () => {
|
||||
function repo() {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "termix-edit-"));
|
||||
cleanups.push(() => fs.rmSync(dir, { recursive: true, force: true }));
|
||||
fs.mkdirSync(path.join(dir, "src", "frontend"), { recursive: true });
|
||||
fs.writeFileSync(path.join(dir, "src", "frontend", "index.ts"), "");
|
||||
return dir;
|
||||
}
|
||||
|
||||
it("ignores a folder being read", () => {
|
||||
expect(isPluginEdit(repo(), "src/frontend", () => true)).toBe(false);
|
||||
});
|
||||
|
||||
it("rebuilds an edited file only while the build is out of date", () => {
|
||||
const dir = repo();
|
||||
expect(isPluginEdit(dir, "src/frontend/index.ts", () => true)).toBe(true);
|
||||
expect(isPluginEdit(dir, "src/frontend/index.ts", () => false)).toBe(false);
|
||||
});
|
||||
|
||||
it("rebuilds after a source file is deleted", () => {
|
||||
expect(isPluginEdit(repo(), "src/gone.ts", () => false)).toBe(true);
|
||||
});
|
||||
|
||||
it("skips paths that do not feed the build", () => {
|
||||
expect(isPluginEdit(repo(), "dist/index.js", () => true)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("findBuildablePlugins", () => {
|
||||
it("lists repos with a manifest and installed dependencies", () => {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "termix-dev-"));
|
||||
|
||||
Reference in new issue
Block a user