#!/bin/sh # Snippets from ts-blank-space's own test suite, captured by running it against a recording wrapper. set -e cd "$(dirname "$0")/.." tmp=$(mktemp -d) cp -R vendor/ts-blank-space/tests "$tmp/tests" for f in "$tmp"/tests/*.test.ts; do sed -i '' "s#\"../src/index.ts\"#\"$PWD/scripts/record-snippets.mjs\"#" "$f" done sed -i '' "s#\"../../src/index.ts\"#\"$PWD/scripts/record-snippets.mjs\"#" "$tmp"/tests/fixture/*.ts rm -f corpus/snippets.jsonl ln -s "$PWD/node_modules" "$tmp/node_modules" RECORD_TO="$PWD/corpus/snippets.jsonl" node --test "$tmp/tests/valid.test.ts" "$tmp/tests/errors.test.ts" >/dev/null || true sort -u corpus/snippets.jsonl -o corpus/snippets.jsonl wc -l corpus/snippets.jsonl rm -rf "$tmp"