feat(cli): print working dir in grey in stack traces, relative paths in check + compile output (#31194)
Some checks failed
ci / pre-build (push) Has been cancelled
ci / test debug linux-aarch64 (push) Has been cancelled
ci / test release linux-aarch64 (push) Has been cancelled
ci / test debug macos-aarch64 (push) Has been cancelled
ci / test release macos-aarch64 (push) Has been cancelled
ci / bench release linux-x86_64 (push) Has been cancelled
ci / test debug linux-x86_64 (push) Has been cancelled
ci / test release linux-x86_64 (push) Has been cancelled
ci / test debug macos-x86_64 (push) Has been cancelled
ci / test release macos-x86_64 (push) Has been cancelled
ci / test debug windows-x86_64 (push) Has been cancelled
ci / test release windows-x86_64 (push) Has been cancelled
ci / lint debug linux-x86_64 (push) Has been cancelled
ci / lint debug macos-x86_64 (push) Has been cancelled
ci / lint debug windows-x86_64 (push) Has been cancelled
ci / build libs (push) Has been cancelled
ci / publish canary (push) Has been cancelled

Before:
<img width="928" height="135" alt="Screenshot 2025-11-05 at 11 43 03 AM"
src="https://github.com/user-attachments/assets/f956a65c-d509-46ff-b8e4-58827dea3ca0"
/>

After:

<img width="927" height="130" alt="Screenshot 2025-11-05 at 11 44 39 AM"
src="https://github.com/user-attachments/assets/fb6aed36-8ca7-4744-81f1-425f7fbac5e5"
/>
This commit is contained in:
Nathan Whitaker 2025-11-06 21:38:25 +01:00 committed by GitHub
parent cf4379d047
commit 58f7435270
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
298 changed files with 618 additions and 499 deletions

13
Cargo.lock generated
View file

@ -984,6 +984,7 @@ dependencies = [
"http-body-util",
"hyper 1.6.0",
"hyper-util",
"lazy-regex",
"nix 0.27.1",
"ntest_timeout",
"once_cell",
@ -1905,9 +1906,9 @@ dependencies = [
[[package]]
name = "deno_core"
version = "0.365.0"
version = "0.367.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca4edcf35188e732cb73ff771837979486365e71ae7be846a27dc204042f42da"
checksum = "35bc5bd853f22f22954aff45968f059e5f727755f1818dafba6c19cf1c6a43c2"
dependencies = [
"anyhow",
"az",
@ -2628,9 +2629,9 @@ dependencies = [
[[package]]
name = "deno_ops"
version = "0.241.0"
version = "0.243.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea267839bedd06aec8dc61c3da679c1a3fc9f0c752ae98ddb2391d34a02da18c"
checksum = "70093389f10651aada28d3b535e115aca21888d357e0346ba67ee63600a48218"
dependencies = [
"indexmap 2.9.0",
"proc-macro-rules",
@ -8253,9 +8254,9 @@ dependencies = [
[[package]]
name = "serde_v8"
version = "0.274.0"
version = "0.276.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b496748402f50bfdcb5a5a160af7b7062561f150c947b27cf70e5eb9ce2de6ef"
checksum = "7d64a436af65a4fb070cd22d69d80bd97f5a9c67d31c2d0809a9fe0e84c59096"
dependencies = [
"deno_error",
"num-bigint",

View file

@ -61,7 +61,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies]
deno_ast = { version = "=0.50.3", features = ["transpiling"] }
deno_core = { version = "0.365.0" }
deno_core = { version = "0.367.0" }
deno_cache_dir = "=0.25.0"
deno_doc = "=0.186.0"

View file

@ -760,6 +760,7 @@ pub struct InternalFlags {
#[derive(Clone, Debug, Eq, PartialEq, Default)]
pub struct Flags {
pub initial_cwd: Option<PathBuf>,
/// Vector of CLI arguments - these are user script arguments, all Deno
/// specific flags are removed.
pub argv: Vec<String>,
@ -1523,8 +1524,15 @@ static DENO_HELP: &str = cstr!(
<y>Discord:</> https://discord.gg/deno
");
/// Main entry point for parsing deno's command line flags.
pub fn flags_from_vec(args: Vec<OsString>) -> clap::error::Result<Flags> {
flags_from_vec_with_initial_cwd(args, None)
}
/// Main entry point for parsing deno's command line flags.
pub fn flags_from_vec_with_initial_cwd(
args: Vec<OsString>,
initial_cwd: Option<PathBuf>,
) -> clap::error::Result<Flags> {
let mut app = clap_root();
let mut matches =
app
@ -1551,7 +1559,10 @@ pub fn flags_from_vec(args: Vec<OsString>) -> clap::error::Result<Flags> {
_ => e,
})?;
let mut flags = Flags::default();
let mut flags = Flags {
initial_cwd,
..Default::default()
};
// to pass all flags, even help and
if matches.subcommand_matches("deploy").is_some() {
@ -1615,6 +1626,7 @@ pub fn flags_from_vec(args: Vec<OsString>) -> clap::error::Result<Flags> {
}
help_parse(&mut flags, subcommand);
return Ok(flags);
}

View file

@ -651,10 +651,16 @@ impl CliFactory {
self.services.workspace_factory.get_or_try_init(|| {
let initial_cwd = match self.overrides.initial_cwd.clone() {
Some(v) => v,
None => self
.sys()
.env_current_dir()
.with_context(|| "Failed getting cwd.")?,
None => {
if let Some(initial_cwd) = self.flags.initial_cwd.clone() {
initial_cwd
} else {
self
.sys()
.env_current_dir()
.with_context(|| "Failed getting cwd.")?
}
}
};
let options = new_workspace_factory_options(&initial_cwd, &self.flags);
let mut factory =
@ -1135,6 +1141,9 @@ impl CliFactory {
no_legacy_abort: cli_options.no_legacy_abort(),
startup_snapshot: deno_snapshots::CLI_SNAPSHOT,
enable_raw_imports: cli_options.unstable_raw_imports(),
maybe_initial_cwd: Some(deno_path_util::url_from_directory_path(
cli_options.initial_cwd(),
)?),
})
}
@ -1154,11 +1163,15 @@ impl CliFactory {
};
let maybe_coverage_dir = cli_options.coverage_dir();
let initial_cwd =
deno_path_util::url_from_directory_path(cli_options.initial_cwd())?;
Ok(CliMainWorkerOptions {
needs_test_modules: cli_options.sub_command().needs_test(),
create_hmr_runner,
maybe_coverage_dir,
default_npm_caching_strategy: cli_options.default_npm_caching_strategy(),
maybe_initial_cwd: Some(Arc::new(initial_cwd)),
})
}

View file

@ -350,6 +350,7 @@ pub struct LibMainWorkerOptions {
pub startup_snapshot: Option<&'static [u8]>,
pub serve_port: Option<u16>,
pub serve_host: Option<String>,
pub maybe_initial_cwd: Option<Url>,
}
#[derive(Default, Clone)]
@ -462,6 +463,7 @@ impl<TSys: DenoLibSys> LibWorkerFactorySharedState<TSys> {
),
permissions: args.permissions,
};
let maybe_initial_cwd = shared.options.maybe_initial_cwd.clone();
let options = WebWorkerOptions {
name: args.name,
main_module: args.main_module.clone(),
@ -503,7 +505,9 @@ impl<TSys: DenoLibSys> LibWorkerFactorySharedState<TSys> {
.clone(),
seed: shared.options.seed,
create_web_worker_cb,
format_js_error_fn: Some(Arc::new(format_js_error)),
format_js_error_fn: Some(Arc::new(move |a| {
format_js_error(a, maybe_initial_cwd.as_ref())
})),
worker_type: args.worker_type,
stdio: stdio.clone(),
cache_storage_dir,
@ -657,6 +661,8 @@ impl<TSys: DenoLibSys> LibMainWorkerFactory<TSys> {
bundle_provider: shared.bundle_provider.clone(),
};
let maybe_initial_cwd = shared.options.maybe_initial_cwd.clone();
let options = WorkerOptions {
bootstrap: BootstrapOptions {
deno_version: crate::version::DENO_VERSION_INFO.deno.to_string(),
@ -694,7 +700,9 @@ impl<TSys: DenoLibSys> LibMainWorkerFactory<TSys> {
.unsafely_ignore_certificate_errors
.clone(),
seed: shared.options.seed,
format_js_error_fn: Some(Arc::new(format_js_error)),
format_js_error_fn: Some(Arc::new(move |e| {
format_js_error(e, maybe_initial_cwd.as_ref())
})),
create_web_worker_cb: shared.create_web_worker_callback(stdio.clone()),
maybe_inspector_server: shared.maybe_inspector_server.clone(),
should_break_on_first_statement: shared.options.inspect_brk,

View file

@ -63,7 +63,7 @@ use self::util::draw_thread::DrawThread;
use crate::args::CompletionsFlags;
use crate::args::DenoSubcommand;
use crate::args::Flags;
use crate::args::flags_from_vec;
use crate::args::flags_from_vec_with_initial_cwd;
use crate::args::get_default_v8_flags;
use crate::util::display;
use crate::util::v8::get_v8_flags_from_env;
@ -558,9 +558,13 @@ fn exit_with_message(message: &str, code: i32) -> ! {
deno_runtime::exit(code);
}
fn exit_for_error(error: AnyError) -> ! {
fn exit_for_error(error: AnyError, initial_cwd: Option<&std::path::Path>) -> ! {
let error_string = match js_error_downcast_ref(&error) {
Some(e) => format_js_error(e),
Some(e) => {
let initial_cwd = initial_cwd
.and_then(|cwd| deno_path_util::url_from_directory_path(cwd).ok());
format_js_error(e, initial_cwd.as_ref())
}
None => format!("{error:?}"),
};
@ -619,50 +623,68 @@ pub fn main() {
let roots = LibWorkerFactoryRoots::default();
#[cfg(unix)]
let (waited_unconfigured_runtime, waited_args) =
let (waited_unconfigured_runtime, waited_args, waited_cwd) =
match wait_for_start(&args, roots.clone()) {
Some(f) => match f.await {
Ok(v) => match v {
Some((u, a)) => (Some(u), Some(a)),
None => (None, None),
Some((u, a, c)) => (Some(u), Some(a), Some(c)),
None => (None, None, None),
},
Err(e) => {
panic!("Failure from control sock: {e}");
}
},
None => (None, None),
None => (None, None, None),
};
#[cfg(not(unix))]
let (waited_unconfigured_runtime, waited_args) = (None, None);
let (waited_unconfigured_runtime, waited_args, waited_cwd) =
(None, None, None);
let args = waited_args.unwrap_or(args);
let initial_cwd = waited_cwd.map(Some).unwrap_or_else(|| {
match std::env::current_dir().with_context(|| "Failed getting cwd.") {
Ok(cwd) => Some(cwd),
Err(err) => {
log::error!("Failed getting cwd: {err}");
None
}
}
});
// NOTE(lucacasonato): due to new PKU feature introduced in V8 11.6 we need to
// initialize the V8 platform on a parent thread of all threads that will spawn
// V8 isolates.
let flags = resolve_flags_and_init(args).await?;
let flags = match resolve_flags_and_init(args, initial_cwd.clone()).await {
Ok(flags) => flags,
Err(err) => return (Err(err), initial_cwd),
};
if waited_unconfigured_runtime.is_none() {
init_v8(&flags);
}
run_subcommand(Arc::new(flags), waited_unconfigured_runtime, roots).await
(
run_subcommand(Arc::new(flags), waited_unconfigured_runtime, roots).await,
initial_cwd,
)
};
let result = create_and_run_current_thread_with_maybe_metrics(future);
let (result, initial_cwd) =
create_and_run_current_thread_with_maybe_metrics(future);
#[cfg(feature = "dhat-heap")]
drop(profiler);
match result {
Ok(exit_code) => deno_runtime::exit(exit_code),
Err(err) => exit_for_error(err),
Err(err) => exit_for_error(err, initial_cwd.as_deref()),
}
}
async fn resolve_flags_and_init(
args: Vec<std::ffi::OsString>,
initial_cwd: Option<std::path::PathBuf>,
) -> Result<Flags, AnyError> {
// this env var is used by clap to enable dynamic completions, it's set by the shell when
// executing deno to get dynamic completions.
@ -671,17 +693,18 @@ async fn resolve_flags_and_init(
deno_runtime::exit(0);
}
let mut flags = match flags_from_vec(args) {
Ok(flags) => flags,
Err(err @ clap::Error { .. })
if err.kind() == clap::error::ErrorKind::DisplayVersion =>
{
// Ignore results to avoid BrokenPipe errors.
let _ = err.print();
deno_runtime::exit(0);
}
Err(err) => exit_for_error(AnyError::from(err)),
};
let mut flags =
match flags_from_vec_with_initial_cwd(args, initial_cwd.clone()) {
Ok(flags) => flags,
Err(err @ clap::Error { .. })
if err.kind() == clap::error::ErrorKind::DisplayVersion =>
{
// Ignore results to avoid BrokenPipe errors.
let _ = err.print();
deno_runtime::exit(0);
}
Err(err) => exit_for_error(AnyError::from(err), initial_cwd.as_deref()),
};
// preserve already loaded env variables
if flags.subcommand.watch_flags().is_some() {
WatchEnvTracker::snapshot();
@ -706,7 +729,10 @@ async fn resolve_flags_and_init(
// Tunnel sets up env vars and OTEL, so connect before everything else.
if flags.tunnel {
if let Err(err) = initialize_tunnel(&flags).await {
exit_for_error(err.context("Failed to start with tunnel"));
exit_for_error(
err.context("Failed to start with tunnel"),
initial_cwd.as_deref(),
);
}
// SAFETY: We're doing this before any threads are created.
unsafe {
@ -816,7 +842,7 @@ fn wait_for_start(
) -> Option<
impl Future<
Output = Result<
Option<(UnconfiguredRuntime, Vec<std::ffi::OsString>)>,
Option<(UnconfiguredRuntime, Vec<std::ffi::OsString>, PathBuf)>,
AnyError,
>,
> + use<>,
@ -935,7 +961,7 @@ fn wait_for_start(
let cmd: Start = deno_core::serde_json::from_slice(&buf)?;
std::env::set_current_dir(cmd.cwd)?;
std::env::set_current_dir(&cmd.cwd)?;
for (k, v) in cmd.env {
// SAFETY: We're doing this before any threads are created.
@ -947,7 +973,7 @@ fn wait_for_start(
.chain(cmd.args.into_iter().map(Into::into))
.collect();
Ok(Some((unconfigured, args)))
Ok(Some((unconfigured, args, PathBuf::from(cmd.cwd))))
})
}

View file

@ -44,7 +44,7 @@ fn unwrap_or_exit<T>(result: Result<T, AnyError>) -> T {
Ok(value) => value,
Err(error) => {
let error_string = match js_error_downcast_ref(&error) {
Some(js_error) => format_js_error(js_error),
Some(js_error) => format_js_error(js_error, None),
None => format!("{:?}", error),
};

View file

@ -1030,6 +1030,7 @@ pub async fn run(
no_legacy_abort: false,
startup_snapshot: deno_snapshots::CLI_SNAPSHOT,
enable_raw_imports: metadata.unstable_config.raw_imports,
maybe_initial_cwd: None,
};
let worker_factory = LibMainWorkerFactory::new(
Arc::new(BlobStore::default()),

View file

@ -72,11 +72,27 @@ pub async fn compile(
graph
};
let initial_cwd =
deno_path_util::url_from_directory_path(cli_options.initial_cwd())?;
log::info!(
"{} {} to {}",
colors::green("Compile"),
entrypoint,
output_path.display(),
crate::util::path::relative_specifier_path_for_display(
&initial_cwd,
entrypoint
),
{
if let Ok(output_path) = deno_path_util::url_from_file_path(&output_path)
{
crate::util::path::relative_specifier_path_for_display(
&initial_cwd,
&output_path,
)
} else {
output_path.display().to_string()
}
}
);
validate_output_path(&output_path)?;

View file

@ -55,7 +55,7 @@ impl LintReporter for PrettyLintReporter {
fn visit_error(&mut self, file_path: &str, err: &AnyError) {
log::error!("Error linting: {file_path}");
let text = match js_error_downcast_ref(err) {
Some(js_error) => format_js_error(js_error),
Some(js_error) => format_js_error(js_error, None),
None => format!("{err:#}"),
};
for line in text.split('\n') {

View file

@ -91,7 +91,7 @@ pub fn format_test_error(
if options.hide_stacktraces {
return js_error.exception_message;
}
format_js_error(&js_error)
format_js_error(&js_error, options.initial_cwd.as_ref())
}
pub fn format_sanitizer_diff(

View file

@ -306,6 +306,7 @@ impl From<&TestDescription> for TestFailureDescription {
#[derive(Debug, Default, Clone, PartialEq)]
pub struct TestFailureFormatOptions {
pub hide_stacktraces: bool,
pub initial_cwd: Option<Url>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
@ -605,6 +606,7 @@ fn get_test_reporter(options: &TestSpecifiersOptions) -> Box<dyn TestReporter> {
let parallel = options.concurrent_jobs.get() > 1;
let failure_format_options = TestFailureFormatOptions {
hide_stacktraces: options.hide_stacktraces,
initial_cwd: Some(options.cwd.clone()),
};
let reporter: Box<dyn TestReporter> = match &options.reporter {
TestReporterConfig::Dot => Box::new(DotTestReporter::new(
@ -637,6 +639,7 @@ fn get_test_reporter(options: &TestSpecifiersOptions) -> Box<dyn TestReporter> {
junit_path.to_string(),
TestFailureFormatOptions {
hide_stacktraces: options.hide_stacktraces,
initial_cwd: Some(options.cwd.clone()),
},
));
return Box::new(CompoundTestReporter::new(vec![reporter, junit]));

View file

@ -44,7 +44,6 @@ use crate::sys::CliSys;
use crate::tsc;
use crate::tsc::Diagnostics;
use crate::tsc::TypeCheckingCjsTracker;
use crate::util::path::to_percent_decoded_str;
#[derive(Debug, thiserror::Error, deno_error::JsError)]
#[class(type)]
@ -255,6 +254,10 @@ impl TypeChecker {
code_cache: self.code_cache.clone(),
tsgo_path: self.tsgo_path.clone(),
initial_cwd: self.cli_options.initial_cwd().to_path_buf(),
current_dir: deno_path_util::url_from_directory_path(
self.cli_options.initial_cwd(),
)
.map_err(|e| CheckError::Other(JsErrorBox::from_err(e)))?,
}),
))
}
@ -385,6 +388,7 @@ struct DiagnosticsByFolderRealIterator<'a> {
code_cache: Option<Arc<crate::cache::CodeCache>>,
tsgo_path: Option<PathBuf>,
initial_cwd: PathBuf,
current_dir: Url,
}
impl Iterator for DiagnosticsByFolderRealIterator<'_> {
@ -441,12 +445,15 @@ impl DiagnosticsByFolderRealIterator<'_> {
&self,
check_group: &CheckGroup,
) -> Result<Diagnostics, CheckError> {
fn log_provided_roots(provided_roots: &[Url]) {
fn log_provided_roots(provided_roots: &[Url], current_dir: &Url) {
for root in provided_roots {
log::info!(
"{} {}",
colors::green("Check"),
to_percent_decoded_str(root.as_str())
crate::util::path::relative_specifier_path_for_display(
current_dir,
root
),
);
}
}
@ -483,7 +490,7 @@ impl DiagnosticsByFolderRealIterator<'_> {
if root_names.is_empty() {
if missing_diagnostics.has_diagnostic() {
log_provided_roots(&check_group.roots);
log_provided_roots(&check_group.roots, &self.current_dir);
}
return Ok(missing_diagnostics);
}
@ -499,7 +506,7 @@ impl DiagnosticsByFolderRealIterator<'_> {
}
// log out the roots that we're checking
log_provided_roots(&check_group.roots);
log_provided_roots(&check_group.roots, &self.current_dir);
// the first root will always either be the specifier that the user provided
// or the first specifier in a directory

View file

@ -13,6 +13,7 @@ use deno_config::glob::PathOrPatternSet;
use deno_core::error::AnyError;
use deno_core::futures::FutureExt;
use deno_core::parking_lot::Mutex;
use deno_core::url::Url;
use deno_lib::util::result::js_error_downcast_ref;
use deno_runtime::fmt_errors::format_js_error;
use deno_signals;
@ -77,14 +78,14 @@ impl DebouncedReceiver {
}
}
async fn error_handler<F>(watch_future: F) -> bool
async fn error_handler<F>(watch_future: F, initial_cwd: Option<&Url>) -> bool
where
F: Future<Output = Result<(), AnyError>>,
{
let result = watch_future.await;
if let Err(err) = result {
let error_string = match js_error_downcast_ref(&err) {
Some(e) => format_js_error(e),
Some(e) => format_js_error(e, initial_cwd),
None => format!("{err:?}"),
};
log::error!(
@ -299,6 +300,9 @@ where
) -> Result<F, AnyError>,
F: Future<Output = Result<(), AnyError>>,
{
let initial_cwd = std::env::current_dir()
.ok()
.and_then(|path| deno_path_util::url_from_directory_path(&path).ok());
let exclude_set = flags.resolve_watch_exclude_set()?;
let (paths_to_watch_tx, mut paths_to_watch_rx) =
tokio::sync::mpsc::unbounded_channel();
@ -359,11 +363,14 @@ where
add_paths_to_watcher(&mut watcher, &maybe_paths.unwrap(), &exclude_set);
}
};
let operation_future = error_handler(operation(
flags.clone(),
watcher_communicator.clone(),
changed_paths.borrow_mut().take(),
)?);
let operation_future = error_handler(
operation(
flags.clone(),
watcher_communicator.clone(),
changed_paths.borrow_mut().take(),
)?,
initial_cwd.as_ref(),
);
// don't reload dependencies after the first run
if flags.reload {

View file

@ -99,25 +99,9 @@ pub fn relative_specifier(
return Some("./".to_string());
}
// workaround using parent directory until https://github.com/servo/rust-url/pull/754 is merged
let from = if !from.path().ends_with('/') {
if let Some(end_slash) = from.path().rfind('/') {
let mut new_from = from.clone();
new_from.set_path(&from.path()[..end_slash + 1]);
Cow::Owned(new_from)
} else {
Cow::Borrowed(from)
}
} else {
Cow::Borrowed(from)
};
// workaround for url crate not adding a trailing slash for a directory
// it seems to be fixed once a version greater than 2.2.2 is released
let mut text = from.make_relative(to)?;
if is_dir && !text.ends_with('/') && to.query().is_none() {
text.push('/');
}
let text = from.make_relative(to)?;
let text = if text.starts_with("../") || text.starts_with("./") {
text
@ -127,6 +111,25 @@ pub fn relative_specifier(
Some(to_percent_decoded_str(&text))
}
pub fn relative_specifier_path_for_display(
from: &ModuleSpecifier,
to: &ModuleSpecifier,
) -> String {
if to.scheme() == "file" && from.scheme() == "file" {
let relative_specifier = relative_specifier(from, to)
.map(Cow::Owned)
.unwrap_or_else(|| Cow::Borrowed(to.as_str()));
let relative_specifier = if relative_specifier.starts_with("../../../") {
to.as_str()
} else {
relative_specifier.trim_start_matches("./")
};
to_percent_decoded_str(relative_specifier)
} else {
to_percent_decoded_str(to.as_str())
}
}
/// Slightly different behaviour than the default matching
/// where an exact path needs to be matched to be opted-in
/// rather than just a partial directory match.

View file

@ -43,6 +43,7 @@ pub struct CliMainWorkerOptions {
pub maybe_coverage_dir: Option<PathBuf>,
pub default_npm_caching_strategy: NpmCachingStrategy,
pub needs_test_modules: bool,
pub maybe_initial_cwd: Option<Arc<ModuleSpecifier>>,
}
/// Data shared between the factory and workers.
@ -50,6 +51,7 @@ struct SharedState {
pub create_hmr_runner: Option<CreateHmrRunnerCb>,
pub maybe_coverage_dir: Option<PathBuf>,
pub maybe_file_watcher_communicator: Option<Arc<WatcherCommunicator>>,
pub maybe_initial_cwd: Option<Arc<ModuleSpecifier>>,
}
pub struct CliMainWorker {
@ -314,6 +316,7 @@ impl CliMainWorkerFactory {
create_hmr_runner: options.create_hmr_runner,
maybe_coverage_dir: options.maybe_coverage_dir,
maybe_file_watcher_communicator,
maybe_initial_cwd: options.maybe_initial_cwd,
}),
default_npm_caching_strategy: options.default_npm_caching_strategy,
needs_test_modules: options.needs_test_modules,
@ -450,6 +453,13 @@ impl CliMainWorkerFactory {
);
}
if let Some(initial_cwd) = &self.shared.maybe_initial_cwd {
let op_state = worker.js_runtime().op_state();
op_state
.borrow_mut()
.put(deno_core::error::InitialCwd(initial_cwd.clone()));
}
Ok(CliMainWorker {
worker,
shared: self.shared.clone(),

0
fail.txt Normal file
View file

View file

@ -6,6 +6,7 @@ use color_print::cformat;
use color_print::cstr;
use deno_core::error::JsError;
use deno_core::error::format_frame;
use deno_core::url::Url;
use deno_terminal::colors;
#[derive(Debug, Clone)]
@ -81,6 +82,7 @@ struct AnsiColors;
impl deno_core::error::ErrorFormat for AnsiColors {
fn fmt_element(
element: deno_core::error::ErrorElement,
_in_extension_code: bool,
s: &str,
) -> std::borrow::Cow<'_, str> {
use deno_core::error::ErrorElement::*;
@ -90,6 +92,7 @@ impl deno_core::error::ErrorFormat for AnsiColors {
}
LineNumber | ColumnNumber => colors::yellow(s).to_string().into(),
FunctionName | PromiseAll => colors::italic_bold(s).to_string().into(),
WorkingDirPath => colors::gray(s).to_string().into(),
}
}
}
@ -170,6 +173,7 @@ fn find_recursive_cause(js_error: &JsError) -> Option<ErrorReference<'_>> {
fn format_aggregated_error(
aggregated_errors: &Vec<JsError>,
circular_reference_index: usize,
initial_cwd: Option<&Url>,
) -> String {
let mut s = String::new();
let mut nested_circular_reference_index = circular_reference_index;
@ -187,6 +191,7 @@ fn format_aggregated_error(
}),
false,
vec![],
initial_cwd,
);
for line in error_string.trim_start_matches("Uncaught ").lines() {
@ -202,6 +207,7 @@ fn format_js_error_inner(
circular: Option<IndexedErrorReference>,
include_source_code: bool,
suggestions: Vec<FixSuggestion>,
initial_cwd: Option<&Url>,
) -> String {
let mut s = String::new();
@ -221,6 +227,7 @@ fn format_js_error_inner(
.as_ref()
.map(|circular| circular.index)
.unwrap_or(0),
initial_cwd,
);
s.push_str(&aggregated_message);
}
@ -239,7 +246,12 @@ fn format_js_error_inner(
0,
));
for frame in &js_error.frames {
write!(s, "\n at {}", format_frame::<AnsiColors>(frame, None)).unwrap();
write!(
s,
"\n at {}",
format_frame::<AnsiColors>(frame, initial_cwd)
)
.unwrap();
}
if let Some(cause) = &js_error.cause {
let is_caused_by_circular = circular
@ -251,7 +263,7 @@ fn format_js_error_inner(
colors::cyan(format!("[Circular *{}]", circular.unwrap().index))
.to_string()
} else {
format_js_error_inner(cause, circular, false, vec![])
format_js_error_inner(cause, circular, false, vec![], initial_cwd)
};
write!(
@ -465,14 +477,17 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion<'_>> {
}
/// Format a [`JsError`] for terminal output.
pub fn format_js_error(js_error: &JsError) -> String {
pub fn format_js_error(
js_error: &JsError,
initial_cwd: Option<&Url>,
) -> String {
let circular =
find_recursive_cause(js_error).map(|reference| IndexedErrorReference {
reference,
index: 1,
});
let suggestions = get_suggestions_for_terminal_errors(js_error);
format_js_error_inner(js_error, circular, true, suggestions)
format_js_error_inner(js_error, circular, true, suggestions, initial_cwd)
}
#[cfg(test)]

View file

@ -46,6 +46,7 @@ http.workspace = true
http-body-util.workspace = true
hyper.workspace = true
hyper-util.workspace = true
lazy-regex.workspace = true
ntest_timeout.workspace = true
once_cell.workspace = true
os_pipe.workspace = true

View file

@ -122,7 +122,7 @@ fn ts_no_recheck_on_redirect() {
// run once
let output = check_command.run();
output.assert_matches_text("[WILDCARD]Check file://[WILDCARD]");
output.assert_matches_text("[WILDCARD]Check [WILDCARD]");
// run again
let output = check_command.run();

View file

@ -823,7 +823,9 @@ testing[WILDCARD]this
.args("compile --output binary main.ts")
.run()
.assert_exit_code(0)
.assert_matches_text("Check file:///[WILDLINE]/main.ts\nCompile file:///[WILDLINE]/main.ts to binary[WILDLINE]\n");
.assert_matches_text(
"Check main.ts\nCompile main.ts to binary[WILDLINE]\n",
);
context
.new_command()
@ -1104,8 +1106,8 @@ console.log(getValue());"#,
r#"Download http://localhost:4260/@denotest%2fesm-basic
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
Initialize @denotest/esm-basic@1.0.0
Check file:///[WILDCARD]/main.ts
Compile file:///[WILDCARD]/main.ts to [WILDCARD]
Check main.ts
Compile main.ts to [WILDCARD]
Warning Failed resolving symlink. Ignoring.
Path: [WILDCARD]
Message: [WILDCARD])

View file

@ -96,7 +96,7 @@ fn fast_check_cache() {
.args("check --all main.ts")
.run()
.assert_matches_text(
"Check file:///[WILDCARD]main.ts
"Check main.ts
TS2322 [ERROR]: Type 'string' is not assignable to type 'number'.
export function asdf(a: number) { let err: number = ''; return Math.random(); }
~~~

View file

@ -1433,8 +1433,7 @@ console.log(getKind());
"#,
);
let output = test_context.new_command().args("run --check main.ts").run();
output
.assert_matches_text("Check file:///[WILDCARD]/main.ts\n2\n1\n2\nesm\n");
output.assert_matches_text("Check main.ts\n2\n1\n2\nesm\n");
// should not have created the .deno directory
assert!(!dir.path().join("node_modules/.deno").exists());
@ -1529,7 +1528,7 @@ console.log(getValue());
let output = test_context.new_command().args("run main.ts").run();
output.assert_matches_text("5\n");
let output = test_context.new_command().args("check main.ts").run();
output.assert_matches_text("Check file:///[WILDCARD]/main.ts\n");
output.assert_matches_text("Check main.ts\n");
}
#[test]
@ -1653,7 +1652,7 @@ console.log(add(1, 2));
.new_command()
.args("check ./project-b/main.ts")
.run();
output.assert_matches_text("Check file:///[WILDCARD]/project-b/main.ts\n");
output.assert_matches_text("Check project-b/main.ts\n");
// Now a file in the main directory should just be able to
// import it via node resolution even though a package.json
@ -1670,7 +1669,7 @@ console.log(getValue());
let output = test_context.new_command().args("run main.ts").run();
output.assert_matches_text("7\n");
let output = test_context.new_command().args("check main.ts").run();
output.assert_matches_text("Check file:///[WILDCARD]/main.ts\n");
output.assert_matches_text("Check main.ts\n");
}
#[test]
@ -1752,7 +1751,7 @@ console.log(add(1, 2));
.new_command()
.args("check ./project-b/main.ts")
.run();
output.assert_matches_text("Check file:///[WILDCARD]/project-b/main.ts\n");
output.assert_matches_text("Check project-b/main.ts\n");
// Now a file in the main directory should just be able to
// import it via node resolution even though a package.json
@ -1769,7 +1768,7 @@ console.log(getValue());
let output = test_context.new_command().args("run main.ts").run();
output.assert_matches_text("7\n");
let output = test_context.new_command().args("check main.ts").run();
output.assert_matches_text("Check file:///[WILDCARD]/main.ts\n");
output.assert_matches_text("Check main.ts\n");
}
#[test]
@ -1784,7 +1783,7 @@ fn check_css_package_json_exports() {
.new_command()
.args("check main.ts")
.run()
.assert_matches_text("Download [WILDCARD]css-export\nDownload [WILDCARD]css-export/1.0.0.tgz\nCheck [WILDCARD]/main.ts\n")
.assert_matches_text("Download [WILDCARD]css-export\nDownload [WILDCARD]css-export/1.0.0.tgz\nCheck main.ts\n")
.assert_exit_code(0);
}

View file

@ -2374,7 +2374,7 @@ async fn test_resolve_dns() {
let out = String::from_utf8_lossy(&output.stdout);
println!("{err}");
assert!(output.status.success());
assert!(err.starts_with("Check file"));
assert!(err.starts_with("Check run/resolve_dns.ts"));
let expected = std::fs::read_to_string(
util::testdata_path().join("run/resolve_dns.ts.out"),
@ -2403,7 +2403,7 @@ async fn test_resolve_dns() {
eprintln!("stderr: {err}");
}
assert!(output.status.success());
assert!(err.starts_with("Check file"));
assert!(err.starts_with("Check run/resolve_dns.ts"));
let expected = std::fs::read_to_string(
util::testdata_path().join("run/resolve_dns.ts.out"),
@ -2429,7 +2429,7 @@ async fn test_resolve_dns() {
let err = String::from_utf8_lossy(&output.stderr);
let out = String::from_utf8_lossy(&output.stdout);
assert!(!output.status.success());
assert!(err.starts_with("Check file"));
assert!(err.starts_with("Check run/resolve_dns.ts"));
assert!(err.contains(r#"error: Uncaught (in promise) NotCapable: Requires net access to "127.0.0.1:4553""#));
assert!(out.is_empty());
}
@ -2450,7 +2450,7 @@ async fn test_resolve_dns() {
let err = String::from_utf8_lossy(&output.stderr);
let out = String::from_utf8_lossy(&output.stdout);
assert!(!output.status.success());
assert!(err.starts_with("Check file"));
assert!(err.starts_with("Check run/resolve_dns.ts"));
assert!(err.contains(r#"error: Uncaught (in promise) NotCapable: Requires net access to "127.0.0.1:4553""#));
assert!(out.is_empty());
}

View file

@ -1144,10 +1144,8 @@ async fn test_watch_doc() {
"#,
);
assert_eq!(
skip_restarting_line(&mut stderr_lines).await,
format!("Check {foo_file_url}$3-6.ts")
);
let file_regex = lazy_regex::lazy_regex!(r"Check [^\n]*foo\.ts\$3-6\.ts");
assert!(file_regex.is_match(&skip_restarting_line(&mut stderr_lines).await),);
assert_eq!(
next_line(&mut stderr_lines).await.unwrap(),
"TS2322 [ERROR]: Type 'number' is not assignable to type 'string'."
@ -1214,10 +1212,9 @@ async fn test_watch_doc() {
);
wait_contains("running 1 test from", &mut stdout_lines).await;
assert_contains!(
next_line(&mut stdout_lines).await.unwrap(),
&format!("{foo_file_url}$3-8.ts ... ok")
);
let file_regex = lazy_regex::lazy_regex!(r"[^\n]*foo\.ts\$3-8\.ts");
assert!(file_regex.is_match(&next_line(&mut stdout_lines).await.unwrap()));
wait_contains("ok | 1 passed | 0 failed", &mut stdout_lines).await;
wait_contains("Test finished", &mut stderr_lines).await;

View file

@ -1,5 +1,5 @@
[WILDCARD]
Check [WILDLINE]/allow_all.ts
Check [WILDCARD]allow_all.ts
CPU | [WILDLINE]
Runtime | Deno [WILDLINE] ([WILDLINE])

View file

@ -1,4 +1,4 @@
Check [WILDLINE]/allow_none.ts
Check [WILDCARD]allow_none.ts
CPU | [WILDLINE]
Runtime | Deno [WILDLINE] ([WILDLINE])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/bench_formatting.ts
Check [WILDCARD]bench_formatting.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/clear_timeout.ts
Check [WILDCARD]clear_timeout.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,6 +1,6 @@
Check [WILDCARD]/collect/bench.ts
Check [WILDCARD]/collect/include/2_bench.ts
Check [WILDCARD]/collect/include/bench.ts
Check [WILDCARD]bench.ts
Check [WILDCARD]2_bench.ts
Check [WILDCARD]bench.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/collect/bench.ts
Check [WILDCARD]/collect/include/bench.ts
Check [WILDCARD]bench.ts
Check [WILDCARD]bench.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/main.ts
Check [WILDCARD]main.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check file:///[WILDCARD]/as_ts.js
Check [WILDCARD]as_ts.js
[WILDCARD]
file:///[WILDCARD]/as_ts.js

View file

@ -1,4 +1,4 @@
Check file:///[WILDCARD]/extensionless
Check [WILDCARD]extensionless
[WILDCARD]
file:///[WILDCARD]/extensionless

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/exit_sanitizer.ts
Check [WILDCARD]exit_sanitizer.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/fail.ts
Check [WILDCARD]fail.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check file://[WILDCARD]/file_protocol.ts
Check [WILDCARD]file_protocol.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,6 +1,6 @@
Check [WILDCARD]/bench/filter/a_bench.ts
Check [WILDCARD]/bench/filter/b_bench.ts
Check [WILDCARD]/bench/filter/c_bench.ts
Check [WILDCARD]a_bench.ts
Check [WILDCARD]b_bench.ts
Check [WILDCARD]c_bench.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/finally_timeout.ts
Check [WILDCARD]finally_timeout.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/ignore.ts
Check [WILDCARD]ignore.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/ignore_permissions.ts
Check [WILDCARD]ignore_permissions.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/interval.ts
Check [WILDCARD]interval.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.bench.ts
Check [WILDCARD]main.bench.ts
CPU | [WILDLINE]
Runtime | [WILDLINE]

View file

@ -1,4 +1,4 @@
Check file:///[WILDCARD]/pass.ts
Check [WILDCARD]pass.ts
{
"version": 1,
"runtime": "Deno/[WILDCARD]",

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/load_unload.ts
Check [WILDCARD]load_unload.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/meta.ts
Check [WILDCARD]meta.ts
import.meta.main: false
import.meta.url: [WILDCARD]/meta.ts
CPU | [WILDCARD]

View file

@ -1,6 +1,6 @@
Check [WILDCARD]/group_baseline.ts
Check [WILDCARD]/pass.ts
Check [WILDCARD]/multiple_group.ts
Check [WILDCARD]group_baseline.ts
Check [WILDCARD]pass.ts
Check [WILDCARD]multiple_group.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/no_run.ts
Check [WILDCARD]no_run.ts
TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
const _value: string = 1;
~~~~~~

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/only.ts
Check [WILDCARD]only.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/overloads.ts
Check [WILDCARD]overloads.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check file:///[WILDCARD]/lib.bench.ts
Check [WILDCARD]lib.bench.ts
CPU | [WILDCARD]
Runtime | [WILDCARD]

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/pass.ts
Check [WILDCARD]pass.ts
CPU | [WILDCARD]
Runtime | Deno [WILDCARD] ([WILDCARD])

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/unhandled_rejection.ts
Check [WILDCARD]unhandled_rejection.ts
error: (in promise) Error: rejection
reject(new Error("rejection"));
^

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/unresolved_promise.ts
Check [WILDCARD]unresolved_promise.ts
error: Top-level await promise never resolved
await new Promise((_resolve, _reject) => {});
^

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/package-b/mod.bench.ts
Check [WILDCARD]mod.bench.ts
CPU | [WILDLINE]
Runtime | [WILDLINE]

View file

@ -1,5 +1,5 @@
Check file:///[WILDLINE]/package-a/mod.bench.ts
Check file:///[WILDLINE]/package-b/mod.bench.ts
Check [WILDCARD]mod.bench.ts
Check [WILDCARD]mod.bench.ts
CPU | [WILDLINE]
Runtime | [WILDLINE]

View file

@ -1,5 +1,5 @@
Download http://localhost:4545/subdir/mod2.ts
Download http://localhost:4545/subdir/mt_text_typescript.t1.ts
Download http://localhost:4545/subdir/print_hello.ts
Check [WILDCARD]/fetch_multiple/test.ts
Check [WILDCARD]/fetch_multiple/other.ts
Check [WILDCARD]test.ts
Check [WILDCARD]other.ts

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/ambient_modules/bar.ts
Check [WILDCARD]bar.ts
TS2307 [ERROR]: Cannot find module 'file:///[WILDLINE]logo.svg'.
at file:///[WILDLINE]/ambient_modules/bar.ts:1:18

View file

@ -1 +1 @@
Check file:///[WILDLINE]/ambient_modules/foo.ts
Check [WILDCARD]foo.ts

View file

@ -1 +1 @@
Check file://[WILDCARD]/main.ts
Check [WILDCARD]main.ts

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS2322 [ERROR]: Type 'Uint8Array<ArrayBuffer>' is not assignable to type 'number'.
invalid = helloBytes;
~~~~~~~

View file

@ -1 +1 @@
Check file:///[WILDCARD]/main.ts
Check [WILDCARD]main.ts

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS2304 [ERROR]: Cannot find name 'onmessage'.
onmessage;
~~~~~~~~~
@ -11,7 +11,7 @@ onmessage;
Found 2 errors.
Check file:///[WILDLINE]/member/mod.ts
Check [WILDCARD]mod.ts
TS2304 [ERROR]: Cannot find name 'localStorage'.
localStorage;
~~~~~~~~~~~~

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS2304 [ERROR]: Cannot find name 'onmessage'.
onmessage;
~~~~~~~~~
@ -11,7 +11,7 @@ onmessage;
Found 2 errors.
Check file:///[WILDLINE]/member/mod.ts
Check [WILDCARD]mod.ts
TS2304 [ERROR]: Cannot find name 'localStorage'.
localStorage;
~~~~~~~~~~~~

View file

@ -1,6 +1,6 @@
Download http://localhost:4260/@denotest%2fcjs-default-export
Download http://localhost:4260/@denotest/cjs-default-export/1.0.0.tgz
Check file:///[WILDCARD]/main.ts
Check [WILDCARD]main.ts
TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
export const Test: string = cjsDefault.default();
~~~~

View file

@ -25,11 +25,11 @@
},
{
"args": "check exists_dynamic_import.ts",
"output": "Check file:///[WILDCARD]exists_dynamic_import.ts\n"
"output": "Check [WILDCARD]exists_dynamic_import.ts\n"
},
{
"args": "run --check --reload exists_dynamic_import.ts",
"output": "Check file:///[WILDCARD]exists_dynamic_import.ts\n"
"output": "Check [WILDCARD]exists_dynamic_import.ts\n"
}
],
"variants": {

View file

@ -1 +1 @@
Check [WILDLINE]exists.ts
Check [WILDCARD]exists.ts

View file

@ -1 +1 @@
Check file:///[WILDLINE]/exists_and_try_uses.ts
Check [WILDCARD]exists_and_try_uses.ts

View file

@ -1,4 +1,4 @@
Check [WILDLINE]exists.ts
Check [WILDCARD]exists.ts
TS2307 [ERROR]: Cannot find module 'file:///[WILDLINE]/not_exists.css'.
at file:///[WILDLINE]/not_exists.ts:1:8

View file

@ -1,4 +1,4 @@
Check [WILDLINE]exists.ts
Check [WILDCARD]exists.ts
TS2307 [ERROR]: Cannot find module 'file:///[WILDLINE]/not_exists.css'.
at file:///[WILDLINE]/not_exists.ts:1:8

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/dts_importing_non_existent/index.js
Check [WILDCARD]index.js
TS2307 [ERROR]: Cannot find module 'file:///[WILDLINE]/test'.
at file:///[WILDLINE]/index.d.ts:1:22

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS1294 [ERROR]: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
namespace Test {
~~~~

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS1203 [WARN]: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. This will start erroring in a future version of Deno 2 in order to align with TypeScript.
export = other;
~~~~~~~~~~~~~~~

View file

@ -2,7 +2,7 @@
"tests": {
"star": {
"args": "check *.ts",
"output": "Check [WILDLINE]main.ts\n",
"output": "Check [WILDCARD]main.ts\n",
"exitCode": 0
},
"star_not_found": {
@ -12,12 +12,12 @@
},
"glob_star": {
"args": "check **/*.ts",
"output": "Check [WILDLINE]main.ts\nCheck [WILDLINE]sub_dir/main.ts\nTS2322[WILDCARD]",
"output": "Check [WILDCARD]main.ts\nTS2322[WILDCARD]",
"exitCode": 1
},
"sub_dir": {
"args": "check sub_dir",
"output": "Check [WILDLINE]sub_dir/main.ts\nTS2322[WILDCARD]",
"output": "Check [WILDCARD]main.ts\nTS2322[WILDCARD]",
"exitCode": 1
}
},

View file

@ -1,6 +1,6 @@
Download http://localhost:4545/check/import_non_existent.ts
Download http://localhost:4545/check/non-existent-module.ts
Check file:///[WILDLINE]/import_remote.ts
Check [WILDCARD]import_remote.ts
TS2307 [ERROR]: Cannot find module 'http://localhost:4545/check/non-existent-module.ts'.
at http://localhost:4545/check/import_non_existent.ts:1:22

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS9007 [ERROR]: Function must have an explicit return type annotation with --isolatedDeclarations.
export function add(a: number, b: number) {
~~~

View file

@ -1,5 +1,5 @@
Download http://localhost:4545/add.ts
Check file:///[WILDLINE]main.js
Check [WILDCARD]main.js
TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type '(a: number, b: number) => number'.
addHere("");
~~

View file

@ -1 +1 @@
Check file:///[WILDLINE]/main.tsx
Check [WILDCARD]main.tsx

View file

@ -1 +1 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts

View file

@ -1,3 +1,3 @@
Download http://localhost:4545/jsx-types/jsx-runtime
Download http://localhost:4545/jsx-types/jsx-runtime.d.ts
Check file:///[WILDLINE]/main.tsx
Check [WILDCARD]main.tsx

View file

@ -1,3 +1,3 @@
Download http://localhost:4545/jsx-types/jsx-runtime
Download http://localhost:4545/jsx-types/jsx-runtime.d.ts
Check file:///[WILDLINE]/main.tsx
Check [WILDCARD]main.tsx

View file

@ -6,7 +6,7 @@ Download http://localhost:4260/react/react-18.2.0.tgz
Download http://localhost:4260/loose-envify/loose-envify-1.4.0.tgz
Download http://localhost:4260/js-tokens/js-tokens-4.0.0.tgz
[UNORDERED_END]
Check file:///[WILDCARD]/jsx_not_checked/main.jsx
Check [WILDCARD]main.jsx
TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'number'.
console.log(add("1", "2"));
~~~

View file

@ -1,5 +1,5 @@
Download http://localhost:4545/remote.ts
Check file:///[WILDLINE]/module_not_found/main.ts
Check [WILDCARD]main.ts
TS2307 [ERROR]: Cannot find module 'file:///[WILDLINE]/other.js'.
at file:///[WILDLINE]/main.ts:1:22

View file

@ -1,5 +1,5 @@
Download http://localhost:4545/remote.ts
Check file:///[WILDLINE]/module_not_found/main.ts
Check [WILDCARD]main.ts
TS2307 [ERROR]: Cannot find module 'file:///[WILDLINE]/other.js'.
at file:///[WILDLINE]/main.ts:1:22

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/non_existent.ts
Check [WILDCARD]non_existent.ts
TS2307 [ERROR]: Cannot find module 'file:///[WILDLINE]/non_existent.ts'.
error: Type checking failed.

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS2307 [ERROR]: Cannot find module 'package'.
at file:///[WILDLINE]/main.ts:1:22

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS6053 [ERROR]: File 'file:///[WILDLINE]/non-existent.d.ts' not found.
/// <reference path="./non-existent.d.ts" />
~~~~~~~~~~~~~~~~~~~

View file

@ -1,4 +1,4 @@
Check file:///[WILDCARD]/main.ts
Check [WILDCARD]main.ts
TS4114 [ERROR]: This member must have an 'override' modifier because it overrides a member in the base class 'Greet'.
greet() {}
~~~~~

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/index.ts
Check [WILDCARD]index.ts
TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
const result: string = add(1, 2);
~~~~~~

View file

@ -1 +1 @@
Check file://[WILDCARD]/main.ts
Check [WILDCARD]main.ts

View file

@ -1,4 +1,4 @@
Download http://localhost:4260/@denotest%2fesm-basic
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
Initialize @denotest/esm-basic@1.0.0
Check file://[WILDCARD]/main.ts
Check [WILDCARD]main.ts

View file

@ -1,4 +1,4 @@
Check [WILDCARD]/main.ts
Check [WILDCARD]main.ts
TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'AsyncIterable<string> | (Iterable<string | PromiseLike<string>> & object)'.
ReadableStream.from("string");
~~~~~~~~

View file

@ -1,6 +1,6 @@
{
"args": "check --allow-import --all main.ts",
"output": "Download [WILDLINE]\nCheck [WILDLINE]\n",
"output": "Download [WILDLINE]\nCheck [WILDCARD]\n",
"variants": {
"tsgo": {
"use_tsgo": "1"

View file

@ -1 +1 @@
Check file:///[WILDCARD]/mod.ts
Check [WILDCARD]mod.ts

View file

@ -1,4 +1,4 @@
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS2322 [ERROR]: Type 'string' is not assignable to type 'Test'.
const test: Test = "";
~~~~

View file

@ -1,2 +1,2 @@
Check [WILDCARD]/mod.ts
Check [WILDCARD]/mod.ts$2-8.ts
Check [WILDCARD]mod.ts
Check [WILDCARD]mod.ts$2-8.ts

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/mod.ts
Check [WILDCARD]/mod.ts$2-5.ts
Check [WILDCARD]mod.ts
Check [WILDCARD]mod.ts$2-5.ts
TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
const sum: string = add(1, 2);
~~~

View file

@ -1,6 +1,6 @@
Check [WILDCARD]/markdown.md$11-14.js
Check [WILDCARD]/markdown.md$17-20.ts
Check [WILDCARD]/markdown.md$29-32.ts
Check [WILDCARD]markdown.md$11-14.js
Check [WILDCARD]markdown.md$17-20.ts
Check [WILDCARD]markdown.md$29-32.ts
TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
const a: string = 42;
^

View file

@ -1,2 +1,2 @@
Check [WILDCARD]/tests/specs/check/typecheck_doc_success/mod.ts
Check [WILDCARD]/tests/specs/check/typecheck_doc_success/mod.ts$2-5.ts
Check [WILDCARD]mod.ts
Check [WILDCARD]mod.ts$2-5.ts

View file

@ -1,5 +1,5 @@
[# It should be resolving relative the config in sub_dir instead of the cwd]
Check file:///[WILDLINE]/main.ts
Check [WILDCARD]main.ts
TS2307 [ERROR]: Cannot find module 'file:///[WILDLINE]/sub_dir/a.d.ts'.
at file:///[WILDLINE]/sub_dir/deno.json:1:1

Some files were not shown because too many files have changed in this diff Show more