# es-abstract's own dependencies that are missing from the archive are
# embedded in /usr/share/nodejs/es-abstract/node_modules; the test suite
# requires some of them directly, so add that directory to NODE_PATH.
#
# --stack-size: the suite nests tape subtests deeply enough to overflow the
# default stack (it dies around assertion 2138 otherwise). 8000 KiB stays
# below the usual 8192 KiB ulimit.
#
# tape-compat.js: the suite needs t.assertion and t.captureFn, added in
# tape 5.8/5.9, while Debian ships tape 5.6.1.
#
# The suite emits ~229000 assertions (12 MB of TAP), so keep the raw output
# in a file and report only what is not a passing assertion.
RC=0
NODE_PATH="$(pwd)/node_modules:/usr/share/nodejs/es-abstract/node_modules" \
	node --stack-size=8000 -r ./debian/tests/pkg-js/tape-compat.js \
	/usr/bin/tape test/index.js > tap.log 2>&1 || RC=$?
grep -av '^ok ' tap.log || true
exit $RC
