Skip to content

Commit

Permalink
Merge pull request #220 from chouchouji/chore-package
Browse files Browse the repository at this point in the history
chore: optimize biome config and add dev script
  • Loading branch information
iosh authored Dec 14, 2024
2 parents 3089f30 + e57a05d commit e1774b8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignoreUnknown": true,
"ignore": ["dist", "*.json"]
},
"formatter": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
"scripts": {
"clean": "rimraf node_modules dist",
"test": "pnpm build && vitest run",
"dev": "tsc --watch",
"build": "rimraf dist && tsc && rimraf dist/types.js",
"test:watch": "vitest",
"changeset:version": "changeset version",
"changeset:publish": "changeset publish",
"check": "biome check --write ."
"check": "biome check --write --verbose"
},
"keywords": [
"npm",
Expand Down
18 changes: 14 additions & 4 deletions tests/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
} from 'vitest';

import { onHome, onTest } from '../src/actions';
import { readFile, writeFile } from '../src/helpers';
import { NPMRC, REGISTRIES } from '../src/constants';
import { readFile, writeFile } from '../src/helpers';

const isWin = process.platform === 'win32';

Expand Down Expand Up @@ -98,7 +98,11 @@ it('nrm use <registry> local', async () => {

expect(npmrc.registry).toBe(REGISTRIES.cnpm.registry);

await coffee.spawn('nrm', ['current'], { shell: isWin }).expect('stdout', /cnpm/g).expect('code', 0).end();
await coffee
.spawn('nrm', ['current'], { shell: isWin })
.expect('stdout', /cnpm/g)
.expect('code', 0)
.end();
});

it('nrm use <registry> local with user config', async () => {
Expand All @@ -115,7 +119,11 @@ it('nrm use <registry> local with user config', async () => {
expect(npmrc.registry).toBe(REGISTRIES.cnpm.registry);
expect(npmrc.abc).toBe('123');

await coffee.spawn('nrm', ['current'], { shell: isWin }).expect('stdout', /cnpm/g).expect('code', 0).end();
await coffee
.spawn('nrm', ['current'], { shell: isWin })
.expect('stdout', /cnpm/g)
.expect('code', 0)
.end();
});

it('nrm use without argument', async () => {
Expand All @@ -127,7 +135,9 @@ it('nrm use without argument', async () => {
});
});

expect(message).toBe(`? Please select the registry you want to use (Use arrow keys)
expect(
message,
).toBe(`? Please select the registry you want to use (Use arrow keys)
${isWin ? '>' : '❯'} npm
yarn
tencent
Expand Down

0 comments on commit e1774b8

Please sign in to comment.