Skip to content

Commit cc05121

Browse files
committed
Added zenfs-test --clean
Removed deprecated APIs from coverage
1 parent 19058df commit cc05121

File tree

9 files changed

+33
-6
lines changed

9 files changed

+33
-6
lines changed

scripts/test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const { values: options, positionals } = parseArgs({
1919
preserve: { short: 'p', type: 'boolean' },
2020
'exit-on-fail': { short: 'e', type: 'boolean' },
2121
report: { type: 'boolean' },
22+
clean: { type: 'boolean' },
2223
},
2324
allowPositionals: true,
2425
});
@@ -42,7 +43,8 @@ Options:
4243
Coverage:
4344
--coverage <dir> Override the default coverage data directory
4445
-p,--preserve Do not delete or report coverage data
45-
--report ONLY report coverage`);
46+
--report ONLY report coverage
47+
--clean ONLY clean up coverage directory`);
4648
process.exit();
4749
}
4850

@@ -53,9 +55,14 @@ if (options.quiet && options.verbose) {
5355

5456
process.env.NODE_V8_COVERAGE = options.coverage;
5557

58+
if (options.clean) {
59+
rmSync(options.coverage, { recursive: true, force: true });
60+
process.exit();
61+
}
62+
5663
if (options.report) {
5764
execSync('npx c8 report --reporter=text', { stdio: 'inherit' });
58-
rmSync(options.coverage, { recursive: true });
65+
rmSync(options.coverage, { recursive: true, force: true });
5966
process.exit();
6067
}
6168

src/backends/store/fs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class StoreFS<T extends Store = Store> extends FileSystem {
4646
};
4747
}
4848

49+
/* node:coverage disable */
4950
/**
5051
* Delete all contents stored in the file system.
5152
* @deprecated
@@ -65,6 +66,7 @@ export class StoreFS<T extends Store = Store> extends FileSystem {
6566
// Root always exists.
6667
this.checkRootSync();
6768
}
69+
/* node:coverage enable */
6870

6971
/**
7072
* Load an index into the StoreFS.

src/backends/store/index_fs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type { Store } from './store.js';
1515
* Implementors: You *must* populate the underlying store for read operations to work!
1616
* @deprecated
1717
*/
18+
/* node:coverage disable */
1819
export abstract class IndexFS<T extends Store> extends StoreFS<T> {
1920
protected readonly index: Index = new Index();
2021

@@ -79,3 +80,4 @@ export abstract class IndexFS<T extends Store> extends StoreFS<T> {
7980
super.syncSync(path, data, stats);
8081
}
8182
}
83+
/* node:coverage enable */

