diff --git a/generators/static.go b/generators/static.go index b91f1ac..fd929d9 100644 --- a/generators/static.go +++ b/generators/static.go @@ -19,6 +19,10 @@ func (sg *StaticGenerator) Generate(component *core.Component) (manifest string, staticPath := path.Join(component.PhysicalPath, component.Path) staticFiles, err := ioutil.ReadDir(staticPath) + if err != nil { + log.Errorf("error reading from directory %s", staticPath); + return "", err + } manifests := "" for _, staticFile := range staticFiles { diff --git a/generators/static_test.go b/generators/static_test.go new file mode 100644 index 0000000..43e5c4a --- /dev/null +++ b/generators/static_test.go @@ -0,0 +1,20 @@ +package generators + +import ( + "github.com/microsoft/fabrikate/core" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestStaticGenerator_Generate(t *testing.T) { + component := core.Component{ + Name: "foo", + Path: "", + PhysicalPath: "../testdata/invaliddir", + } + + generator := &StaticGenerator{} + _, err := generator.Generate(&component) + assert.NotNil(t, err) +}