@simplysm/core-node 13.0.74 → 13.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/core-node",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.76",
|
|
4
4
|
"description": "Simplysm package - Core module (node)",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"glob": "^13.0.6",
|
|
25
25
|
"minimatch": "^10.2.4",
|
|
26
26
|
"tsx": "^4.21.0",
|
|
27
|
-
"@simplysm/core-common": "13.0.
|
|
27
|
+
"@simplysm/core-common": "13.0.76"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -28,22 +28,6 @@ describe("SdFsWatcher", () => {
|
|
|
28
28
|
expect(watcher).toBeDefined();
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
it("starts watching files with options", async () => {
|
|
32
|
-
watcher = await FsWatcher.watch([path.join(testDir, "**/*")], {
|
|
33
|
-
ignoreInitial: false,
|
|
34
|
-
});
|
|
35
|
-
expect(watcher).toBeDefined();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("logs errors when error events occur", async () => {
|
|
39
|
-
// chokidar starts watching non-existent paths without issue
|
|
40
|
-
// Error events only occur on actual filesystem errors
|
|
41
|
-
const nonExistentPath = path.join(testDir, "non-existent-dir-" + Date.now());
|
|
42
|
-
watcher = await FsWatcher.watch([nonExistentPath]);
|
|
43
|
-
|
|
44
|
-
// Error handler is registered so it doesn't crash even if an error occurs
|
|
45
|
-
expect(watcher).toBeDefined();
|
|
46
|
-
});
|
|
47
31
|
});
|
|
48
32
|
|
|
49
33
|
//#endregion
|
|
@@ -75,43 +59,6 @@ describe("SdFsWatcher", () => {
|
|
|
75
59
|
|
|
76
60
|
expect(result).toBe(watcher);
|
|
77
61
|
});
|
|
78
|
-
|
|
79
|
-
it("can specify delay option with various values", async () => {
|
|
80
|
-
watcher = await FsWatcher.watch([path.join(testDir, "**/*")]);
|
|
81
|
-
|
|
82
|
-
const fn = vi.fn();
|
|
83
|
-
// delay option should be specifiable with various values
|
|
84
|
-
expect(() => watcher!.onChange({ delay: 0 }, fn)).not.toThrow();
|
|
85
|
-
expect(() => watcher!.onChange({ delay: 500 }, fn)).not.toThrow();
|
|
86
|
-
expect(() => watcher!.onChange({ delay: 1000 }, fn)).not.toThrow();
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
//#endregion
|
|
91
|
-
|
|
92
|
-
//#region Types
|
|
93
|
-
|
|
94
|
-
describe("Types", () => {
|
|
95
|
-
it("verifies FsWatcherEvent type definition", () => {
|
|
96
|
-
// Verify that event types are correctly defined
|
|
97
|
-
const validEvents = ["add", "addDir", "change", "unlink", "unlinkDir"];
|
|
98
|
-
expect(validEvents).toContain("add");
|
|
99
|
-
expect(validEvents).toContain("addDir");
|
|
100
|
-
expect(validEvents).toContain("change");
|
|
101
|
-
expect(validEvents).toContain("unlink");
|
|
102
|
-
expect(validEvents).toContain("unlinkDir");
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("verifies FsWatcherChangeInfo structure", () => {
|
|
106
|
-
// Type check to verify interface structure
|
|
107
|
-
const mockChangeInfo = {
|
|
108
|
-
event: "add" as const,
|
|
109
|
-
path: "/test/path",
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
expect(mockChangeInfo.event).toBe("add");
|
|
113
|
-
expect(mockChangeInfo.path).toBe("/test/path");
|
|
114
|
-
});
|
|
115
62
|
});
|
|
116
63
|
|
|
117
64
|
//#endregion
|
package/tests/utils/fs.spec.ts
CHANGED
|
@@ -61,9 +61,6 @@ describe("fs functions", () => {
|
|
|
61
61
|
expect(fsExistsSync(filePath)).toBe(false);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
it("returns true for existing directory", () => {
|
|
65
|
-
expect(fsExistsSync(testDir)).toBe(true);
|
|
66
|
-
});
|
|
67
64
|
});
|
|
68
65
|
|
|
69
66
|
describe("fsExists", () => {
|
|
@@ -79,9 +76,6 @@ describe("fs functions", () => {
|
|
|
79
76
|
expect(await fsExists(filePath)).toBe(false);
|
|
80
77
|
});
|
|
81
78
|
|
|
82
|
-
it("returns true for existing directory", async () => {
|
|
83
|
-
expect(await fsExists(testDir)).toBe(true);
|
|
84
|
-
});
|
|
85
79
|
});
|
|
86
80
|
|
|
87
81
|
//#endregion
|
|
@@ -172,14 +166,6 @@ describe("fs functions", () => {
|
|
|
172
166
|
expect(content).toBe("Hello, World!");
|
|
173
167
|
});
|
|
174
168
|
|
|
175
|
-
it("reads Korean content", () => {
|
|
176
|
-
const filePath = path.join(testDir, "korean.txt");
|
|
177
|
-
fs.writeFileSync(filePath, "안녕하세요");
|
|
178
|
-
|
|
179
|
-
const content = fsReadSync(filePath);
|
|
180
|
-
|
|
181
|
-
expect(content).toBe("안녕하세요");
|
|
182
|
-
});
|
|
183
169
|
});
|
|
184
170
|
|
|
185
171
|
describe("fsRead", () => {
|
|
@@ -419,20 +405,6 @@ describe("fs functions", () => {
|
|
|
419
405
|
expect(fs.readFileSync(target, "utf-8")).toBe("async source content");
|
|
420
406
|
});
|
|
421
407
|
|
|
422
|
-
it("copies directory asynchronously (recursive)", async () => {
|
|
423
|
-
const sourceDir = path.join(testDir, "asyncSourceDir");
|
|
424
|
-
const targetDir = path.join(testDir, "asyncTargetDir");
|
|
425
|
-
fs.mkdirSync(sourceDir);
|
|
426
|
-
fs.writeFileSync(path.join(sourceDir, "file.txt"), "content");
|
|
427
|
-
fs.mkdirSync(path.join(sourceDir, "sub"));
|
|
428
|
-
fs.writeFileSync(path.join(sourceDir, "sub/nested.txt"), "nested");
|
|
429
|
-
|
|
430
|
-
await fsCopy(sourceDir, targetDir);
|
|
431
|
-
|
|
432
|
-
expect(fs.existsSync(path.join(targetDir, "file.txt"))).toBe(true);
|
|
433
|
-
expect(fs.existsSync(path.join(targetDir, "sub/nested.txt"))).toBe(true);
|
|
434
|
-
});
|
|
435
|
-
|
|
436
408
|
it("selectively copies with filter option asynchronously", async () => {
|
|
437
409
|
const sourceDir = path.join(testDir, "asyncFilterSource");
|
|
438
410
|
const targetDir = path.join(testDir, "asyncFilterTarget");
|
|
@@ -492,10 +464,6 @@ describe("fs functions", () => {
|
|
|
492
464
|
expect(result.size).toBeGreaterThan(0);
|
|
493
465
|
});
|
|
494
466
|
|
|
495
|
-
it("gets directory information", () => {
|
|
496
|
-
const result = fsStatSync(testDir);
|
|
497
|
-
expect(result.isDirectory()).toBe(true);
|
|
498
|
-
});
|
|
499
467
|
});
|
|
500
468
|
|
|
501
469
|
describe("fsStat", () => {
|
|
@@ -511,15 +479,6 @@ describe("fs functions", () => {
|
|
|
511
479
|
});
|
|
512
480
|
|
|
513
481
|
describe("fsLstatSync", () => {
|
|
514
|
-
it("gets regular file information", () => {
|
|
515
|
-
const filePath = path.join(testDir, "lstatfile.txt");
|
|
516
|
-
fs.writeFileSync(filePath, "content");
|
|
517
|
-
|
|
518
|
-
const stat = fsLstatSync(filePath);
|
|
519
|
-
|
|
520
|
-
expect(stat.isFile()).toBe(true);
|
|
521
|
-
});
|
|
522
|
-
|
|
523
482
|
it("returns symbolic link information for symbolic links", () => {
|
|
524
483
|
const targetPath = path.join(testDir, "target.txt");
|
|
525
484
|
const linkPath = path.join(testDir, "link.txt");
|
|
@@ -540,15 +499,6 @@ describe("fs functions", () => {
|
|
|
540
499
|
});
|
|
541
500
|
|
|
542
501
|
describe("fsLstat", () => {
|
|
543
|
-
it("gets file information asynchronously", async () => {
|
|
544
|
-
const filePath = path.join(testDir, "asynclstatfile.txt");
|
|
545
|
-
fs.writeFileSync(filePath, "async content");
|
|
546
|
-
|
|
547
|
-
const stat = await fsLstat(filePath);
|
|
548
|
-
|
|
549
|
-
expect(stat.isFile()).toBe(true);
|
|
550
|
-
});
|
|
551
|
-
|
|
552
502
|
it("returns symbolic link information asynchronously", async () => {
|
|
553
503
|
const targetPath = path.join(testDir, "async-target.txt");
|
|
554
504
|
const linkPath = path.join(testDir, "async-link.txt");
|
package/tests/utils/path.spec.ts
CHANGED
|
@@ -24,15 +24,6 @@ describe("path functions", () => {
|
|
|
24
24
|
expect(result).toBe("C:/Users/test/file.txt");
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
it("keeps already POSIX-style path as is", () => {
|
|
28
|
-
const result = pathPosix("/usr/local/bin");
|
|
29
|
-
expect(result).toBe("/usr/local/bin");
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("handles mixed path separators", () => {
|
|
33
|
-
const result = pathPosix("C:/Users\\test/file.txt");
|
|
34
|
-
expect(result).toBe("C:/Users/test/file.txt");
|
|
35
|
-
});
|
|
36
27
|
});
|
|
37
28
|
|
|
38
29
|
//#endregion
|
|
@@ -51,10 +42,6 @@ describe("path functions", () => {
|
|
|
51
42
|
expect(result).toBe(path.resolve(basePath, "sub", "file.txt"));
|
|
52
43
|
});
|
|
53
44
|
|
|
54
|
-
it("converts relative path to absolute path", () => {
|
|
55
|
-
const result = pathNorm("relative/path");
|
|
56
|
-
expect(path.isAbsolute(result)).toBe(true);
|
|
57
|
-
});
|
|
58
45
|
});
|
|
59
46
|
|
|
60
47
|
//#endregion
|
|
@@ -154,21 +154,6 @@ describe("SdWorker", () => {
|
|
|
154
154
|
|
|
155
155
|
//#endregion
|
|
156
156
|
|
|
157
|
-
//#region stdout/stderr
|
|
158
|
-
|
|
159
|
-
describe("stdout/stderr", () => {
|
|
160
|
-
it("forwards worker console.log output to main process", async () => {
|
|
161
|
-
worker = Worker.create<typeof TestWorkerModule>(workerPath);
|
|
162
|
-
|
|
163
|
-
const result = await worker.logMessage("test message");
|
|
164
|
-
|
|
165
|
-
// If method returns normally, stdout piping is working
|
|
166
|
-
expect(result).toBe("logged");
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
//#endregion
|
|
171
|
-
|
|
172
157
|
//#region env option
|
|
173
158
|
|
|
174
159
|
describe("env option", () => {
|