Skip to content
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 packages/testkit-backend/src/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class Backend {
try {
this._controller.handle(contextId, request)
} catch (e) {
this._channel.writeBackendError(contextId, e)
this._channel.writeBackendError(contextId, e.message)
}
})
}
Expand Down
8 changes: 2 additions & 6 deletions packages/testkit-backend/src/channel/testkit-protocol.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import readline from 'readline'
import EventEmitter from 'events'
import stringify from '../stringify'

export default class Protocol extends EventEmitter {
constructor (stream) {
Expand Down Expand Up @@ -61,7 +62,7 @@ export default class Protocol extends EventEmitter {

serializeResponse (response) {
console.log('> writing response', response)
const responseStr = this._stringify(response)
const responseStr = stringify(response)
return ['#response begin', responseStr, '#response end'].join('\n') + '\n'
}

Expand All @@ -72,9 +73,4 @@ export default class Protocol extends EventEmitter {
this.emit('request', { name, data })
}

_stringify (val) {
return JSON.stringify(val, (_, value) =>
typeof value === 'bigint' ? `${value}n` : value
)
}
}
1 change: 1 addition & 0 deletions packages/testkit-backend/src/controller/local.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Context from '../context'
import Controller from './interface'
import stringify from '../stringify'


/**
Expand Down
5 changes: 5 additions & 0 deletions packages/testkit-backend/src/stringify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function stringify(json) {
return JSON.stringify(json, (_, value) =>
typeof value === 'bigint' ? `${value}n` : value
)
}