Skip to content

Commit

Permalink
Add maxdepth input test (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
nizarmah authored Mar 17, 2024
1 parent 225d1c6 commit 24cb985
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Test on affected directory
uses: ./
with:
directory: "tests/directory/affected/*"
directory: "tests/directory/affected"

- name: Assert not affected result does not exist
run: |
Expand All @@ -30,6 +30,29 @@ jobs:
tests/directory/affected/main.expected.js \
tests/directory/affected/main.min.js
maxdepth:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Test on shallow maxdepth
uses: ./
with:
directory: "tests/maxdepth"
maxdepth: 1

- name: Assert shallow result matches expected
run: |
git diff --exit-code --no-index \
tests/maxdepth/main.expected.js \
tests/maxdepth/main.min.js
- name: Assert deep result does not exist
run: |
! test -e tests/maxdepth/not-affected/main.min.js
overwrite:
runs-on: ubuntu-latest

Expand All @@ -40,7 +63,7 @@ jobs:
- name: Test overwrite
uses: ./
with:
directory: "tests/overwrite/*"
directory: "tests/overwrite"
overwrite: true

- name: Assert overwrite result matches expected
Expand Down
1 change: 1 addition & 0 deletions tests/maxdepth/main.expected.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions tests/maxdepth/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function print_hello() {
console.log('hello world from maxdepth');
}

window.addEventListener('load', function () {
print_hello();
});
7 changes: 7 additions & 0 deletions tests/maxdepth/not-affected/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function print_hello() {
console.log('hello world from maxdepth/not-affected');
}

window.addEventListener('load', function () {
print_hello();
});

0 comments on commit 24cb985

Please sign in to comment.