Repository: helm-unittest/helm-unittest

Issue:
skipEmptyTemplate fails when no matching templates are found
**Describe the bug**
I want to assert certain things in templates _if they exist_. For example, if you use an `ExternalSecret`, it must follow certain conventions. If you don't, the test should just quietly be ignored.

This is how I understood `skipEmptyTemplates` so far - if you don't find any matching documents, just skip asserting anything in them. However, the test fails with:

```
Expected to equal:
	<whatever you're asserting>
Actual:
	no manifest found
```

**To Reproduce**
Run a test for something that isn't contained in the chart you're testing against, e.g.:

```
suite: ExternalSecrets
templates:
  - templates/*.y*ml
tests:
  - it: ExternalSecret should use correct target policies
    documentSelector:
      path: kind
      value: ExternalSecret
      skipEmptyTemplates: true
    asserts:
    - equal:
        path: spec.target.creationPolicy
        value: Owner
```

**Expected behavior**
The test '_ExternalSecret should use correct target policies_' should not be run or at the least, shouldn't fail.

**Desktop (please complete the following information):**
 - OS: Mac 15.3.2
 - Plugin Version: 0.8.0

**Additional context**
Reasoning: We have a whole set of tests we run against the developers' projects to enforce certain best practices, but not every project uses the same set of helm templates - so not all tests are relevant for each helm chart.

Hints from issue comments:
@ivankatliarchuk: Could you share manifests as well. For sucess and failed cases@chlab: @ivankatliarchuk sure, here's a complete reproduction of the test succeeding and failing, depending on which templates are found: https://github.com/chlab/helmunittest-skipemptytemplates
@ivankatliarchuk: Understood. So desired behaviour, when no templates found is to skip test execution, instead of failing it

```
documentSelector:
      path: kind
      value: ExternalSecret
      skipEmptyTemplates: true
```
@chlab: That's how I would interpret it, yes. Or maybe via a new flag `optional` or something.@ivankatliarchuk: I do not think if another flag is required. Make sense to skip all assertions if `skipEmptyTemplates == true` and there are no templates to assert....

Solution patch:
diff --git a/internal/common/debug.go b/internal/common/debug.go
index c531985..7cb9fde 100644
--- a/internal/common/debug.go
+++ b/internal/common/debug.go
@@ -1,3 +1,4 @@
 package common
 
 const LOG_TEST_SUITE = "test-suite"
+const LOG_TEST_ASSERTION = "test-assertion"



Test patch:
diff --git a/pkg/unittest/.snapshots/TestV3RunJobOk b/pkg/unittest/.snapshots/TestV3RunJobOk
index 176c28b..2ec14bc 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobOk
+++ b/pkg/unittest/.snapshots/TestV3RunJobOk
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
@@ -19,6 +21,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=10) "matchRegex",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithAssertionFail b/pkg/unittest/.snapshots/TestV3RunJobWithAssertionFail
index 435ba71..85955bd 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithAssertionFail
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithAssertionFail
@@ -24,6 +24,8 @@
         (string) (len=12) "\t+Deployment"
       },
       Passed: (bool) false,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
@@ -41,6 +43,8 @@
         (string) (len=19) "\tRELEASE-NAME-basic"
       },
       Passed: (bool) false,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=10) "matchRegex",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithAssertionFailFast b/pkg/unittest/.snapshots/TestV3RunJobWithAssertionFailFast
index 5781601..c2ef7c0 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithAssertionFailFast
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithAssertionFailFast
@@ -24,6 +24,8 @@
         (string) (len=12) "\t+Deployment"
       },
       Passed: (bool) false,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithCapabilitySettings b/pkg/unittest/.snapshots/TestV3RunJobWithCapabilitySettings
index 686b995..cfc193f 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithCapabilitySettings
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithCapabilitySettings
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=12) "hasDocuments",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithChartSettings b/pkg/unittest/.snapshots/TestV3RunJobWithChartSettings
index a98a168..2f4abea 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithChartSettings
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithChartSettings
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
@@ -19,6 +21,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithFailingTemplate b/pkg/unittest/.snapshots/TestV3RunJobWithFailingTemplate
index 658a6dc..832043e 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithFailingTemplate
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithFailingTemplate
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=14) "failedTemplate",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithNoCapabilitySettingsEmptyDoc b/pkg/unittest/.snapshots/TestV3RunJobWithNoCapabilitySettingsEmptyDoc
index 686b995..cfc193f 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithNoCapabilitySettingsEmptyDoc
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithNoCapabilitySettingsEmptyDoc
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=12) "hasDocuments",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithReleaseSettings b/pkg/unittest/.snapshots/TestV3RunJobWithReleaseSettings
index b0baa7e..6211f8e 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithReleaseSettings
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithReleaseSettings
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithRenderPathOk b/pkg/unittest/.snapshots/TestV3RunJobWithRenderPathOk
index 176c28b..2ec14bc 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithRenderPathOk
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithRenderPathOk
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
@@ -19,6 +21,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=10) "matchRegex",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithSchema b/pkg/unittest/.snapshots/TestV3RunJobWithSchema
index 9cd3512..83f7d98 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithSchema
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithSchema
@@ -13,6 +13,8 @@ with-schema:
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=14) "failedTemplate",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithSchemaAndNullValue b/pkg/unittest/.snapshots/TestV3RunJobWithSchemaAndNullValue
index ad5a1d7..3741c94 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithSchemaAndNullValue
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithSchemaAndNullValue
@@ -13,6 +13,8 @@ with-schema:
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=14) "failedTemplate",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithSchemaOk b/pkg/unittest/.snapshots/TestV3RunJobWithSchemaOk
index 6c55dc2..4332aee 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithSchemaOk
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithSchemaOk
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=17) "notFailedTemplate",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithTestJobDocumentSelectorOk b/pkg/unittest/.snapshots/TestV3RunJobWithTestJobDocumentSelectorOk
index 176c28b..2ec14bc 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithTestJobDocumentSelectorOk
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithTestJobDocumentSelectorOk
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
@@ -19,6 +21,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=10) "matchRegex",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithTestJobTemplateOk b/pkg/unittest/.snapshots/TestV3RunJobWithTestJobTemplateOk
index 176c28b..2ec14bc 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithTestJobTemplateOk
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithTestJobTemplateOk
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
@@ -19,6 +21,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=10) "matchRegex",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithTestJobTemplatesOk b/pkg/unittest/.snapshots/TestV3RunJobWithTestJobTemplatesOk
index f1e4dca..d0bdd94 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithTestJobTemplatesOk
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithTestJobTemplatesOk
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
@@ -19,6 +21,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
@@ -28,6 +32,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=6) "exists",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithTestMissingRequiredValueOk b/pkg/unittest/.snapshots/TestV3RunJobWithTestMissingRequiredValueOk
index bb30685..8eb5687 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithTestMissingRequiredValueOk
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithTestMissingRequiredValueOk
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=14) "failedTemplate",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithTooLongReleaseName b/pkg/unittest/.snapshots/TestV3RunJobWithTooLongReleaseName
index 3b8a97c..3170218 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithTooLongReleaseName
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithTooLongReleaseName
@@ -12,6 +12,8 @@
         (string) (len=84) "\ttemplate \"basic/templates/crd_backup.yaml\" not exists or not selected in test suite"
       },
       Passed: (bool) false,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=12) "hasDocuments",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithValueSet b/pkg/unittest/.snapshots/TestV3RunJobWithValueSet
