Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: optimize biome config and add dev script #220

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading