wala / jsdelta

A delta debugger for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSDelta Cookbook

wolfgang42 opened this issue · comments

I don’t use JSDelta very often, so when I do have need for it I generally have to puzzle out how to get it do do what I want again. I'm therefore opening this issue to serve as a collection of recipes for using JSDelta in different situations.

Produce a minimal test case from a Node.js project

predicate.sh:

#!/bin/bash

cd $(dirname $1) # enter directory containing project
yarn install || exit 1 # Install dependencies, or abort with irrelevant error

yarn run some-command # The actual command under test

rm -rf node_modules/ # Delete dependencies (otherwise jsdelta tries to minimize them, too)

and to run it:

# Copy git repo, but strip git data so jsdelta doesn't spend time on it
git clone . /tmp/jsdelta-start
rm -rf /tmp/jsdelta-start/.git
# Run the minimization (note: I don't understand what the `package.json` arg does but this seems to work fine regardless)
# --msg works regardless of whether output is on stdout or stderr
yarn run jsdelta --cmd predicate.sh --msg 'error message goes here' --dir /tmp/jsdelta-start/ package.json

Feel free to open a PR with this content in a Cookbook section.