aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-12-15 10:52:53 +0100
committerBjørn Erik Pedersen <[email protected]>2024-12-16 08:33:10 +0100
commit744b8566ec8ea138a63d3787dc2a0dd81511e492 (patch)
tree438e1c7127375eaaef3db610f318fd8b5dec803c /internal
parent7de5317aef7866ed559f0dbcd2f3370944b30ed6 (diff)
downloadhugo-744b8566ec8ea138a63d3787dc2a0dd81511e492.tar.gz
hugo-744b8566ec8ea138a63d3787dc2a0dd81511e492.zip
Fix a rebuild on resource rename case
Diffstat (limited to 'internal')
-rw-r--r--internal/js/esbuild/batch_integration_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/js/esbuild/batch_integration_test.go b/internal/js/esbuild/batch_integration_test.go
index 07f99ee4e..3501f820a 100644
--- a/internal/js/esbuild/batch_integration_test.go
+++ b/internal/js/esbuild/batch_integration_test.go
@@ -184,6 +184,20 @@ func TestBatchEditScriptParam(t *testing.T) {
b.AssertFileContent("public/mybatch/mygroup.js", "param-p1-main-edited")
}
+func TestBatchRenameBundledScript(t *testing.T) {
+ files := jsBatchFilesTemplate
+ b := hugolib.TestRunning(t, files, hugolib.TestOptWithOSFs())
+ b.AssertFileContent("public/mybatch/p1.js", "P1 Script")
+ b.RenameFile("content/p1/p1script.js", "content/p1/p1script2.js")
+ _, err := b.BuildE()
+ b.Assert(err, qt.IsNotNil)
+ b.Assert(err.Error(), qt.Contains, "resource not set")
+
+ // Rename it back.
+ b.RenameFile("content/p1/p1script2.js", "content/p1/p1script.js")
+ b.Build()
+}
+
func TestBatchErrorScriptResourceNotSet(t *testing.T) {
files := strings.Replace(jsBatchFilesTemplate, `(resources.Get "js/main.js")`, `(resources.Get "js/doesnotexist.js")`, 1)
b, err := hugolib.TestE(t, files, hugolib.TestOptWithOSFs())