Skip to content

Commit

Permalink
refactor: enhance filesystem metadata code quality and reliability
Browse files Browse the repository at this point in the history
- Add timeout handling via thenOrTimeout() with configurable timeoutMs
- Improve error handling and resource cleanup in C++ code
- Consolidate filesystem options into single configuration object
- Fix size calculation issues and memory leaks in filesystem operations
- Improve Windows and Unix platform-specific code
- Add comprehensive unit tests
- Improve documentation and examples
  • Loading branch information
mceachen committed Nov 12, 2024
1 parent 2e00625 commit e4718e1
Show file tree
Hide file tree
Showing 43 changed files with 1,813 additions and 797 deletions.
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ export default {
statements: 80
}
},
verbose: true
verbose: true,
silent: false,
randomize: true,
setupFilesAfterEnv: ['jest-extended/all']
};
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@
},
"license": "MIT",
"scripts": {
"install": "node-gyp rebuild",
"prebuild": "rm -rf dist",
"build": "npm run build:cjs && npm run build:esm && npm run build:types",
"install": "npm run build:gyp",
"clean": "rm -rf dist build",
"prebuild": "npm run clean",
"build": "npm run build:gyp && npm run build:cjs && npm run build:esm && npm run build:types",
"build:gyp": "node-gyp rebuild",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"build:types": "tsc -p tsconfig.types.json",
"build:watch": "tsc -p tsconfig.test.json --watch",
"docs": "typedoc --out docs src/index.ts",
"pretest": "npm run build",
"test": "jest --silent=false",
"pretest": "tsc -p tsconfig.test.json",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:clear": "jest --clearCache",
Expand Down Expand Up @@ -82,9 +85,10 @@
"@typescript-eslint/parser": "^8.13.0",
"eslint": "^9.14.0",
"jest": "^29.7.0",
"jest-extended": "^4.0.2",
"node-gyp": "^10.2.0",
"prettier-plugin-organize-imports": "4.1.0",
"prettier": "^3.3.3",
"prettier-plugin-organize-imports": "4.1.0",
"ts-jest": "^29.2.5",
"typedoc": "^0.26.11",
"typescript": "^5.6.3"
Expand Down
19 changes: 0 additions & 19 deletions src/Array.ts

This file was deleted.

75 changes: 0 additions & 75 deletions src/Config.ts

This file was deleted.

51 changes: 0 additions & 51 deletions src/DeepFreeze.ts

This file was deleted.

30 changes: 0 additions & 30 deletions src/Octal.ts

This file was deleted.

71 changes: 0 additions & 71 deletions src/__tests__/Octal.test.ts

This file was deleted.

15 changes: 9 additions & 6 deletions src/__tests__/Array.test.ts → src/__tests__/array.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/__tests__/Array.test.ts
// src/__tests__/array.test.ts

import { asyncFilter, uniq } from "../Array.js";
import { asyncFilter, uniq } from "../array.js";

describe("Array", () => {
describe("asyncFilter", () => {
Expand Down Expand Up @@ -64,19 +64,22 @@ describe("Array", () => {

// Test concurrent execution
it("should execute predicates concurrently", async () => {
const delays = [30, 20, 10];
jest.retryTimes(3);
const delays = [50, 40, 30, 20, 10];
const start = Date.now();

await asyncFilter(delays, async (delay) => {
const results = await asyncFilter(delays, async (delay) => {
await new Promise((resolve) => setTimeout(resolve, delay));
return true;
});

expect(results).toEqual(delays);

const totalTime = Date.now() - start;

// Should take approximately the time of the longest delay (30ms)
// Should take approximately the time of the longest delay (50ms)
// Adding some buffer for execution time
expect(totalTime).toBeLessThan(50);
expect(totalTime).toBeLessThan(75);
});

// Test error handling
Expand Down
Loading

0 comments on commit e4718e1

Please sign in to comment.