Skip to content

Commit

Permalink
Fix location of test coverage directory, allow as an option
Browse files Browse the repository at this point in the history
Update package name in readme
  • Loading branch information
james-pre committed Nov 27, 2024
1 parent 2982150 commit 2fc08cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The following example mounts a zip file to `/zip`, in-memory storage to `/tmp`,
```js
import { configure, InMemory } from '@zenfs/core';
import { IndexedDB } from '@zenfs/dom';
import { Zip } from '@zenfs/zip';
import { Zip } from '@zenfs/archives';

const res = await fetch('mydata.zip');

Expand Down Expand Up @@ -122,7 +122,7 @@ You can then mount and unmount the backend instance by using `mount` and `umount
```js
import { configure, resolveMountConfig, InMemory } from '@zenfs/core';
import { IndexedDB } from '@zenfs/dom';
import { Zip } from '@zenfs/zip';
import { Zip } from '@zenfs/archives';

await configure({
mounts: {
Expand Down
10 changes: 5 additions & 5 deletions scripts/test.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const { values: options, positionals } = parseArgs({
auto: { short: 'a', type: 'boolean', default: false },
build: { short: 'b', type: 'boolean', default: false },
common: { short: 'c', type: 'boolean', default: false },
coverage: { type: 'string', default: 'tests/.coverage' },
},
allowPositionals: true,
});
Expand Down Expand Up @@ -70,10 +71,9 @@ if (options.auto) {
!options.quiet && console.log(`Auto-detected ${sum} test setup files`);
}

const coverage = join(import.meta.dirname, '../.coverage');
if (existsSync(coverage)) rmSync(coverage, { recursive: true });
mkdirSync(coverage);
process.env.NODE_V8_COVERAGE = coverage;
if (existsSync(options.coverage)) rmSync(options.coverage, { recursive: true });
mkdirSync(options.coverage);
process.env.NODE_V8_COVERAGE = options.coverage;

if (options.common) {
!options.quiet && console.log('Running common tests...');
Expand Down Expand Up @@ -107,4 +107,4 @@ for (const setupFile of positionals) {
}

execSync('npx c8 report --reporter=text', { stdio: 'inherit' });
rmSync('.coverage', { recursive: true });
rmSync(options.coverage, { recursive: true });

0 comments on commit 2fc08cf

Please sign in to comment.