feat(cli): refactor cli build

This commit is contained in:
LongYinan 2021-11-19 14:58:21 +08:00
parent b3446092d0
commit 4c3fe26478
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
36 changed files with 486 additions and 313 deletions

View file

@ -14,7 +14,7 @@ test('should read a file and return its a buffer', async (t) => {
t.is(bindings.testTokioReadfile, undefined)
return
}
await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
bindings.testTokioReadfile(filepath, (err: Error | null, value: Buffer) => {
try {
t.is(err, null)

View file

@ -28,7 +28,7 @@ test.serial('should reject error from tokio future', async (t) => {
await bindings.testTokioError(filepath)
throw new TypeError('Unreachable')
} catch (e) {
t.is(e.message, 'Error from tokio future')
t.is((e as Error).message, 'Error from tokio future')
}
})

View file

@ -13,7 +13,7 @@ test('should be able to detach ArrayBuffer', (t) => {
bindings.testDetachArrayBuffer(ab)
t.is(ab.byteLength, 0)
} catch (e) {
t.is(e.code, 'DetachableArraybufferExpected')
t.is((e as any).code, 'DetachableArraybufferExpected')
}
})
@ -28,6 +28,6 @@ test('is detached arraybuffer should work fine', (t) => {
t.false(bindings.testIsDetachedArrayBuffer(nonDetachedArrayBuffer))
t.true(bindings.testIsDetachedArrayBuffer(detachedArrayBuffer))
} catch (e) {
t.is(e.code, 'DetachableArraybufferExpected')
t.is((e as any).code, 'DetachableArraybufferExpected')
}
})

View file

@ -9,6 +9,11 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
[
'@rollup/plugin-alias',
'@rollup/plugin-commonjs',
'@rollup/plugin-json',
'@rollup/plugin-node-resolve',
'@rollup/plugin-replace',
'@types/debug',
'@types/lodash-es',
'@types/node',
@ -29,6 +34,7 @@ Generated by [AVA](https://avajs.dev).
'lint-staged',
'npm-run-all',
'prettier',
'rollup',
'shx',
'sinon',
'source-map-support',