index b0baa7e..6211f8e 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithValueSet
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithValueSet
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunJobWithValuesFile b/pkg/unittest/.snapshots/TestV3RunJobWithValuesFile
index b0baa7e..6211f8e 100644
--- a/pkg/unittest/.snapshots/TestV3RunJobWithValuesFile
+++ b/pkg/unittest/.snapshots/TestV3RunJobWithValuesFile
@@ -10,6 +10,8 @@
       FailInfo: ([]string) {
       },
       Passed: (bool) true,
+      Skipped: (bool) false,
+      SkipReason: (string) "",
       AssertType: (string) (len=5) "equal",
       Not: (bool) false,
       CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteNameOverrideFail b/pkg/unittest/.snapshots/TestV3RunSuiteNameOverrideFail
index d87bad5..b5b65c9 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteNameOverrideFail
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteNameOverrideFail
@@ -18,6 +18,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=14) "failedTemplate",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteWhenFail b/pkg/unittest/.snapshots/TestV3RunSuiteWhenFail
index 9cfd51c..4746c07 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteWhenFail
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteWhenFail
@@ -32,6 +32,8 @@
             (string) (len=12) "\t+Deployment"
           },
           Passed: (bool) false,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=5) "equal",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteWhenPass b/pkg/unittest/.snapshots/TestV3RunSuiteWhenPass
index c17a572..5e0614d 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteWhenPass
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteWhenPass
@@ -18,6 +18,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=5) "equal",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -27,6 +29,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=13) "matchSnapshot",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteWithMultipleTemplatesWhenPass b/pkg/unittest/.snapshots/TestV3RunSuiteWithMultipleTemplatesWhenPass
index 33afb15..6243f4f 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteWithMultipleTemplatesWhenPass
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteWithMultipleTemplatesWhenPass
@@ -18,6 +18,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=10) "matchRegex",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -27,6 +29,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=5) "equal",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -36,6 +40,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=10) "matchRegex",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -45,6 +51,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=5) "equal",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -54,6 +62,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=5) "equal",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -63,6 +73,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=13) "matchSnapshot",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteWithOverridesWhenPass b/pkg/unittest/.snapshots/TestV3RunSuiteWithOverridesWhenPass
index 43aac38..1750f13 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteWithOverridesWhenPass
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteWithOverridesWhenPass
@@ -18,6 +18,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=12) "hasDocuments",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -27,6 +29,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=13) "matchSnapshot",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsTrimmingWhenPass b/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsTrimmingWhenPass
index bf3028e..216690b 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsTrimmingWhenPass
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsTrimmingWhenPass
@@ -18,6 +18,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=17) "notFailedTemplate",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsWhenPass b/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsWhenPass
index d83f885..3fa576b 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsWhenPass
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsWhenPass
@@ -18,6 +18,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=5) "equal",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -27,6 +29,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=13) "matchSnapshot",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsWithAliasWhenPass b/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsWithAliasWhenPass
index 7458f77..cfa85f1 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsWithAliasWhenPass
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteWithSubChartsWithAliasWhenPass
@@ -18,6 +18,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=5) "equal",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -27,6 +29,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=13) "matchSnapshot",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -46,6 +50,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=12) "hasDocuments",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunSuiteWithSubfolderWhenPass b/pkg/unittest/.snapshots/TestV3RunSuiteWithSubfolderWhenPass
index c17a572..5e0614d 100644
--- a/pkg/unittest/.snapshots/TestV3RunSuiteWithSubfolderWhenPass
+++ b/pkg/unittest/.snapshots/TestV3RunSuiteWithSubfolderWhenPass
@@ -18,6 +18,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=5) "equal",
           Not: (bool) false,
           CustomInfo: (string) ""
@@ -27,6 +29,8 @@
           FailInfo: ([]string) {
           },
           Passed: (bool) true,
+          Skipped: (bool) false,
+          SkipReason: (string) "",
           AssertType: (string) (len=13) "matchSnapshot",
           Not: (bool) false,
           CustomInfo: (string) ""
diff --git a/pkg/unittest/.snapshots/TestV3RunnerOkWithAbsoluteOverrideValuesPassedTests b/pkg/unittest/.snapshots/TestV3RunnerOkWithAbsoluteOverrideValuesPassedTests
index a920710..11e856e 100644
--- a/pkg/unittest/.snapshots/TestV3RunnerOkWithAbsoluteOverrideValuesPassedTests
+++ b/pkg/unittest/.snapshots/TestV3RunnerOkWithAbsoluteOverrideValuesPassedTests
@@ -23,7 +23,7 @@
 
 Charts:      1 passed, 1 total
 Test Suites: 14 passed, 1 skipped, 15 total
