Skip to content

Commit a254446

Browse files
author
mike dupont
committed
wip
now we are moving towards a test in jest using doctor
1 parent 8bc8639 commit a254446

8 files changed

+60
-17
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ flycheck_*.el
6060
# network security
6161
/network-security.data
6262

63+
/.clinic/

Dockerfile

+19-3
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,28 @@ COPY dune-project /app/dune-project
2828
RUN npm ci
2929
RUN pnpm run build
3030
RUN pnpm install jest
31+
RUN pnpm install -g clinic
32+
#RUN apt update
33+
#RUN apt install -y strace
3134

3235
COPY run-jest-tests.sh /app/run-jest-tests.sh
3336
COPY jest.config.js /app/jest.config.js
34-
35-
RUN apt update
36-
RUN apt install -y strace
37+
COPY run-integration-tests.sh /app/run-integration-tests.sh
38+
COPY run-unit-tests.sh /app/run-unit-tests.sh
39+
COPY run-all-tests.sh /app/run-all-tests.sh
40+
COPY run /app/run
41+
COPY run-debug /app/run-debug
42+
COPY run-minimal-mina-tests.sh /app/run-minimal-mina-tests.sh
43+
COPY run-ci-benchmarks.sh /app/run-ci-benchmarks.sh
44+
45+
# why?
46+
RUN ln -s /app/dist /app/src/mina-signer/dist
47+
48+
# '/app/dist/node/bindings/compiled/_node_bindings/plonk_wasm.cjs' imported from /app/dist/node/bindings/js/node/node-backend.js
49+
# found here
50+
#./src/bindings/compiled/node_bindings/plonk_wasm.cjs
51+
#./src/bindings/compiled/_node_bindings/plonk_wasm.cjs
52+
#./dist/node/bindings/compiled/_node_bindings/plonk_wasm.cjs
3753

3854
CMD [ "pnpm", "run", "test" ]
3955

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test:
2+
docker compose build
3+
docker compose up

README-dev.md

+4
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,7 @@ After the Node.js process is running, open the Chrome browser and navigate to `c
229229
`docker build . --progress=plain`
230230

231231
`docker image history o1labs/mina-local-network:compatible-latest-lightnet > history.txt`
232+
233+
`docker compose build`
234+
`docker compose run mina-local-network`
235+
`docker compose run -it mina-local-network /bin/bash`

docker-compose.yml

+1-12
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,5 @@ services:
1111
working_dir: /app
1212
cap_add:
1313
- SYS_PTRACE
14-
command: "pnpm run test"
14+
command: "bash -x /app/run-all-tests.sh"
1515
# strace -f -o /tmp/strace.txt
16-
prometheus:
17-
image: prom/prometheus
18-
volumes:
19-
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
20-
networks:
21-
- localprom
22-
ports:
23-
- 9090:9090
24-
networks:
25-
localprom:
26-
driver: bridge

run

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node --enable-source-maps --stack-trace-limit=1000 src/build/run.js $@
1+
2+
clinic doctor -- node --perf-basic-prof --enable-source-maps --stack-trace-limit=1000 src/build/run.js $@

run-all-tests.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
set +e
3+
4+
#NO_INSIGHT=true clinic doctor -- node --perf-basic-prof --enable-source-maps --stack-trace-limit=1000 ./node_modules/jest-cli/bin/jest.js
5+
#NO_INSIGHT=true clinic flame -- node --perf-basic-prof --enable-source-maps --stack-trace-limit=1000 ./node_modules/jest-cli/bin/jest.js
6+
# May Clinic.js report anonymous usage statistics to improve the tool over time?
7+
8+
#######
9+
find /app > /tmp/app-files-list.txt
10+
NO_INSIGHT=true clinic doctor -- node /usr/local/bin/pnpm run test
11+
NO_INSIGHT=true clinic doctor -- node /usr/local/bin/pnpm run test:integration
12+
NO_INSIGHT=true clinic doctor -- node /usr/local/bin/pnpm run test:unit
13+
NO_INSIGHT=true clinic doctor -- node /usr/local/bin/pnpm run test:e2e
14+
15+
#######
16+
NO_INSIGHT=true clinic flame -- node /usr/local/bin/pnpm run test
17+
NO_INSIGHT=true clinic flame -- node /usr/local/bin/pnpm run test:integration
18+
NO_INSIGHT=true clinic flame -- node /usr/local/bin/pnpm run test:unit
19+
NO_INSIGHT=true clinic flame -- node /usr/local/bin/pnpm run test:e2e
20+
21+
#clinic flame -- node index.js
22+
23+
# pnpm run test
24+
# pnpm run test:integration
25+
# pnpm run test:unit
26+
# pnpm run test:e2e

run-jest-tests.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/env bash
22
set -e
3+
set -x
34
shopt -s globstar # to expand '**' into nested directories
45

56
for f in ./src/**/*.test.ts; do
6-
NODE_OPTIONS=--experimental-vm-modules npx jest $f;
7+
#NODE_OPTIONS=--experimental-vm-modules npx jest $f;
8+
NODE_OPTIONS=--experimental-vm-modules NO_INSIGHT=true clinic flame -- node ./node_modules/.bin/jest $f
9+
NODE_OPTIONS=--experimental-vm-modules NO_INSIGHT=true clinic doctor -- node ./node_modules/.bin/jest $f
710
done

0 commit comments

Comments
 (0)