mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
chore(cli/tests): use test builder in more integration tests (#18031)
This commit is contained in:
parent
224cff7a2f
commit
983447e860
6 changed files with 442 additions and 513 deletions
|
@ -1,8 +1,8 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use test_util as util;
|
||||
use test_util::TempDir;
|
||||
use util::assert_contains;
|
||||
use util::TestContext;
|
||||
|
||||
itest!(deno_doc_builtin {
|
||||
args: "doc",
|
||||
|
@ -11,24 +11,18 @@ itest!(deno_doc_builtin {
|
|||
|
||||
#[test]
|
||||
fn deno_doc() {
|
||||
let dir = TempDir::new();
|
||||
let context = TestContext::default();
|
||||
// try this twice to ensure it works with the cache
|
||||
for _ in 0..2 {
|
||||
let output = util::deno_cmd_with_deno_dir(&dir)
|
||||
.current_dir(util::testdata_path())
|
||||
.arg("doc")
|
||||
.arg("doc/deno_doc.ts")
|
||||
let output = context
|
||||
.new_command()
|
||||
.env("NO_COLOR", "1")
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.spawn()
|
||||
.unwrap()
|
||||
.wait_with_output()
|
||||
.unwrap();
|
||||
assert!(output.status.success());
|
||||
assert_contains!(
|
||||
std::str::from_utf8(&output.stdout).unwrap(),
|
||||
"function foo"
|
||||
);
|
||||
.args("doc doc/deno_doc.ts")
|
||||
.split_output()
|
||||
.run();
|
||||
|
||||
output.assert_exit_code(0);
|
||||
assert_contains!(output.stdout(), "function foo");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue