-
Notifications
You must be signed in to change notification settings - Fork 177
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
Validate forge command outputs in docs #2687
base: master
Are you sure you want to change the base?
Validate forge command outputs in docs #2687
Conversation
This reverts commit 62bb35a.
…//github.com/foundry-rs/starknet-foundry into franciszekjob/2479-2-shell-commands-validation
…//github.com/foundry-rs/starknet-foundry into franciszekjob/2479-2-shell-commands-validation
…ciszekjob/2479-2-shell-commands-validation
…s://github.com/foundry-rs/starknet-foundry into franciszekjob/2479-2-shell-commands-validation
@@ -1,4 +1,4 @@ | |||
#!/bin/bash | |||
set -e | |||
|
|||
for d in ./docs/listings/*; do (cd "$d" && scarb test); done | |||
for d in ./docs/listings/*; do (cd "$d" && scarb check); done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Instead of calling scarb test
we should call scarb check
, some tests in examples are failing on purpose.
Validation of sncast command outputs will be added in the next PR. |
For some reason, |
crates/docs/src/validation.rs
Outdated
} | ||
|
||
fn list_packages_in_directory(dir_path: &Path) -> Vec<String> { | ||
let crates_path = dir_path.join(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let crates_path = dir_path.join(""); | |
let crates_path = dir_path.to_owned(); |
Also why you need this at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used to retrieve packages located in docs listing directory.
let temp = resolve_temp_dir(&package_name, &listings_to_packages_mapping); | ||
let output = test_runner(&temp).args(args).assert(); | ||
|
||
assert_stdout_contains(output, snippet_output); | ||
} | ||
} | ||
|
||
print_success_message(snippets.len(), "snforge"); | ||
print_success_message(snippets.len(), snippet_type.as_str()); | ||
} | ||
|
||
fn resolve_temp_dir( | ||
package_name: &str, | ||
listings_to_packages_mapping: &HashMap<String, Vec<String>>, | ||
) -> TempDir { | ||
if is_package_from_docs_listings(package_name, listings_to_packages_mapping) { | ||
setup_package_from_docs_listings(package_name, listings_to_packages_mapping) | ||
} else if ["addition", "fibonacci"].contains(&package_name) { | ||
setup_hello_workspace() | ||
} else { | ||
setup_package(package_name) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Currently we use hello_workpaces
package (from crates/forge/tests/data
) in one example in docs. In future we can simplify this logic and remove is_package_from_docs_listings
, once we use only packages from docs listings. Ref: #2698
Relates #2479
Closes #2684
Introduced changes
Checklist
CHANGELOG.md