mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
facilitate ssr.test
This commit is contained in:
parent
8ad328f8a9
commit
e652d40f55
@ -15,7 +15,7 @@ const match = (regex, text) => (regex.exec(text) || [])[1]
|
|||||||
|
|
||||||
const url = route => 'http://localhost:' + port + route
|
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
|
// Init nuxt.js and create server listening on localhost:4000
|
||||||
test.serial('Init Nuxt.js', async t => {
|
test.serial('Init Nuxt.js', async t => {
|
||||||
@ -90,17 +90,10 @@ test('unique responses with fetch', async t => {
|
|||||||
// == Stress Test ==
|
// == Stress Test ==
|
||||||
// The idea of this test is to ensure there is no memory or data leak during SSR requests
|
// 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.
|
// Or pending promises/sockets and function calls.
|
||||||
// Making 1K requests by default
|
|
||||||
// Related issue: https://github.com/nuxt/nuxt.js/issues/1354
|
// 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 = {}
|
let statusCodes = {}
|
||||||
|
|
||||||
// appveyor memory limit!
|
|
||||||
if (isWindows) {
|
|
||||||
concurrency = 1
|
|
||||||
steps = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
await Utils.sequence(range(steps), async () => {
|
await Utils.sequence(range(steps), async () => {
|
||||||
await Utils.parallel(range(concurrency), async () => {
|
await Utils.parallel(range(concurrency), async () => {
|
||||||
let response = await rp(url(_url), { resolveWithFullResponse: true })
|
let response = await rp(url(_url), { resolveWithFullResponse: true })
|
||||||
|
Loading…
Reference in New Issue
Block a user