Skip to content

Commit ac03a58

Browse files
jeswrMindaugasLaganeckas
authored andcommitted
chore: fix cli tests
1 parent f656842 commit ac03a58

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ node_modules/
1111
yarn-error.log
1212
test-positive/*.out.md
1313
test-output/
14+
static-out/
1415

1516
# these are no longer used, but may still be in people's git folders
1617
fontawesome/

run-tests.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ if [ -z "$IMAGETAG" ]; then
99
echo "No image tag provided, building Docker image..."
1010
# Get the current package version from package.json
1111
VERSION=$(node -p "require('./package.json').version")
12-
IMAGETAG="mermaid-cli:test"
13-
docker build --build-arg VERSION=$VERSION -t $IMAGETAG .
12+
docker build --build-arg VERSION=$VERSION -t "mermaid-cli:test" -f DockerfileBuild .
1413
fi
1514

1615
# we must set `useMaxWidth: false` in config` to convert-svg-to-png for Percy CI
@@ -74,26 +73,25 @@ if grep -q "<br>" "./test-positive/graph-with-br.mmd.svg"; then
7473
exit 1;
7574
fi
7675

77-
# Test if --artefacts works correctly
78-
# Create the artefact directory
79-
mkdir -p $INPUT_DATA/static
76+
mkdir ./test-output/
8077

8178
# Run mmdc with --artefacts using existing test file
8279
docker run --rm -v $(pwd):/data $IMAGETAG \
8380
-i /data/test-positive/mermaid.md \
84-
--artefacts /data/$INPUT_DATA/static
81+
-o /data/test-output/mermaid-artefacts.md \
82+
--artefacts /data/static-out/
8583

8684
# Verify that the images were created in the specified path
87-
if [ ! -f "$INPUT_DATA/static/mermaid-1.png" ]; then
85+
if [ ! -f "./static-out/mermaid-artefacts-1.svg" ]; then
8886
echo "Images were not created in the specified artefact path";
8987
exit 1;
9088
fi
9189

9290
# Verify that the generated markdown file contains the correct image links
93-
if ! grep -q "![mermaid-1](static/mermaid-1.png)" "$INPUT_DATA/static/mermaid.md"; then
91+
if ! grep -q "!\[diagram\](\.\/\.\.\/static-out\/mermaid-artefacts-1\.svg)" "./test-output/mermaid-artefacts.md"; then
9492
echo "Generated markdown file does not contain the correct image links";
9593
exit 1;
9694
fi
9795

9896
# Clean up
99-
rm -rf $INPUT_DATA/static
97+
rm -rf ./static-out/

0 commit comments

Comments
 (0)