I have the following function
func (m *Blueprints) Test(ctx context.Context, source *dagger.Directory, coverageFile string) error {
ctr, err := m.Bun(source).
WithExec([]string{"sh", "-c", "bun test --coverage --coverage-reporter lcov; echo -n $? > /exit_code"}).Sync(ctx)
if err != nil {
return fmt.Errorf("error running tests: %w", err)
}
resp, err := ctr.File("./coverage/lcov.info").Export(ctx, coverageFile)
if err != nil {
return err
}
fmt.Println(resp) // /scratch/coverage/lcov.info
exitCode, err := ctr.File("/exit_code").Contents(ctx)
if err != nil {
return fmt.Errorf("get exit code: %w", err)
}
if exitCode != "0" {
return fmt.Errorf("tests failed, exit code %s", exitCode)
}
return nil
}
which I am running with dagger call test --source=. --coverage-file=./coverage/lcov.info, however no file is written to the host. I'd also expect to be able to write the path as coverage/lcov.info like I am able to when calling depend inline (i.e. dagger call test ... export --path). The file appears to be written to scratch directory?