test/tests.js
/**
 * Validate that, for each tcp connection, the previous request is fully completed before then next starts.
 */
Validate that, for each tcp connection, the previous request is fully completed before then next starts.
Validate that for each tcp connection the previous request is fully completed before then next starts .
function validateConnectionOverlap(t, entries) {
  const entriesByConnection = entries
    .filter(entry => !['h2', 'spdy/3.1'].includes(entry.response.httpVersion))
    .filter(entry => !(entry.cache || {}).beforeRequest)
    .reduce((entries, entry) => {
      const e = entries.get(entry.connection) || [];
      e.push(entry);
      entries.set(entry.connection, e);
      return entries;
    }, new Map());
  entriesByConnection.forEach((entries, connection) => {
    let previousEntry = entries.shift();
    for (let entry of entries) {
      const previousEnd =
        previousEntry._requestTime + previousEntry.time / 1000;
      const timings = entry.timings;
      t.true(
        entry._requestTime + Math.max(0, timings.blocked) / 1000 > previousEnd,
        `Two entries too close on connection ${connection}`
      );
      previousEntry = entry;
    }
  });
}
function validateConnectionOverlap ( t , entries ) { const entriesByConnection = entries . filter ( entry => ! [ 'h2' , 'spdy/3.1' ] . includes ( entry . response . httpVersion ) ) . filter ( entry => ! ( entry . cache || { } ) . beforeRequest ) . reduce ( ( entries , entry ) => { const e = entries . get ( entry . connection ) || [ ] ; e . push ( entry ) ; entries . set ( entry . connection , e ) ; return entries ; } , new Map ( ) ) ; entriesByConnection . forEach ( ( entries , connection ) => { let previousEntry = entries . shift ( ) ; for ( let entry of entries ) { const previousEnd = previousEntry . _requestTime + previousEntry . time / 1000 ; const timings = entry . timings ; t . true ( entry . _requestTime + Math . max ( 0 , timings . blocked ) / 1000 > previousEnd , ` ${ connection } ` ) ; previousEntry = entry ; } } ) ; }
Validate that, for each tcp connection, the previous request is fully completed before then next starts.
Validate that for each tcp connection the previous request is fully completed before then next starts .