-Tests:       42 passed, 2 skipped, 44 total
+Tests:       44 passed, 2 skipped, 46 total
 Snapshot:    4 passed, 4 total
 Time:        XX.XXXms
 
diff --git a/pkg/unittest/.snapshots/TestV3RunnerOkWithDocumentSelector b/pkg/unittest/.snapshots/TestV3RunnerOkWithDocumentSelector
index 5d6dd3e..b316259 100644
--- a/pkg/unittest/.snapshots/TestV3RunnerOkWithDocumentSelector
+++ b/pkg/unittest/.snapshots/TestV3RunnerOkWithDocumentSelector
@@ -9,11 +9,12 @@
  PASS  Document Selector to match any template	../../test/data/v3/with-document-select/tests/any_template_test.yaml
  PASS  Document Selector using expression	../../test/data/v3/with-document-select/tests/foo_rbac_test.yaml
  PASS  Document Selector validation with object validation	../../test/data/v3/with-document-select/tests/top_level_test.yaml
+ PASS  skipEmptyTemplates correctly handle 'true' case	../../test/data/v3/with-document-select/tests/external-secrets_test.yaml
 
 
 Charts:      1 passed, 1 total
-Test Suites: 7 passed, 7 total
-Tests:       10 passed, 10 total
+Test Suites: 8 passed, 8 total
+Tests:       13 passed, 13 total
 Snapshot:    1 passed, 1 total
 Time:        XX.XXXms
 
diff --git a/pkg/unittest/.snapshots/TestV3RunnerOkWithOverrideValuesPassedTests b/pkg/unittest/.snapshots/TestV3RunnerOkWithOverrideValuesPassedTests
index a920710..11e856e 100644
--- a/pkg/unittest/.snapshots/TestV3RunnerOkWithOverrideValuesPassedTests
+++ b/pkg/unittest/.snapshots/TestV3RunnerOkWithOverrideValuesPassedTests
@@ -23,7 +23,7 @@
 
 Charts:      1 passed, 1 total
 Test Suites: 14 passed, 1 skipped, 15 total
-Tests:       42 passed, 2 skipped, 44 total
+Tests:       44 passed, 2 skipped, 46 total
 Snapshot:    4 passed, 4 total
 Time:        XX.XXXms
 
diff --git a/pkg/unittest/.snapshots/TestV3RunnerOkWithPassedTests b/pkg/unittest/.snapshots/TestV3RunnerOkWithPassedTests
index a920710..11e856e 100644
--- a/pkg/unittest/.snapshots/TestV3RunnerOkWithPassedTests
+++ b/pkg/unittest/.snapshots/TestV3RunnerOkWithPassedTests
@@ -23,7 +23,7 @@
 
 Charts:      1 passed, 1 total
 Test Suites: 14 passed, 1 skipped, 15 total
-Tests:       42 passed, 2 skipped, 44 total
+Tests:       44 passed, 2 skipped, 46 total
 Snapshot:    4 passed, 4 total
 Time:        XX.XXXms
 
diff --git a/pkg/unittest/assertion.go b/pkg/unittest/assertion.go
index d63fcce..00ff8b8 100644
--- a/pkg/unittest/assertion.go
+++ b/pkg/unittest/assertion.go
@@ -12,6 +12,7 @@ import (
 	"github.com/helm-unittest/helm-unittest/pkg/unittest/valueutils"
 
 	"github.com/mitchellh/mapstructure"
+	log "github.com/sirupsen/logrus"
 )
 
 // Assertion defines target and metrics to validate rendered result