src/devices.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ export class DeviceFS extends StoreFS<InMemoryStore> {
236236
* Creates a new device at `path` relative to the `DeviceFS` root.
237237
* @deprecated
238238
*/
239+
/* node:coverage disable */
239240
public createDevice<TData = any>(path: string, driver: DeviceDriver<TData>, options: object = {}): Device<TData | Record<string, never>> {
240241
if (this.existsSync(path)) {
241242
throw ErrnoError.With('EEXIST', path, 'mknod');
@@ -255,6 +256,7 @@ export class DeviceFS extends StoreFS<InMemoryStore> {
255256
this.devices.set(path, dev);
256257
return dev;
257258
}
259+
/* node:coverage enable */
258260

259261
protected devicesWithDriver(driver: DeviceDriver<unknown> | string, forceIdentity?: boolean): Device[] {
260262
if (forceIdentity && typeof driver == 'string') {

src/file.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ export class PreloadFile<FS extends FileSystem> extends File<FS> {
562562
* For the file systems which do not sync to anything.
563563
* @deprecated
564564
*/
565+
/* node:coverage disable */
565566
export class NoSyncFile<T extends FileSystem> extends PreloadFile<T> {
566567
public sync(): Promise<void> {
567568
return Promise.resolve();
@@ -575,6 +576,7 @@ export class NoSyncFile<T extends FileSystem> extends PreloadFile<T> {
575576

576577
public closeSync(): void {}
577578
}
579+
/* node:coverage enable */
578580

579581
/**
580582
* An implementation of `File` that uses the FS

src/stats.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,14 @@ export abstract class StatsCommon<T extends number | bigint> implements Node.Sta
113113
*/
114114
public gid: T = this._convert(0);
115115

116+
/* node:coverage disable */
116117
/**
117118
* Some file systems stash data on stats objects.
118119
* @todo [BREAKING] Remove this
119120
* @deprecated @hidden
120121
*/
121122
public fileData?: unknown;
123+
/* node:coverage enable */
122124

123125
/**
124126
* Time of last access, since epoch
@@ -270,11 +272,12 @@ export abstract class StatsCommon<T extends number | bigint> implements Node.Sta
270272
return (perm & mode) === mode;
271273
}
272274

275+
/* node:coverage disable */
273276
/**
274277
* Change the mode of the file.
275278
* We use this helper function to prevent messing up the type of the file.
276-
* @internal
277-
* @deprecated This will be removed in the next minor release since it is internal
279+
* @internal @deprecated
280+
* @todo [BREAKING] Remove
278281
*/
279282
public chmod(mode: number): void {
280283
this.mode = this._convert((this.mode & c.S_IFMT) | mode);
@@ -283,8 +286,8 @@ export abstract class StatsCommon<T extends number | bigint> implements Node.Sta
283286
/**
284287
* Change the owner user/group of the file.
285288
* This function makes sure it is a valid UID/GID (that is, a 32 unsigned int)
286-
* @internal
287-
* @deprecated This will be removed in the next minor release since it is internal
289+
* @internal @deprecated
290+
* @todo [BREAKING] Remove
288291
*/
289292
public chown(uid: number, gid: number): void {
290293
uid = Number(uid);
@@ -296,6 +299,7 @@ export abstract class StatsCommon<T extends number | bigint> implements Node.Sta
296299
this.gid = this._convert(gid);
297300
}
298301
}
302+
/* node:coverage enable */
299303

300304
public get atimeNs(): bigint {
301305
return BigInt(this.atimeMs) * n1000;

src/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export function encodeUTF8(input: string): Uint8Array {
4848
return encoder.encode(input);
4949
}
5050

51+
/* node:coverage disable */
5152
export { /** @deprecated @hidden */ encodeUTF8 as encode };
53+
/* node:coverage enable */
5254

5355
const decoder = new TextDecoder();
5456

@@ -64,7 +66,9 @@ export function decodeUTF8(input?: Uint8Array): string {
6466
return decoder.decode(input);
6567
}
6668

69+
/* node:coverage disable */
6770
export { /** @deprecated @hidden */ decodeUTF8 as decode };
71+
/* node:coverage enable */
6872

6973
/**
7074
* Decodes a directory listing

src/vfs/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export {
77
chroot,
88
mount,
99
mountObject,
10+
/* node:coverage disable */
1011
/**
1112
* The map of mount points.
1213
* Using `fs.mounts` instead of the `mounts` export is a security issue and not recommended.
@@ -15,6 +16,7 @@ export {
1516
* @deprecated Use the `mounts` export that isn't an `fs` property!
1617
*/
1718
mounts,
19+
/* node:coverage enable */
1820
umount,
1921
} from './shared.js';
2022
export * from './streams.js';

src/vfs/shared.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export function fixError<E extends ErrnoError>(e: E, paths: Record<string, strin
144144
return e;
145145
}
146146

147+
/* node:coverage disable */
147148
/**
148149
* @internal @deprecated
149150
*/
@@ -155,6 +156,7 @@ export function mountObject(mounts: MountObject): void {
155156
mount(point, fs);
156157
}
157158
}
159+
/* node:coverage enable */
158160

159161
/**
160162
* @internal @hidden

0 commit comments

Comments
 (0)