Skip to content

Commit

Permalink
chore: adjust test script
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 22, 2020
1 parent b6988a4 commit da65008
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions build/jest.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import spawn from 'cross-spawn'
import open from 'open'
import { resolve } from 'path'

const args = ['jest', '--coverage']

if (process.argv[2]) {
args.push(process.argv[2])
if (process.argv[3]) {
args.push('--collectCoverageFrom', `**/${process.argv[3]}/**.ts`)
args.push('--collectCoverageFrom', `**/${process.argv[3]}/**/*.ts`)
}
} else {
args.push('packages/.+\\.spec\\.ts')
}

spawn('npx', args, { stdio: 'inherit' })
const child = spawn('npx', args, { stdio: 'inherit' })

child.on('close', () => {
open(resolve(__dirname, '../coverage/lcov-report/index.html'))
})
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"scripts": {
"build": "tsc -b",
"build:extend": "tsc -b tsconfig.extend.json",
"build:shiki": "ts-node bots/shiki/build",
"build:dict": "ts-node bots/shiki/build/dict",
"bump": "ts-node build/bump",
"dep": "ts-node build/dep",
Expand Down Expand Up @@ -46,6 +47,7 @@
"jest": "^24.9.0",
"kleur": "^3.0.3",
"latest-version": "^5.1.0",
"open": "^7.0.0",
"ora": "^4.0.3",
"p-map": "^3.0.0",
"prompts": "^2.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/koishi-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function getUsage (name: string, user: UserData, time = new Date()) {
return usage
}

export function updateUsage (name: string, user: UserData, maxUsage: number, minInterval: number) {
export function updateUsage (name: string, user: UserData, maxUsage: number, minInterval?: number) {
const date = new Date()
const usage = getUsage(name, user, date)

Expand Down

0 comments on commit da65008

Please sign in to comment.