Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: remove global timeout, set timeouts individually #4224

Merged
merged 5 commits into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lighthouse-core/lib/traces/trace-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const WebInspector = require('../web-inspector');
* streaming JSON parser.
* The resulting trace doesn't include the "metadata" property, as it's excluded via DevTools'
* implementation.
* FIXME: This can be removed once Node 8 support is dropped. https://stackoverflow.com/a/47781288/89484
*/
class TraceParser {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/scripts/run-mocha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
flag=$1

function _runmocha() {
mocha --reporter dot $2 $(find $1/test -name '*-test.js') --timeout 60000;
mocha --reporter dot $2 $(find $1/test -name '*-test.js');
}

if [ "$flag" == '--watch' ]; then
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/test/audits/bootup-time-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Performance: bootup-time audit', () => {
assert.deepEqual(roundedValueOf('https://pwa.rocks/'), {[groupIdToName.parseHTML]: 14.2, [groupIdToName.scripting]: 6.1, [groupIdToName.scriptParseCompile]: 1.2});
assert.deepEqual(roundedValueOf('https://pwa.rocks/0ff789bf.js'), {[groupIdToName.parseHTML]: 0});
});
});
}).timeout(10000);

it('should get no data when no events are present', () => {
const artifacts = Object.assign({
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/test/audits/screenshot-thumbnails-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Screenshot thumbnails', () => {
assert.equal(results.details.items[9].timing, 818);
assert.equal(results.details.items[0].timestamp, 225414253815);
});
});
}).timeout(10000);

it('should scale the timeline to TTFI', () => {
const artifacts = Object.assign({
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/test/audits/speed-index-metric-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Performance: speed-index-metric audit', () => {
assert.equal(Math.round(result.extendedInfo.value.timings.visuallyComplete), 1105);
assert.equal(Math.round(result.extendedInfo.value.timings.perceptualSpeedIndex), 609);
});
});
}).timeout(10000);

it('throws an error if no frames', () => {
const artifacts = mockArtifactsWithSpeedlineResult({frames: []});
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/test/gather/computed/dtm-model-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ describe('DTM Model gatherer', () => {
assert.deepStrictEqual(pwaTrace[i], freshTrace[i]);
}
});
});
}).timeout(20000);
});
8 changes: 4 additions & 4 deletions lighthouse-core/test/gather/computed/speedline-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ describe('Speedline gatherer', () => {
assert.equal(speedline.speedIndex, undefined);
assert.equal(Math.floor(speedline.perceptualSpeedIndex), 609);
});
});
}).timeout(10000);

it('measures SI of 3 frame trace (blank @1s, content @2s, more content @3s)', () => {
return computedArtifacts.requestSpeedline(threeFrameTrace).then(speedline => {
assert.equal(speedline.speedIndex, undefined);
assert.equal(Math.floor(speedline.perceptualSpeedIndex), 2030);
});
});
}).timeout(10000);

it('uses a cache', () => {
let start;
Expand All @@ -62,7 +62,7 @@ describe('Speedline gatherer', () => {

return assert.equal(Math.floor(speedline.perceptualSpeedIndex), 609);
});
});
}).timeout(10000);

it('does not change order of events in traces', () => {
// Use fresh trace in case it has been altered by other require()s.
Expand All @@ -78,5 +78,5 @@ describe('Speedline gatherer', () => {
assert.deepStrictEqual(pwaTrace[i], freshTrace[i]);
}
});
});
}).timeout(10000);
});
4 changes: 2 additions & 2 deletions lighthouse-core/test/lib/asset-saver-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('asset-saver helper', () => {
const traceEventsFromDisk = JSON.parse(traceFileContents).traceEvents;
assertTraceEventsEqual(traceEventsFromDisk, fullTraceObj.traceEvents);
});
});
}).timeout(10000);

it('correctly saves a trace with no trace events to disk', () => {
const trace = {
Expand Down Expand Up @@ -186,6 +186,6 @@ describe('asset-saver helper', () => {
const fileStats = fs.lstatSync(traceFilename);
assert.ok(fileStats.size > Math.pow(2, 28));
});
});
}).timeout(40 * 1000);
});
});
4 changes: 2 additions & 2 deletions lighthouse-core/test/lib/traces/trace-parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('traceParser parser', () => {

done();
});
});
}).timeout(10000);


it('parses a trace > 256mb (slow)', () => {
Expand Down Expand Up @@ -89,5 +89,5 @@ describe('traceParser parser', () => {
assert.deepStrictEqual(
streamedTrace.traceEvents[events.length - 2],
events[0]);
});
}).timeout(40 * 1000);
});