Skip invariants in test env
This commit is contained in:
parent
293786d182
commit
f4f0c59552
|
@ -1,5 +1,5 @@
|
|||
require('isomorphic-fetch')
|
||||
const warning = require('warning')
|
||||
const invariant = require('invariant')
|
||||
const gunzip = require('gunzip-maybe')
|
||||
const ndjson = require('ndjson')
|
||||
|
||||
|
@ -7,12 +7,12 @@ const CloudflareAPIURL = 'https://api.cloudflare.com'
|
|||
const CloudflareEmail = process.env.CLOUDFLARE_EMAIL
|
||||
const CloudflareKey = process.env.CLOUDFLARE_KEY
|
||||
|
||||
warning(
|
||||
invariant(
|
||||
CloudflareEmail,
|
||||
'Missing the $CLOUDFLARE_EMAIL environment variable'
|
||||
)
|
||||
|
||||
warning(
|
||||
invariant(
|
||||
CloudflareKey,
|
||||
'Missing the $CLOUDFLARE_KEY environment variable'
|
||||
)
|
||||
|
|
|
@ -9,9 +9,6 @@ const packageURL = require('./middleware/packageURL')
|
|||
const fetchFile = require('./middleware/fetchFile')
|
||||
const serveFile = require('./middleware/serveFile')
|
||||
|
||||
const createSearchServer = require('./createSearchServer')
|
||||
const createStatsServer = require('./createStatsServer')
|
||||
|
||||
morgan.token('fwd', function (req) {
|
||||
return req.get('x-forwarded-for').replace(/\s/g, '')
|
||||
})
|
||||
|
@ -48,8 +45,13 @@ function createApp() {
|
|||
maxAge: '365d'
|
||||
}))
|
||||
|
||||
app.use('/_search', createSearchServer())
|
||||
app.use('/_stats', createStatsServer())
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
const createSearchServer = require('./createSearchServer')
|
||||
app.use('/_search', createSearchServer())
|
||||
|
||||
const createStatsServer = require('./createStatsServer')
|
||||
app.use('/_stats', createStatsServer())
|
||||
}
|
||||
|
||||
app.use('/',
|
||||
packageURL,
|
||||
|
|
Loading…
Reference in New Issue