@@ -50,28 +51,9 @@ func (a *Assertion) Assert(
 	assertionPassed := false
 	failInfo := make([]string, 0)
 
-	var templates = a.configOrDefault().templatesResult
-
-	// If we PostRendered, there's no guarantee the post-renderer will preserve our file mapping.  If it doesn't, the
-	// parser just puts the whole manifest in one "manifest.yaml" so handle that case:
-	if a.configOrDefault().didPostRender && len(a.configOrDefault().templatesResult) == 1 {
-		var key string
-		for k := range a.configOrDefault().templatesResult {
-			key = k
-		}
-
-		// account for pathname prefix
-		if strings.HasSuffix(key, "manifest.yaml") {
-			a.Template = key
-			templates = make(map[string][]common.K8sManifest)
-			templates[key] = a.configOrDefault().templatesResult[key]
-		} else {
-			templates = a.getDocumentsByDefaultTemplates(a.configOrDefault().templatesResult)
-		}
-	} else {
-		templates = a.getDocumentsByDefaultTemplates(a.configOrDefault().templatesResult)
-	}
+	var templates = a.computeTemplatesWithPostRender()
 
+	// TODO: This could be optimised and computed once for the test suite
 	selectedDocsByTemplate, indexError := a.selectDocumentsForAssertion(templates)
 	selectedTemplates := a.getKeys(selectedDocsByTemplate)
 
@@ -82,6 +64,15 @@ func (a *Assertion) Assert(
 		invalidDocumentIndex := []string{"Error:", indexError.Error()}
 		failInfo = append(failInfo, invalidDocumentIndex...)
 	} else {
+
+		if a.configOrDefault().isSkipEmptyTemplate && len(selectedTemplates) == 0 {
+			result.Skipped = true
+			result.SkipReason = "skipped as 'documentSelector.skipEmptyTemplates: true' and 'selectedTemplates: empty'"
+			result.Passed = true
+			log.WithField(common.LOG_TEST_ASSERTION, "assert").Debugln("skip assertion", result.SkipReason)
+			return result
+		}
+
 		// Check for failed templates when no documents are found
 		if len(selectedTemplates) == 0 {
 			var validatePassed bool
@@ -292,6 +283,27 @@ func (a *Assertion) constructValidator(assertDef map[string]interface{}) error {
 	return nil
 }
 
+func (a *Assertion) computeTemplatesWithPostRender() map[string][]common.K8sManifest {
+	// If we PostRendered, there's no guarantee the post-renderer will preserve our file mapping.  If it doesn't, the
+	// parser just puts the whole manifest in one "manifest.yaml" so handle that case:
+	var templates map[string][]common.K8sManifest
+	templatesResult := a.configOrDefault().templatesResult
+	if a.configOrDefault().didPostRender && len(templatesResult) == 1 {
+		for key := range templatesResult {
+			if strings.HasSuffix(key, "manifest.yaml") {
+				a.Template = key
+				templates = map[string][]common.K8sManifest{key: templatesResult[key]}
+			} else {
+				templates = a.getDocumentsByDefaultTemplates(templatesResult)
+			}
+			break
+		}
+	} else {
+		templates = a.getDocumentsByDefaultTemplates(templatesResult)
+	}
+	return templates
+}
+
 type assertTypeDef struct {
 	validatorType       reflect.Type
 	antonym             bool
diff --git a/pkg/unittest/assertion_test.go b/pkg/unittest/assertion_test.go
index 6d7fdfa..b51670d 100644
--- a/pkg/unittest/assertion_test.go
+++ b/pkg/unittest/assertion_test.go
@@ -7,6 +7,7 @@ import (
 	. "github.com/helm-unittest/helm-unittest/pkg/unittest"
 	"github.com/helm-unittest/helm-unittest/pkg/unittest/results"
 	"github.com/helm-unittest/helm-unittest/pkg/unittest/snapshot"
+	"github.com/helm-unittest/helm-unittest/pkg/unittest/valueutils"
 	"github.com/stretchr/testify/assert"
 )
 
@@ -78,6 +79,8 @@ func TestAssertionUnmarshalFromYAML(t *testing.T) {
 - notFailedTemplate:
 - containsDocument:
 - lengthEqual:
+- matchSnapshot:
+- matchSnapshotRaw:
 `
 
 	a := assert.New(t)
@@ -348,7 +351,6 @@ equal:
 		SnapshotComparer: fakeSnapshotComparer(true),
 		RenderSucceed:    true,
 	}
-
 	assertion.WithConfig(cfg.Build())
 	result := assertion.Assert(&results.AssertionResult{Index: 0})
 	a.Equal(&results.AssertionResult{
@@ -515,7 +517,6 @@ func TestAssertionAssertWhenTemplateNotSpecifiedAndNoDefault(t *testing.T) {
 	common.YmlUnmarshalTestHelper(assertionYAML, &assertion, t)
 
 	a := assert.New(t)
-
 	cfg := AssertionConfigBuilder{
 		TemplatesResult:  renderedMap,
 		SnapshotComparer: fakeSnapshotComparer(true),
@@ -547,7 +548,6 @@ equal:
 	common.YmlUnmarshalTestHelper(assertionYAML, &assertion, t)
 
 	a := assert.New(t)
-
 	cfg := AssertionConfigBuilder{
 		TemplatesResult:  renderedMap,
 		SnapshotComparer: fakeSnapshotComparer(true),
@@ -564,3 +564,50 @@ equal:
 		CustomInfo: "",
 	}, result)
 }
+
+func TestAssertionWithSkippedDocument(t *testing.T) {
+	manifestDoc := `
+kind: Fake
+apiVersion: v123
+a: b
+e:
+  f: g
+x:
+`
+	manifest := common.TrustedUnmarshalYAML(manifestDoc)
+	renderedMap := map[string][]common.K8sManifest{
+		"t.yaml": {manifest},
+	}
+	assertionsYAML := `
+- template: t.yaml
+  equal:
+    path:  a
+    value: b
+- template: t.yaml
+  notEqual:
+    path:  a
+    value: c
+`
+	assertions := make([]Assertion, 2)
+	common.YmlUnmarshalTestHelper(assertionsYAML, &assertions, t)
+
+	ds := &valueutils.DocumentSelector{
+		Path:               "kind",
+		Value:              "NotExist",
+		SkipEmptyTemplates: true,
+	}
+	cfg := AssertionConfigBuilder{
+		TemplatesResult:     renderedMap,
+		SnapshotComparer:    fakeSnapshotComparer(true),
+		RenderSucceed:       true,
+		IsSkipEmptyTemplate: ds.SkipEmptyTemplates,
+	}
+	for _, assertion := range assertions {
+		assertion.DocumentSelector = ds
+		assertion.WithConfig(cfg.Build())
+
+		result := assertion.Assert(&results.AssertionResult{Index: 0})
+		assert.True(t, result.Passed)
+		assert.True(t, result.Skipped)
+	}
+}
diff --git a/pkg/unittest/models.go b/pkg/unittest/models.go
index ac9dac3..55b6d1c 100644
--- a/pkg/unittest/models.go
+++ b/pkg/unittest/models.go
@@ -4,24 +4,27 @@ import (
 	"github.com/helm-unittest/helm-unittest/internal/common"
 	"github.com/helm-unittest/helm-unittest/pkg/unittest/snapshot"
 	"github.com/helm-unittest/helm-unittest/pkg/unittest/validators"
+	"github.com/helm-unittest/helm-unittest/pkg/unittest/valueutils"
 	v3chart "helm.sh/helm/v3/pkg/chart"
 )
 
 type TestConfig struct {
-	targetChart  *v3chart.Chart
-	cache        *snapshot.Cache
-	renderPath   string
-	failFast     bool
-	postRenderer PostRendererConfig
+	targetChart         *v3chart.Chart
+	cache               *snapshot.Cache
+	renderPath          string
+	failFast            bool
+	isSkipEmptyTemplate bool
+	postRenderer        PostRendererConfig
 }
 
 func NewTestConfig(chart *v3chart.Chart, cache *snapshot.Cache, options ...func(*TestConfig)) *TestConfig {
 	config := &TestConfig{
-		targetChart:  chart,
-		cache:        cache,
-		renderPath:   "",
-		failFast:     false,
-		postRenderer: PostRendererConfig{},
+		targetChart:         chart,
+		cache:               cache,
+		renderPath:          "",
+		failFast:            false,
+		isSkipEmptyTemplate: false,
+		postRenderer:        PostRendererConfig{},
 	}
 	for _, option := range options {
 		option(config)
@@ -43,38 +46,57 @@ func WithRenderPath(path string) LoadTestOptionsFunc {
 	}
 }
 
+func WithDocumentSelector(selector *valueutils.DocumentSelector) LoadTestOptionsFunc {
+	return func(c *TestConfig) {
+		if selector != nil {
+			c.isSkipEmptyTemplate = selector.SkipEmptyTemplates
+		} else {
+			c.isSkipEmptyTemplate = false
+		}
+	}
+}
+
 func WithPostRendererConfig(config PostRendererConfig) LoadTestOptionsFunc {
 	return func(c *TestConfig) {
 		c.postRenderer = config
 	}
 }
 
+func WithSkipEmptyTemplate(config bool) LoadTestOptionsFunc {
+	return func(c *TestConfig) {
+		c.isSkipEmptyTemplate = config
+	}
+}
+
 type AssertionConfig struct {
-	templatesResult  map[string][]common.K8sManifest
-	snapshotComparer validators.SnapshotComparer
-	renderSucceed    bool
-	failFast         bool
-	didPostRender    bool
-	renderError      error
+	templatesResult     map[string][]common.K8sManifest
+	snapshotComparer    validators.SnapshotComparer
+	renderSucceed       bool
+	failFast            bool
+	isSkipEmptyTemplate bool
+	didPostRender       bool
+	renderError         error
 }
 
 // AssertionConfigBuilder Required to simplify tests
 type AssertionConfigBuilder struct {
-	TemplatesResult  map[string][]common.K8sManifest
-	SnapshotComparer validators.SnapshotComparer
-	RenderSucceed    bool
-	FailFast         bool
-	DidPostRender    bool
-	RenderError      error
+	TemplatesResult     map[string][]common.K8sManifest
+	SnapshotComparer    validators.SnapshotComparer
+	RenderSucceed       bool
+	FailFast            bool
+	DidPostRender       bool
+	RenderError         error
+	IsSkipEmptyTemplate bool
 }
 
 func (b AssertionConfigBuilder) Build() AssertionConfig {
 	return AssertionConfig{
-		templatesResult:  b.TemplatesResult,
-		snapshotComparer: b.SnapshotComparer,
-		renderSucceed:    b.RenderSucceed,
-		failFast:         b.FailFast,
-		didPostRender:    b.DidPostRender,
-		renderError:      b.RenderError,
+		templatesResult:     b.TemplatesResult,
+		snapshotComparer:    b.SnapshotComparer,
+		renderSucceed:       b.RenderSucceed,
+		failFast:            b.FailFast,
+		didPostRender:       b.DidPostRender,
+		renderError:         b.RenderError,
+		isSkipEmptyTemplate: b.IsSkipEmptyTemplate,
 	}
 }
diff --git a/pkg/unittest/models_test.go b/pkg/unittest/models_test.go
index 8cf60ed..1dca564 100644
--- a/pkg/unittest/models_test.go
+++ b/pkg/unittest/models_test.go
@@ -5,6 +5,7 @@ import (
 
 	"github.com/helm-unittest/helm-unittest/internal/common"
 	"github.com/helm-unittest/helm-unittest/pkg/unittest/snapshot"
+	"github.com/helm-unittest/helm-unittest/pkg/unittest/valueutils"
 	"github.com/stretchr/testify/assert"
 	v3chart "helm.sh/helm/v3/pkg/chart"
 )
@@ -47,6 +48,16 @@ func TestWithPostRendererConfig(t *testing.T) {
 	assert.Equal(t, postRendererConfig, config.postRenderer)
 }
 
+func TestWithDocumentSelector(t *testing.T) {
+	chart := &v3chart.Chart{}
+	config := NewTestConfig(chart, nil, WithDocumentSelector(&valueutils.DocumentSelector{
+		SkipEmptyTemplates: true,
+	}))
+	assert.True(t, config.isSkipEmptyTemplate)
+	config = NewTestConfig(chart, nil, WithDocumentSelector(nil))
+	assert.False(t, config.isSkipEmptyTemplate)
+}
+
 func TestAssertionConfigBuilder(t *testing.T) {
 	builder := AssertionConfigBuilder{
 		TemplatesResult:  map[string][]common.K8sManifest{},
diff --git a/pkg/unittest/results/assertion_result.go b/pkg/unittest/results/assertion_result.go
index bb47b87..8e39dc6 100644
--- a/pkg/unittest/results/assertion_result.go
+++ b/pkg/unittest/results/assertion_result.go
@@ -11,6 +11,8 @@ type AssertionResult struct {
 	Index      int
 	FailInfo   []string
 	Passed     bool
+	Skipped    bool
+	SkipReason string
 	AssertType string
 	Not        bool
 	CustomInfo string
diff --git a/pkg/unittest/test_job.go b/pkg/unittest/test_job.go
index e4c4ccc..a9b9abc 100644
--- a/pkg/unittest/test_job.go
+++ b/pkg/unittest/test_job.go
@@ -42,13 +42,16 @@ const regexPattern string = "(?msU)^(?:.+: |.+ \\()(?:(.+):\\d+:\\d+).+(?:.+>)*:
 const fileKeyPrefix = "#### file:"
 const yamlFileSeparator = "---\n" + fileKeyPrefix
 
+var (
+	regexPostRenderPattern = regexp.MustCompile(fileKeyPrefix + ` (.*)`)
+	regexErrorPattern      = regexp.MustCompile(regexPattern)
+)
+
 type PostRendererConfig struct {
 	Cmd      string   `yaml:"cmd"`
 	ArgSlice []string `yaml:"args"`
 }
 
-var regexErrorPattern = regexp.MustCompile(regexPattern)
-
 func spliteChartRoutes(routePath string) []string {
 	splited := strings.Split(routePath, string(filepath.Separator))
 	routes := make([]string, len(splited)/2+1)
@@ -267,13 +270,11 @@ func (t *TestJob) RunV3(
 		return result
 	}
 
-	// TODO: this is a bit of a hack.  we should be able to pass the chart name in the config
 	manifestsOfFiles, err := t.parseManifestsFromOutputOfFiles(postRenderedManifestsOfFiles)
 	if err != nil {
 		result.ExecError = err
 		return result
 	}
-	// Setup Assertion Templates based on the chartname, documentIndex and outputOfFiles
 	t.polishAssertionsTemplate(t.configOrDefault().targetChart.Name(), outputOfFiles)
 
 	if t.Skip.Reason != "" {
@@ -285,16 +286,16 @@ func (t *TestJob) RunV3(
 	snapshotComparer := &orderedSnapshotComparer{cache: t.configOrDefault().cache, test: t.Name}
 
 	assertionsConfig := AssertionConfig{
-		templatesResult:  manifestsOfFiles,
-		snapshotComparer: snapshotComparer,
-		renderSucceed:    renderSucceed,
-		failFast:         t.configOrDefault().failFast,
-		didPostRender:    didPostRender,
-		renderError:      renderError,
+		templatesResult:     manifestsOfFiles,
+		snapshotComparer:    snapshotComparer,
+		renderSucceed:       renderSucceed,
+		failFast:            t.configOrDefault().failFast,
+		didPostRender:       didPostRender,
+		renderError:         renderError,
+		isSkipEmptyTemplate: t.configOrDefault().isSkipEmptyTemplate,
 	}
 
 	result.Passed, result.AssertsResult = t.runAssertions(assertionsConfig)
-
 	result.Duration = time.Since(startTestRun)
 	return result
 }
@@ -400,7 +401,7 @@ func (t *TestJob) renderV3Chart(userValues []byte) (map[string]string, bool, err
 	return outputOfFiles, renderSucceed, nil
 }
 
-// merge the map into a single file, post-render it, and split it out again
+// MergeAndPostRender merge the map into a single file, post-render it, and split it out again
 func MergeAndPostRender(renderedManifestsMap map[string]string, postRenderer postrender.PostRenderer) (*bytes.Buffer, error) {
 	var renderedManifests bytes.Buffer
 
@@ -431,7 +432,6 @@ func SplitManifests(renderedManifests *bytes.Buffer) map[string]string {
 	postRenderedManifestsString := renderedManifests.String()
 
 	postRenderedManifestsMap := make(map[string]string)
-	re := regexp.MustCompile(fileKeyPrefix + ` (.*)`)
 
 	fileBlocks := common.SplitBefore(postRenderedManifestsString, yamlFileSeparator)
 
@@ -442,7 +442,7 @@ func SplitManifests(renderedManifests *bytes.Buffer) map[string]string {
 			continue
 		}
 
-		match := re.FindStringSubmatch(block)
+		match := regexPostRenderPattern.FindStringSubmatch(block)
 
 		if match == nil || len(match) < 2 {
 			continue
@@ -611,6 +611,10 @@ func (t *TestJob) runAssertions(
 			&results.AssertionResult{Index: idx},
 		)
 
+		if result.Skipped {
+			testPass = true
+		}
+
 		assertsResult = append(assertsResult, result)
 
 		if idx == 0 {
diff --git a/pkg/unittest/test_job_test.go b/pkg/unittest/test_job_test.go
index bfdc5fc..c7965c7 100644
--- a/pkg/unittest/test_job_test.go
+++ b/pkg/unittest/test_job_test.go
@@ -7,6 +7,7 @@ import (
 	"os"
 	"path"
 
+	"github.com/helm-unittest/helm-unittest/pkg/unittest/valueutils"
 	"github.com/stretchr/testify/mock"
 
 	"testing"
@@ -253,7 +254,6 @@ asserts:
 `
 	var tj TestJob
 	common.YmlUnmarshalTestHelper(manifest, &tj, t)
-
 	cfg := NewTestConfig(c, &snapshot.Cache{},
 		WithFailFast(true),
 	)
@@ -321,7 +321,6 @@ asserts:
 		WithFailFast(true),
 	))
 	testResult := tj.RunV3(&results.TestJobResult{})
-	// Write Buffer
 
 	a := assert.New(t)
 	cupaloy.SnapshotT(t, makeTestJobResultSnapshotable(testResult))
@@ -381,7 +380,6 @@ asserts:
 
 	var tj TestJob
 	common.YmlUnmarshalTestHelper(fmt.Sprintf(manifest, file), &tj, t)
-
 	tj.WithConfig(*NewTestConfig(c, &snapshot.Cache{},
 		WithFailFast(true),
 	))
@@ -436,7 +434,6 @@ asserts:
 `
 	var tj TestJob
 	common.YmlUnmarshalTestHelper(manifest, &tj, t)
-
 	cfg := NewTestConfig(c, &snapshot.Cache{},
 		WithFailFast(true),
 	)
@@ -628,7 +625,6 @@ asserts:
 `
 	var tj TestJob
 	common.YmlUnmarshalTestHelper(manifest, &tj, t)
-
 	tj.WithConfig(*NewTestConfig(c, &snapshot.Cache{},
 		WithFailFast(true),
 	))
@@ -686,7 +682,6 @@ asserts:
 		WithFailFast(true),
 	))
 	testResult := tj.RunV3(&results.TestJobResult{})
-
 	cupaloy.SnapshotT(t, makeTestJobResultSnapshotable(testResult))
 
 	a := assert.New(t)
@@ -765,7 +760,6 @@ asserts:
 `
 	var tj TestJob
 	unmarshalJobTestHelper(manifest, &tj, t)
-
 	tj.WithConfig(*NewTestConfig(c, &snapshot.Cache{},
 		WithFailFast(true),
 	))
@@ -1240,8 +1234,6 @@ func Test_MergeAndPostRender(t *testing.T) {
 
 type mockPostRenderer struct {
 	mock.Mock
-	output string
-	err    error
 }
 
 func (m *mockPostRenderer) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer, error) {
@@ -1251,3 +1243,36 @@ func (m *mockPostRenderer) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer,
 	}
 	return args.Get(0).(*bytes.Buffer), args.Error(1)
 }
+
+func TestV3RunJobWithSuccessWhenNoDocumentSelectorSkipEmptyTemplateAndNoTemplatesUnderTest(t *testing.T) {
+	c, _ := loader.Load(testV3BasicChart)
+	manifest := `
+it: should work
+release:
+  name: my-release
+  namespace: test
+documentSelector:
+  path: kind
+  value: SomeKind
+  skipEmptyTemplates: true
+asserts:
+  - equal:
+      path: metadata.name
+      value: my-release-basic
+`
+	var tj TestJob
+	common.YmlUnmarshalTestHelper(manifest, &tj, t)
+
+	tj.WithConfig(*NewTestConfig(c, &snapshot.Cache{},
+		WithFailFast(true),
+		WithSkipEmptyTemplate(true),
+		WithDocumentSelector(&valueutils.DocumentSelector{
+			SkipEmptyTemplates: true,
+		}),
+	))
+	testResult := tj.RunV3(&results.TestJobResult{})
+
+	assert.Nil(t, testResult.ExecError)
+	assert.True(t, testResult.Passed)
+	assert.Equal(t, 1, len(testResult.AssertsResult))
+}
diff --git a/pkg/unittest/test_runner_test.go b/pkg/unittest/test_runner_test.go
index 7cffc94..c65261d 100644
--- a/pkg/unittest/test_runner_test.go
+++ b/pkg/unittest/test_runner_test.go
@@ -356,9 +356,9 @@ func TestV3RunnerOkWithDocumentSelect(t *testing.T) {
 	}
 	passed := runner.RunV3([]string{testV3WithDocumentSelectorChart})
 	assert.True(t, passed, buffer.String())
-	fmt.Println(buffer.String())
-	assert.Contains(t, buffer.String(), "Test Suites: 7 passed, 7 total")
-	assert.Contains(t, buffer.String(), "Tests:       10 passed, 10 total")
+
+	assert.Contains(t, buffer.String(), "Test Suites: 8 passed, 8 total")
+	assert.Contains(t, buffer.String(), "Tests:       13 passed, 13 total")
 }
 
 func TestV3RunnerOkWithTestSkipped(t *testing.T) {
diff --git a/pkg/unittest/test_suite.go b/pkg/unittest/test_suite.go
index 8929873..449dee0 100644
--- a/pkg/unittest/test_suite.go
+++ b/pkg/unittest/test_suite.go
@@ -383,7 +383,6 @@ func (s *TestSuite) runV3TestJobs(
 	skipped := 0
 
 	for idx, testJob := range s.Tests {
-
 		// (Re)load the chart used by this suite (with logging temporarily disabled)
 		log.SetOutput(io.Discard)
 		chart, _ := v3loader.Load(chartPath)
@@ -400,12 +399,12 @@ func (s *TestSuite) runV3TestJobs(
 				result.Pass = true
 			}
 		} else {
-			cfg := NewTestConfig(chart, cache,
+			testJob.WithConfig(*NewTestConfig(chart, cache,
 				WithRenderPath(renderPath),
 				WithFailFast(failFast),
 				WithPostRendererConfig(s.PostRendererConfig),
-			)
-			testJob.WithConfig(*cfg)
+				WithDocumentSelector(testJob.DocumentSelector),
+			))
 			jobResult = testJob.RunV3(&job)
 			jobResults[idx] = jobResult
 			if idx == 0 {
diff --git a/pkg/unittest/testdata/chart-skipemptytemplate-no-match/Chart.yaml b/pkg/unittest/testdata/chart-skipemptytemplate-no-match/Chart.yaml
new file mode 100644
index 0000000..98e754b
--- /dev/null
+++ b/pkg/unittest/testdata/chart-skipemptytemplate-no-match/Chart.yaml
@@ -0,0 +1,6 @@
+apiVersion: v2
+name: skipemptytemplate-no-match
+version: 1.0.0
+description: simple chart to cover skipemptytemplate when no matches found
+keywords:
+  - helm template test  pkg/unittest/testdata/chart-skipemptytemplate-no-match --output-dir _scratch
diff --git a/pkg/unittest/testdata/chart-skipemptytemplate-no-match/templates/external-secrets.yaml b/pkg/unittest/testdata/chart-skipemptytemplate-no-match/templates/external-secrets.yaml
new file mode 100644
index 0000000..959a247
--- /dev/null
+++ b/pkg/unittest/testdata/chart-skipemptytemplate-no-match/templates/external-secrets.yaml
@@ -0,0 +1,23 @@
+{{- if .Values.externalsecret }}
+apiVersion: external-secrets.io/v1beta1
+kind: ExternalSecret
+metadata:
+  name: 'external-credentials'
+spec:
+  dataFrom:
+    - extract:
+        conversionStrategy: Default
+        decodingStrategy: None
+        metadataPolicy: None
+        key: 'the/credentials'
+        version: '2'
+  refreshInterval: 0s
+  secretStoreRef:
+    kind: SecretStore
+    name: 'vault-secretstore'
+  target:
+    creationPolicy: Owner
+    deletionPolicy: Retain
+    name: 'external-credentials'
+{{- end}}
+
diff --git a/pkg/unittest/testdata/chart-skipemptytemplate-no-match/templates/pdb.yaml b/pkg/unittest/testdata/chart-skipemptytemplate-no-match/templates/pdb.yaml
new file mode 100644
index 0000000..25a7a6c
--- /dev/null
+++ b/pkg/unittest/testdata/chart-skipemptytemplate-no-match/templates/pdb.yaml
@@ -0,0 +1,10 @@
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: 'greaterorequal-test-pdb'
+spec:
+  minAvailable: 2
+  unhealthyPodEvictionPolicy: AlwaysAllow
+  selector:
+    matchLabels:
+      app: 'greaterorequal-test'
diff --git a/pkg/unittest/testdata/chart-skipemptytemplate-no-match/tests/external-secrets_test.yaml b/pkg/unittest/testdata/chart-skipemptytemplate-no-match/tests/external-secrets_test.yaml
new file mode 100644
index 0000000..31934b7
--- /dev/null
+++ b/pkg/unittest/testdata/chart-skipemptytemplate-no-match/tests/external-secrets_test.yaml
@@ -0,0 +1,25 @@
+suite: skipEmptyTemplates correctly handle 'true' case
+templates:
+  - templates/*.y*ml
+tests:
+  - it: should not skip test execution when at least single template rendered
+    set:
+      externalsecret: true
+    documentSelector:
+      path: kind
+      value: ExternalSecret
+      skipEmptyTemplates: true
+    asserts:
+    - equal:
+        path: spec.target.creationPolicy
+        value: Owner
+
+  - it: should skip test execution when no template rendered
+    documentSelector:
+      path: kind
+      value: ExternalSecret
+      skipEmptyTemplates: true
+    asserts:
+    - equal:
+        path: spec.target.creationPolicy
+        value: Owner
diff --git a/pkg/unittest/utils_test.go b/pkg/unittest/utils_test.go
index 6d8565d..098dec6 100644
--- a/pkg/unittest/utils_test.go
+++ b/pkg/unittest/utils_test.go
@@ -352,3 +352,16 @@ func TestSplitBefore(t *testing.T) {
 		})
 	}
 }
+
+func TestV3RunnerWith_Fixture_Chart_SkipEmptyTemplateWhenEmpty(t *testing.T) {
+	buffer := new(bytes.Buffer)
+	runner := TestRunner{
+		Printer:   printer.NewPrinter(buffer, nil),
+		TestFiles: []string{"tests/*_test.yaml"},
+		Strict:    true,
+	}
+	_ = runner.RunV3([]string{"testdata/chart-skipemptytemplate-no-match"})
+
+	assert.Contains(t, buffer.String(), "Test Suites: 1 passed, 1 total")
+	assert.Contains(t, buffer.String(), "Tests:       2 passed, 2 total")
+}
diff --git a/test/data/v3/basic/tests/ingress_test.yaml b/test/data/v3/basic/tests/ingress_test.yaml
index 8db66a2..e0f8746 100644
--- a/test/data/v3/basic/tests/ingress_test.yaml
+++ b/test/data/v3/basic/tests/ingress_test.yaml
@@ -103,3 +103,25 @@ tests:
       - hasDocuments:
           count: 0
       - matchSnapshot: {}
+
+  - it: should skip assertion if not enabled
+    documentSelector:
+      path: kind
+      value: Ingress
+      skipEmptyTemplates: true
+    asserts:
+      - hasDocuments:
+          count: 1
+      - isKind:
+          of: ThisKindShouldNotBeAsserted
+
+  - it: should not skip assertion if enabled
+    set:
+      ingress.enabled: true
+    documentSelector:
+      path: kind
+      value: Ingress
+      skipEmptyTemplates: true
+    asserts:
+      - hasDocuments:
+          count: 1
diff --git a/test/data/v3/with-document-select/templates/external-secrets.yaml b/test/data/v3/with-document-select/templates/external-secrets.yaml
new file mode 100644
index 0000000..959a247
--- /dev/null
+++ b/test/data/v3/with-document-select/templates/external-secrets.yaml
@@ -0,0 +1,23 @@
+{{- if .Values.externalsecret }}
+apiVersion: external-secrets.io/v1beta1
+kind: ExternalSecret
+metadata:
+  name: 'external-credentials'
+spec:
+  dataFrom:
+    - extract:
+        conversionStrategy: Default
+        decodingStrategy: None
+        metadataPolicy: None
+        key: 'the/credentials'
+        version: '2'
+  refreshInterval: 0s
+  secretStoreRef:
+    kind: SecretStore
+    name: 'vault-secretstore'
+  target:
+    creationPolicy: Owner
+    deletionPolicy: Retain
+    name: 'external-credentials'
+{{- end}}
+
diff --git a/test/data/v3/with-document-select/tests/external-secrets_test.yaml b/test/data/v3/with-document-select/tests/external-secrets_test.yaml
new file mode 100644
index 0000000..31934b7
--- /dev/null
+++ b/test/data/v3/with-document-select/tests/external-secrets_test.yaml
@@ -0,0 +1,25 @@
+suite: skipEmptyTemplates correctly handle 'true' case
+templates:
+  - templates/*.y*ml
+tests:
+  - it: should not skip test execution when at least single template rendered
+    set:
+      externalsecret: true
+    documentSelector:
+      path: kind
+      value: ExternalSecret
+      skipEmptyTemplates: true
+    asserts:
+    - equal:
+        path: spec.target.creationPolicy
+        value: Owner
+
+  - it: should skip test execution when no template rendered
+    documentSelector:
+      path: kind
+      value: ExternalSecret
+      skipEmptyTemplates: true
+    asserts:
+    - equal:
+        path: spec.target.creationPolicy
+        value: Owner
diff --git a/test/data/v3/with-document-select/tests/skip_empty_templates_test.yaml b/test/data/v3/with-document-select/tests/skip_empty_templates_test.yaml
index 45c5657..2172949 100644
--- a/test/data/v3/with-document-select/tests/skip_empty_templates_test.yaml
+++ b/test/data/v3/with-document-select/tests/skip_empty_templates_test.yaml
@@ -12,3 +12,14 @@ tests:
       - matchRegex:
           path: metadata.name
           pattern: -deployment$
+
+  - it: should skip assertion when skipEmptyTemplates is true and no templates found
+    documentSelector:
+      path: kind
+      value: SomeKind
+      skipEmptyTemplates: true
+    asserts:
+      - hasDocuments:
+          count: 1
+      - isKind:
+          of: ThisKindShouldNotBeAsserted