I am building a Dagger module leveraging AI through LangChain to generate unit tests for a Sveltekit project. As part of this, I want to create a “tests” folder and a file “Home.test.ts” within the tests folder.
Currently, I am creating a tests folder at the root level of the working directory.
const tempDir = await root.withNewDirectory("/tests");
I attempt to create a new file within the tests folder:
const testFile = await root.withNewFile("/tests/Home.test.ts", "")
I mount this directory:
.withMountedDirectory("/mnt", tempDir)
However when I inspect the structure of the directory I don’t see the Home.test.ts file;
✔ exec tree /mnt 0.9s
┃ ├── routes
┃ │ ├── +page.svelte
┃ ├── setupTests.ts
┃ └── tests
I’ve tried a few things;
- I noticed tests is read only, I tried to change permissions to make it read and write before creating the new file within this folder:
"chmod", "775", "/mnt/tests"] - I tried creating the file within routes without creating a tests folder
- I tried running using shell scripts to create a directory and then create a file within the directory
As a side question:
I noticed that even when I mount my working directory to the Dagger container, the changes I make within Dagger are only within the container and not synchronized locally. After reading one of your GitHub issues answer I realized WithMountedDirectory isn’t bind mounting the files in my machine to the build
link:https://github.com/dagger/dagger/discussions/6688
I had initially built this module outside of Dagger to create the files and folders for my tests in my directory. I assume if I cannot replicate this behavior with Dagger, I could create a Docker image of the container. Any thoughts on this?
I'm having local dagger v0.9.10 (registry.dagger.io/engine) darwin/arm64 and having mounted directory using withMountedDirectory and expected that changes to that directory are reflected in hos...