UNPKG

520 BJavaScriptView Raw
1'use strict'
2
3const t = require('tap')
4const test = t.test
5const proxyquire = require('proxyquire')
6const server = proxyquire('../../lib/server', { http2: null })
7const Fastify = proxyquire('../..', { './lib/server.js': server })
8
9test('should throw when http2 module cannot be found', t => {
10 t.plan(1)
11 try {
12 Fastify({ http2: true })
13 t.fail('fastify did not throw expected error')
14 } catch (err) {
15 t.equal(err.message, 'FST_ERR_HTTP2_INVALID_VERSION: HTTP2 is available only from node >= 8.8.1')
16 }
17})