facilitate ssr.test

This commit is contained in:
Pooya Parsa 2018-03-17 13:31:57 +03:30
parent 8ad328f8a9
commit e652d40f55

View File

@ -15,7 +15,7 @@ const match = (regex, text) => (regex.exec(text) || [])[1]
const url = route => 'http://localhost:' + port + route
const isWindows = /^win/.test(process.platform)
// const isWindows = /^win/.test(process.platform)
// Init nuxt.js and create server listening on localhost:4000
test.serial('Init Nuxt.js', async t => {
@ -90,17 +90,10 @@ test('unique responses with fetch', async t => {
// == Stress Test ==
// The idea of this test is to ensure there is no memory or data leak during SSR requests
// Or pending promises/sockets and function calls.
// Making 1K requests by default
// Related issue: https://github.com/nuxt/nuxt.js/issues/1354
const stressTest = async (t, _url, concurrency = 10, steps = 100) => {
const stressTest = async (t, _url, concurrency = 2, steps = 4) => {
let statusCodes = {}
// appveyor memory limit!
if (isWindows) {
concurrency = 1
steps = 1
}
await Utils.sequence(range(steps), async () => {
await Utils.parallel(range(concurrency), async () => {
let response = await rp(url(_url), { resolveWithFullResponse: true })