Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow module tests to be run from VS Code #1502

Closed
matt2e opened this issue May 16, 2024 · 4 comments · Fixed by #1543
Closed

Allow module tests to be run from VS Code #1502

matt2e opened this issue May 16, 2024 · 4 comments · Fixed by #1543
Assignees
Labels
good first issue Good for newcomers

Comments

@matt2e
Copy link
Collaborator

matt2e commented May 16, 2024

We are close to having module unit tests work within VS Code. This will also make it easy to debug module code/tests.
The only thing missing is that ftltest.WithProjectFiles() relies on FTL_CONFIG envar.

Workarounds:

  • Set the variable in hermit, open vscode with code .
  • Set it up as an envar in VS Code's settings json
    Both of these are annoying because you have to make sure you don't commit the changes because the path includes your home directory.

Possible solution:
We switch logic to look for expected file names in the current folder, if missing go up a level ... repeat.
This is similar to how you can call just from anywhere within the directory structure
We could make FTL_CONFIG and ftltest.WithProjectFiles(...) do this. This would make passing in strings to the test function actually usable in more cases, and the ftl config value to be able to be commited to git

@github-actions github-actions bot added the triage Issue needs triaging label May 16, 2024
@matt2e
Copy link
Collaborator Author

matt2e commented May 16, 2024

from discussion with @mistermoe

@alecthomas
Copy link
Collaborator

The current logic when running ftl dev is here. We should probably replicate that.

  • If a config is passed via either the CLI or envar use them.
  • Otherwise use `internal.GitRoot() + "/ftl-project.toml" if it exists.

@alecthomas
Copy link
Collaborator

In fact we should probably use ConfigPaths() directly...

@matt2e
Copy link
Collaborator Author

matt2e commented May 16, 2024

good first issue?

@wesbillman wesbillman added good first issue Good for newcomers and removed triage Issue needs triaging labels May 16, 2024
safeer added a commit that referenced this issue May 21, 2024
Fixes #1502.

Adds tests to ensure we're correctly falling back to the config in
`FTL_CONFIG` and to `ftl-project.toml` in the gitroot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants