-
Notifications
You must be signed in to change notification settings - Fork 41
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
fix: propagate build error and check if js files exist #297
fix: propagate build error and check if js files exist #297
Conversation
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.
Thanks for the PR! Changes look perfect!
I'd like to ask you also to introduce two test cases for checking that the scripts exist (checking the vite failure is too complex right now; same for the tuono dev
command).
To do it, I'd like to ask you to:
- rename
crates/tuono/tests/cli_tests.rs
incrates/tuono/tests/cli_build.rs
- Add a test case for testing that the
BUILD_JS_SCRIPT
does not exist - Add a test case for testing that the
BUILD_TUONO_CONFIG
does not exist
Let me know if I can support you in any way!
Hey @LeNei, I noticed that you added an empty commit. Is that what you meant? |
@Valerioageno the empty commit was a mistake when i updated my fork. I've added a test for running the cli without installed scripts but the separate cases are a bit tricky to tackle since the |
Definitely a great idea adding a better error handling! |
I've added a test using |
i.e. fn it_fails_without_installed_build_scritp() {
TempTuonoProject::new();
let mut test_tuono_build = Command::cargo_bin("tuono").unwrap();
test_tuono_build
.arg("build")
.assert()
.failure()
.stderr("Failed to find the build script. Please run `npm install`\n");
}
fn it_fails_without_installed_build_config_script() {
TempTuonoProject::new();
let mut test_tuono_build = Command::cargo_bin("tuono").unwrap();
temp_tuono_project.add_route("./node_modules/.bin/tuono-build-prod");
test_tuono_build
.arg("build")
.assert()
.failure()
.stderr("Failed to find the build script. Please run `npm install`\n");
}
|
I've updated the tests. It was required to make the mock file executable for the first script check to pass but now it should be good. |
The PR looks good to me! Thanks for your improvement |
Context & Description
This PR aims to fix the command
tuono build
not propagating errors. It also adds checks for commands executing scripts if said script exists.Closes: #278