Skip to content

Commit f29049d

Browse files
committed
update ava
1 parent 4357add commit f29049d

14 files changed

+866
-1748
lines changed

package-lock.json

Lines changed: 765 additions & 1648 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"devDependencies": {
6363
"@grpc/proto-loader": "^0.5.4",
6464
"async": "^3.0.0",
65-
"ava": "^2.3.0",
65+
"ava": "^3.0.0",
6666
"coveralls": "^3.0.6",
6767
"google-protobuf": "^3.9.1",
6868
"grpc": "^1.23.3",

test/app.context.test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import test from 'ava'
2-
import path from 'path'
3-
import grpc from 'grpc'
4-
import CallType from '@malijs/call-types'
5-
import hl from 'highland'
6-
import async from 'async'
7-
import _ from 'lodash'
8-
import pMap from 'p-map'
9-
10-
import Mali from '../'
11-
import * as tu from './util'
1+
const test = require('ava')
2+
const path = require('path')
3+
const grpc = require('grpc')
4+
const CallType = require('@malijs/call-types')
5+
const hl = require('highland')
6+
const async = require('async')
7+
const _ = require('lodash')
8+
const pMap = require('p-map')
9+
10+
const Mali = require('../')
11+
const tu = require('./util')
1212

1313
const pl = require('@grpc/proto-loader')
1414

test/app.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import test from 'ava'
2-
import path from 'path'
3-
import grpc from 'grpc'
4-
import hl from 'highland'
5-
import async from 'async'
6-
import _ from 'lodash'
7-
import isCI from 'is-ci'
1+
const test = require('ava')
2+
const path = require('path')
3+
const grpc = require('grpc')
4+
const hl = require('highland')
5+
const async = require('async')
6+
const _ = require('lodash')
7+
const isCI = require('is-ci')
88

9-
import Mali from '../'
10-
import * as tu from './util'
9+
const Mali = require('../')
10+
const tu = require('./util')
1111

1212
const pl = require('@grpc/proto-loader')
1313

@@ -215,7 +215,7 @@ test.cb('app.start() should throw when binding to taken port', t => {
215215

216216
const error = t.throws(() => {
217217
app2.start(`0.0.0.0:${app.ports[0]}`)
218-
}, Error)
218+
}, { instanceOf: Error })
219219

220220
console.log(error)
221221
t.is(error.message, `Failed to bind to port: ${port}`)

test/context.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import test from 'ava'
2-
import CallType from '@malijs/call-types'
1+
const test = require('ava')
2+
const CallType = require('@malijs/call-types')
33

4-
import Request from '../lib/request'
5-
import Response from '../lib/response'
6-
import Mali from '../'
4+
const Request = require('../lib/request')
5+
const Response = require('../lib/response')
6+
const Mali = require('../')
77

88
test('createContext should create context for a UNARY call', t => {
99
const app = new Mali()

test/create.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import test from 'ava'
2-
import path from 'path'
3-
import _ from 'lodash'
4-
import pMap from 'p-map'
1+
const test = require('ava')
2+
const path = require('path')
3+
const _ = require('lodash')
4+
const pMap = require('p-map')
55

6-
import Mali from '../'
7-
import * as tu from './util'
6+
const Mali = require('../')
7+
const tu = require('./util')
88

99
const PROTO_PATH = path.resolve(__dirname, './protos/helloworld.proto')
1010
const PROTO_PATH_MULTI = path.resolve(__dirname, './protos/multi.proto')

test/errors.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import test from 'ava'
2-
import path from 'path'
3-
import grpc from 'grpc'
4-
import hl from 'highland'
5-
import async from 'async'
6-
import _ from 'lodash'
7-
8-
import Mali from '../'
9-
import * as tu from './util'
1+
const test = require('ava')
2+
const path = require('path')
3+
const grpc = require('grpc')
4+
const hl = require('highland')
5+
const async = require('async')
6+
const _ = require('lodash')
7+
8+
const Mali = require('../')
9+
const tu = require('./util')
1010

1111
const pl = require('@grpc/proto-loader')
1212
const CallType = require('@malijs/call-types')

test/metadata.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import test from 'ava'
2-
import path from 'path'
3-
import grpc from 'grpc'
4-
import hl from 'highland'
5-
import async from 'async'
6-
import _ from 'lodash'
7-
8-
import Mali from '../'
9-
import * as tu from './util'
1+
const test = require('ava')
2+
const path = require('path')
3+
const grpc = require('grpc')
4+
const hl = require('highland')
5+
const async = require('async')
6+
const _ = require('lodash')
7+
8+
const Mali = require('../')
9+
const tu = require('./util')
1010

1111
const pl = require('@grpc/proto-loader')
1212

test/middleware.test.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
import test from 'ava'
2-
import path from 'path'
3-
import grpc from 'grpc'
4-
import BB from 'bluebird'
5-
import pMap from 'p-map'
6-
import _ from 'lodash'
1+
const test = require('ava')
2+
const path = require('path')
3+
const grpc = require('grpc')
4+
const util = require('util')
5+
const pMap = require('p-map')
6+
const _ = require('lodash')
7+
const fs = require('fs')
78

8-
import Mali from '../'
9-
import * as tu from './util'
9+
const Mali = require('../')
10+
const tu = require('./util')
1011

1112
const pl = require('@grpc/proto-loader')
1213

13-
const fs = BB.promisifyAll(require('fs'))
14+
const readFileAsync = util.promisify(fs.readFile)
1415

1516
const PROTO_PATH = path.resolve(__dirname, './protos/transform.proto')
1617

@@ -58,7 +59,7 @@ async function mw1 (ctx, next) {
5859

5960
async function mw2 (ctx, next) {
6061
const filepath = path.resolve(__dirname, './static/mw2.txt')
61-
const v = await fs.readFileAsync(filepath, 'utf8')
62+
const v = await readFileAsync(filepath, 'utf8')
6263
ctx.value = v ? v.trim() : ''
6364
ctx.mw = (ctx.mw || '').concat(':mw2')
6465
await next()

test/onerror.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import test from 'ava'
2-
import { AssertionError } from 'assert'
3-
import { stderr } from 'test-console'
4-
import path from 'path'
5-
import grpc from 'grpc'
1+
const test = require('ava')
2+
const { AssertionError } = require('assert')
3+
const { stderr } = require('test-console')
4+
const path = require('path')
5+
const grpc = require('grpc')
66

7-
import Mali from '../'
8-
import * as tu from './util'
7+
const Mali = require('../')
8+
const tu = require('./util')
99

1010
const pl = require('@grpc/proto-loader')
1111

@@ -15,7 +15,7 @@ test('should throw an error if a non-error is given', t => {
1515

1616
const error = t.throws(() => {
1717
app.onerror('foo')
18-
}, AssertionError)
18+
}, { instanceOf: AssertionError })
1919

2020
t.is(error.message, 'non-error thrown: foo')
2121
})

0 commit comments

Comments
 (0)