Skip to content

Instantly share code, notes, and snippets.

function benchmark_jest
node_modules/jest/bin/jest.js --clearCache
# warmup, prime the cache
node_modules/jest/bin/jest.js --config config/jest.config.json
# benchmark https://github.com/sharkdp/hyperfine
hyperfine "node_modules/jest/bin/jest.js --config config/jest.config.json"
end
@deleteme
deleteme / jest version benchmarks.md
Last active August 12, 2019 09:01
Jest Version Benchmarks: 22, 23, 24

Benchmark Jest 22.1.4, 23.5.0, 23.6.0

node version jest version median duration run 1 run 2 run 3 run 4 run 5
8.x? 23.6.0 19.1 31.9 19.1 19.1 18.6 19.5
8.x? 23.5.0 18.7 18.7 17.7 18.1 20.6 20.1
8.x? 22.1.4 12.2 12.2 12.1 11.8 14.3 12.5

Benchmark Jest 22.4.4, 24.1.0, 23.6.0

const handlers = new WeakMap();
/*
{
[element]: {
[type]: [...handlers]
}
}
*/
function getHandlersForElement(element) {
return handlers.get(element);
#!/bin/bash
# Pre-commit Git hook to run JSHint on JavaScript files.
#
# If you absolutely must commit without testing,
# use: git commit --no-verify
passed=1
filenames=($(git diff --cached --name-only HEAD))
which jshint &> /dev/null

Keybase proof

I hereby claim:

  • I am deleteme on github.
  • I am deleteme (https://keybase.io/deleteme) on keybase.
  • I have a public key whose fingerprint is 6C75 C5B3 540B 01AD DDD1 2181 8A68 B091 45F1 CF4A

To claim this, I am signing this object:

images = [
'http://cdn.discogs.com/yqU-8wqol13SCGfPg2sYy9gBjb4=/100x100/filters:strip_icc():format(jpeg):mode_rgb()/discogs-images/R-3996200-1351777283-1914.jpeg.jpg',
'http://cdn.discogs.com/U2oncEZe50hAlYSoFbVOkIf1Y0s=/fit-in/300x300/filters:strip_icc():format(jpeg):mode_rgb()/discogs-images/R-3578188-1440480186-6359.jpeg.jpg'
]
_preload = (src)->
new Promise (resolve, reject)->
image = document.createElement 'img'
image.src = src
image.onload = -> resolve image
# fisher yates shuffle algorithm
# http://en.wikipedia.org/wiki/Fisher–Yates_shuffle
Array::shuffle = ->
copy = @copy()
i = @length
while --i
j = Math.floor(Math.random() * (i + 1))
temp = copy[i]
copy[i] = copy[j]
copy[j] = temp
@deleteme
deleteme / parallel.coffee
Created October 6, 2014 16:35
Parallel Tests
266s Total: 131s Deploying, 126s Building, 9s in Build Queue.
126s Building
Build 100s
------------------------------------------->
Python Unit Tests
--->
@deleteme
deleteme / define.coffee
Created October 1, 2014 18:15
ds.define() registers a module under a name. The module's function is called on demand by require().
ds.define = do ->
modules = {
ds
$
_: _.noConflict()
Backbone
Breakpoints
Raven: window.Raven
key: key.noConflict()
@deleteme
deleteme / deploy.coffee
Created September 16, 2014 18:47
A proof of concept for deploying in two phases
Q = require 'q'
exec = Q.denodify require('child_process').exec
nodes = for i in [1..10]
-> exec "deploy.sh -n=#{ i }"
makeDeploySet = (start, end)
->
set = (deploy() for deploy in nodes[start..end])
$.when.apply null, set