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

Run Test Error: cannot find a Nargo.toml in <VS_Code_root_directory> #28

Closed
Savio-Sou opened this issue Jul 14, 2023 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@Savio-Sou
Copy link
Contributor

Aim

Running a test by clicking the "Run Test" button in a main.nr file that is located in:

VS_Code_root_directory
└── sub_folder
    └── src
        └── main.nr

Expected Behavior

Test runs.

Bug

 *  Executing task: /<home_dir>/.nargo/bin/nargo test test_main 

Error: cannot find a Nargo.toml in /Users/s/Dev

Location:
    crates/nargo_cli/src/cli/mod.rs:67:30

 *  The terminal process "/<home_dir>/.nargo/bin/nargo 'test', 'test_main'" failed to launch (exit code: 1). 
 *  Terminal will be reused by tasks, press any key to close it.

To Reproduce

  1. Run nargo new <project_name> in a VS Code instance's root directory
  2. Click the "Run Test" button in <project_name>/src/main.nr

Environment

Nargo version:

  • v0.8.0 release (i.e. commit d9e346) installed with noirup -v 0.8.0

Test ran:

  • The default test generated with nargo new <project_name>, i.e.
    fn main(x : Field, y : pub Field) {
        assert(x != y);
    }
    
    #[test]
    fn test_main() {
        main(1, 2);
    
        // Uncomment to make test fail
        // main(1, 1);
    }

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@Savio-Sou Savio-Sou added the bug Something isn't working label Jul 14, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jul 14, 2023
@phated
Copy link
Contributor

phated commented Aug 10, 2023

I believe this is solved by noir-lang/noir#2226 which roots everything based on Nargo.toml files

@Savio-Sou
Copy link
Contributor Author

Getting the same error with the latest Nargo nightly (commit 3d1b252) paired with v0.0.4-pre of the extension.

Do I need to compile the extension from source to get the fix?

@phated phated moved this from 📋 Backlog to 🏗 In progress in Noir Aug 11, 2023
@phated
Copy link
Contributor

phated commented Aug 11, 2023

Doing some more debugging. If you tried to run nargo test inside of "VS_Code_root_directory` you'd get the same panic; however, in the vscode plugin, we know the location of the package the test is being resolved against so we can set an arbitrary root directory that allows this to work.

@phated
Copy link
Contributor

phated commented Aug 11, 2023

Note that this needs the linked PRs and a custom build of the extension with #29 included

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants