Skip to content

Commit

Permalink
fix: Test script fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
deregtd committed Sep 9, 2024
1 parent 1fb3e34 commit 7dbb3ed
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
11 changes: 9 additions & 2 deletions templates/.gitignore.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ vendor
# macOS
.DS_Store

# Ignore literally everything other than the stencil.yaml file in the tests dir
# Ignore literally everything under the tests directory (except the README) -- specifically include the dir and stencil.yaml file
# for each test case in the ignores block below
tests/*
!tests/**/stencil.yaml
!tests/README.md

## <<Stencil::Block(ignores)>>
{{- if file.Block "ignores" }}
{{ file.Block "ignores" }}
{{- else }}
!tests/basic
tests/basic/*
!tests/basic/stencil.yaml
{{- end }}
## <</Stencil::Block>>
14 changes: 10 additions & 4 deletions templates/.mise.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@ nodejs = "22"
yarn = "1.22.22"

[tasks.cleantest]
description = "Clean the test directory"
dir = "test"
run = ["git clean -xdf"]
description = "Helper to clean the test directory"
dir = "tests"
run = """
#!/usr/bin/env bash
for dir in ./*/ ; do
(cd "$dir" && git clean -xdf);
done
"""

[tasks.buildtest]
description = 'Build the Test templates'
dir = "tests"
run = """
#!/usr/bin/env bash
cd tests
for dir in ./*/ ; do
(cd "$dir" && stencil);
done
"""

[tasks.runtest]
description = 'Run the tests'
dir = "tests"
## <<Stencil::Block(runTests)>>
{{- if (empty (file.Block "runTests")) }}
env = {ENV_VAR_NAME = 'hooray'} # env vars for the script
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions templates/tests/basic/stencil.yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- file.Once -}}
# yaml-language-server: $schema=https://stencil.rgst.io/static/stencil.jsonschema.json
name: {{ .Config.Name }}-test
arguments:
description: Test folder for validating changes to {{ .Config.Name }}
owner: {{ stencil.Arg "owner"}}
## <<Stencil::Block(arguments)>>
{{ file.Block "arguments" }}
## <</Stencil::Block>>
modules:
- name: github.com/udemy/{{ .Config.Name }}
replacements:
github.com/udemy/{{ .Config.Name }}: ../../

0 comments on commit 7dbb3ed

Please sign in to comment.