default: test-install prep test-run

test-install:
	npm install --no-fund

prep:
	$(MAKE) -wC .. webui-dist
	$(MAKE) -wC ../service compile-currentenv

test-run:
    # GitHub Actions fails badly on the default timeout of 2000ms
	npx mocha tests --recursive -t 10000

find-flakey-tests:
	echo "Running test-run infinately"
	sh -c "while make test-run; do :; done"

find-flakey-tests-inf: test-install
	node scripts/find-flakey-tests-inf.mjs

nginx:
	podman-compose up -d nginx

clean:
	podman-compose down

getsnapshot:
	rm -rf /opt/OliveTin-snapshot/*
	gh run download -D /opt/OliveTin-snapshot/

.PHONY: default find-flakey-tests find-flakey-tests-inf prep
