Add prettier tests infrastructure
This commit is contained in:
parent
4a88a9e253
commit
e50f4c0ee5
6 changed files with 139 additions and 17 deletions
|
@ -230,19 +230,32 @@ impl FakeNodeRuntime {
|
|||
|
||||
#[async_trait::async_trait]
|
||||
impl NodeRuntime for FakeNodeRuntime {
|
||||
async fn binary_path(&self) -> Result<PathBuf> {
|
||||
unreachable!()
|
||||
async fn binary_path(&self) -> anyhow::Result<PathBuf> {
|
||||
// TODO kb move away into a separate type + a Project's setter (for test code)
|
||||
Ok(PathBuf::from("prettier_fake_node"))
|
||||
}
|
||||
|
||||
async fn run_npm_subcommand(&self, _: Option<&Path>, _: &str, _: &[&str]) -> Result<Output> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
async fn npm_package_latest_version(&self, _: &str) -> Result<String> {
|
||||
unreachable!()
|
||||
async fn npm_package_latest_version(&self, name: &str) -> anyhow::Result<String> {
|
||||
if name == "prettier" {
|
||||
Ok("0.0.1".to_string())
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
async fn npm_install_packages(&self, _: &Path, _: &[(&str, &str)]) -> Result<()> {
|
||||
unreachable!()
|
||||
async fn npm_install_packages(
|
||||
&self,
|
||||
_: &Path,
|
||||
packages: &[(&str, &str)],
|
||||
) -> anyhow::Result<()> {
|
||||
if packages == [("prettier", "0.0.1")] {
|
||||
Ok(())
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue