feat(watchers): add Rust-powered watcher backend with runtime fallback and cross-platform test coverage
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as smartwatch from '../ts/index.js';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartrx from '@push.rocks/smartrx';
|
||||
|
||||
import * as fs from 'fs';
|
||||
@@ -86,7 +85,7 @@ tap.test('should detect ADD event for new files', async () => {
|
||||
|
||||
// Create a new file
|
||||
const testFile = path.join(TEST_DIR, 'add-test.txt');
|
||||
await smartfile.memory.toFs('test content', testFile);
|
||||
await fs.promises.writeFile(testFile, 'test content');
|
||||
|
||||
const [filePath] = await eventPromise;
|
||||
expect(filePath).toInclude('add-test.txt');
|
||||
@@ -99,7 +98,7 @@ tap.test('should detect ADD event for new files', async () => {
|
||||
tap.test('should detect CHANGE event for modified files', async () => {
|
||||
// First create the file
|
||||
const testFile = path.join(TEST_DIR, 'change-test.txt');
|
||||
await smartfile.memory.toFs('initial content', testFile);
|
||||
await fs.promises.writeFile(testFile, 'initial content');
|
||||
|
||||
// Wait for add event to complete
|
||||
await delay(300);
|
||||
@@ -108,7 +107,7 @@ tap.test('should detect CHANGE event for modified files', async () => {
|
||||
const eventPromise = waitForFileEvent(changeObservable, 'change-test.txt');
|
||||
|
||||
// Modify the file
|
||||
await smartfile.memory.toFs('modified content', testFile);
|
||||
await fs.promises.writeFile(testFile, 'modified content');
|
||||
|
||||
const [filePath] = await eventPromise;
|
||||
expect(filePath).toInclude('change-test.txt');
|
||||
@@ -121,7 +120,7 @@ tap.test('should detect CHANGE event for modified files', async () => {
|
||||
tap.test('should detect UNLINK event for deleted files', async () => {
|
||||
// First create the file
|
||||
const testFile = path.join(TEST_DIR, 'unlink-test.txt');
|
||||
await smartfile.memory.toFs('to be deleted', testFile);
|
||||
await fs.promises.writeFile(testFile, 'to be deleted');
|
||||
|
||||
// Wait for add event to complete
|
||||
await delay(300);
|
||||
|
||||
Reference in New Issue
Block a user