Test command runs unit tests only (#689)

* Test command runs unit tests only

* Update paths in action

* Enforce branch policy

* Add passing check
This commit is contained in:
Ben Croker 2025-02-22 09:57:27 -06:00 committed by GitHub
parent 1e7f0dd8d2
commit b7caf5e41c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 36 additions and 20 deletions

View File

@ -5,16 +5,26 @@ on:
branches:
- develop
paths:
- "**/*.templ"
- "**/*.md"
- "**/*.go"
- "**/*.qtpl"
- "**/package.json"
- "**/*.ts"
- 'bundles/*.js'
- 'library/src/**/*.ts'
- 'site/smoketests/*.go'
- 'site/static/md/tests/*.md'
- '.github/workflows/tests.yml'
pull_request:
workflow_dispatch:
jobs:
enforce-branch-policy:
runs-on: ubuntu-latest
steps:
- name: Check target branch
if: github.event.pull_request.base.ref == 'main'
run: |
echo "Pull requests to the main branch are not allowed."
exit 1
- name: Check passed
if: github.event.pull_request.base.ref == 'develop'
run: echo "Pull request target branch is allowed."
tests:
runs-on: ubuntu-latest
steps:

View File

@ -166,6 +166,12 @@ tasks:
- fly deploy --local-only
test:
deps:
- support
cmds:
- go test -v github.com/starfederation/datastar/site/smoketests -run '^TestUnit' -count=1 -timeout=1m
test-all:
deps:
- support
cmds:

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestCheckboxInputArray(t *testing.T) {
func TestUnitCheckboxInputArray(t *testing.T) {
setupPageTestOnClick(t, "tests/checkbox_input_array")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestCheckboxInputChecked(t *testing.T) {
func TestUnitCheckboxInputChecked(t *testing.T) {
setupPageTestOnLoad(t, "tests/checkbox_input_checked")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestCheckboxInputDefault(t *testing.T) {
func TestUnitCheckboxInputDefault(t *testing.T) {
setupPageTestOnClick(t, "tests/checkbox_input_default")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestCheckboxInputValue(t *testing.T) {
func TestUnitCheckboxInputValue(t *testing.T) {
setupPageTestOnClick(t, "tests/checkbox_input_value")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestInputSignal(t *testing.T) {
func TestUnitInputSignal(t *testing.T) {
setupPageTestOnLoad(t, "tests/input_signal")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestInputValue(t *testing.T) {
func TestUnitInputValue(t *testing.T) {
setupPageTestOnLoad(t, "tests/input_value")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestMergeFragmentSignal(t *testing.T) {
func TestUnitMergeFragmentSignal(t *testing.T) {
setupPageTestOnClick(t, "tests/merge_fragment_signal")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestMergeFragment(t *testing.T) {
func TestUnitMergeFragment(t *testing.T) {
setupPageTestOnClick(t, "tests/merge_fragment")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestMergeFragmentWhitespace(t *testing.T) {
func TestUnitMergeFragmentWhitespace(t *testing.T) {
setupPageTestOnClick(t, "tests/merge_fragment_whitespace")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestOnLoad(t *testing.T) {
func TestUnitOnLoad(t *testing.T) {
setupPageTestOnLoad(t, "tests/on_load")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestRemoveFragment(t *testing.T) {
func TestUnitRemoveFragment(t *testing.T) {
setupPageTestOnClick(t, "tests/remove_fragment")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestSelectMultipe(t *testing.T) {
func TestUnitSelectMultipe(t *testing.T) {
setupPageTestOnSelect(t, "tests/select_multiple")
}

View File

@ -4,6 +4,6 @@ import (
"testing"
)
func TestSelectSingle(t *testing.T) {
func TestUnitSelectSingle(t *testing.T) {
setupPageTestOnSelect(t, "tests/select_single")
}

View File

@ -7,7 +7,7 @@ Tests that merging a fragment maintains whitespace.
<button id="clickable" data-on-click="@get('/tests/merge_fragment_whitespace/data')" class="btn">Merge</button>
<hr />
Result:
<code data-text="$result"></code>
<code id="result" data-text="$result"></code>
<hr />
Expected result on click: <code>1</code>
</div>