Skip to content

Instantly share code, notes, and snippets.

@cwmanning
cwmanning / cypress-code-coverage-performance.md
Last active April 21, 2022 21:34
Test Suite Performance with Cypress Code Coverage

Cypress Code Coverage Performance

The problem

A Cypress.io test suite with Istanbul-instrumented code took 30 minutes to run instead of 10. For context, we were using https://github.com/cypress-io/code-coverage.

Debugging

Some overhead is expected with each spec. Collecting coverage will increase the overall run time, surely. But in debug runs (setting DEBUG=code-coverage), we saw an unexpected 31 second overhead running just one spec:

@cwmanning
cwmanning / SassMeister-input-HTML.html
Created January 22, 2015 17:52
Generated by SassMeister.com.
<h1>Viget</h1>
<ul>
<li>
<a href="http://viget.com/about#team" class="flyout-nav">Team</a>
<ul class="flyout">
<li>
<a href="http://viget.com/about/team/bwilliams">Brian W. Williams</a>
</li>
<li>
<a href="http://viget.com/about/team/arankin">Andy Rankin</a>
@cwmanning
cwmanning / SassMeister-input.scss
Created October 15, 2014 17:49
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
$colors: (
birthday: #0989cb,
gender: #8666ae,
weight: #02bba7,
height: #ff8178
@cwmanning
cwmanning / SassMeister-input.sass
Created July 9, 2014 14:20
Generated by SassMeister.com.
// ----
// Sass (v3.3.9)
// Compass (v1.0.0.alpha.20)
// ----
=calcIt($property, $fallback, $expression)
#{$property}: $fallback
#{$property}: calc(#{$expression})
body
=vertically-centered-child($size: $base-font-size)
font-size: 0
&:before
content: ''
display: inline-block
height: 100%
vertical-align: middle
> *
@cwmanning
cwmanning / SassMeister-input.scss
Created January 23, 2014 21:20
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
$beige: #ece9d9;
p {
color: $beige - 25;
}
@cwmanning
cwmanning / slideshow.css
Last active December 20, 2015 14:38
Flexible, 4:3 container with images that fill. Images 'letter box' if not 4:3
.slide-media {
background: #000;
text-align: center;
width: 100%;
// Intrisic Ratios. Used here to produce a flexible 4:3 box
// http://alistapart.com/article/creating-intrinsic-ratios-for-video
height: 0;
padding-bottom: 75%;
position: relative;
@cwmanning
cwmanning / blah.js
Created May 14, 2013 16:16
touch support stash
this.$slide
.on('touchstart', function(e) {
e.preventDefault();
})
.on('touchend', function(e) {
console.log(e)
var slide = $(e.currentTarget);
var touchEvent = e.originalEvent || e;
var targetX = e.target.x;
console.log(e.target.x);
@cwmanning
cwmanning / sample.py
Created April 25, 2013 20:21
parse Git log info
from sh import git
#
# Command Being Run
# git --git-dir autodeploy_branchbuilder.git log --grep="Merge pull request #" release/2.0.. | grep "Merge pull request"
#
# Output Expected Sample
# Merge pull request #19 from GannettDigital/feature/update_conflicts
# Merge pull request #18 from GannettDigital/feature/bugsquash
# etc.
def _scores(self, scores):
if not hasattr(scores, 'team_game_stats') or not hasattr(scores.team_game_stats, 'sub_score'):
return []
widget_scores = []
for score in scores.team_game_stats.sub_score:
try:
widget_scores.append(score.period_score)
except AttributeError:
widget_scores.append(0)
label = self.caption.get(self.league_key, self.caption['default'])