Unverified Commit 3a2b18a9 authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

Address review: revert metadata error change, group NextConfig snapshot entries

Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent fcfaf737
......@@ -13,9 +13,20 @@ import {
// uses on affected versions anyway.
const hoistedInstall = { 'pnpm-workspace.yaml': 'nodeLinker: hoisted\n' }
// Cache Components (enabled in CI's experimental runs) reads additional config
// values, so the moved builds have a separate snapshot for it.
const isCacheComponents = process.env.__NEXT_CACHE_COMPONENTS === 'true'
// The names of the functions that executed, with all `NextConfig` getters
// collapsed into a single `NextConfig::*` entry. They all depend on the same
// config cell and re-execute together. Which getters are read also depends on
// the build mode (e.g. Cache Components), which would make the snapshots
// mode-dependent.
function functionNames(executions: TaskExecution[]): string[] {
return [
...new Set(
executedFunctionNames(executions).map((name) =>
name.startsWith('NextConfig::') ? 'NextConfig::*' : name
)
),
].sort()
}
// The Turbopack filesystem cache for `next build` should be portable: moving
// the project to another directory must not invalidate it.
......@@ -53,7 +64,7 @@ describe('turbopack-portable-build-cache', () => {
expect(coldExecutions.length).toBeGreaterThan(10_000)
const sameDirExecutions = (await tracedBuild(next)).executions
expect(executedFunctionNames(sameDirExecutions)).toMatchInlineSnapshot(`
expect(functionNames(sameDirExecutions)).toMatchInlineSnapshot(`
[
"<DiskFileSystem as FileSystem>::raw_read_dir",
"<DiskFileSystem as FileSystem>::read",
......@@ -67,9 +78,7 @@ describe('turbopack-portable-build-cache', () => {
await moveProject(next, next.testDir)
const movedExecutions = (await tracedBuild(next)).executions
const movedNames = executedFunctionNames(movedExecutions)
if (isCacheComponents) {
expect(movedNames).toMatchInlineSnapshot(`
expect(functionNames(movedExecutions)).toMatchInlineSnapshot(`
[
"<DiskFileSystem as FileSystem>::raw_read_dir",
"<DiskFileSystem as FileSystem>::read",
......@@ -78,200 +87,7 @@ describe('turbopack-portable-build-cache', () => {
"<NftJsonAsset as Asset>::content",
"<ServerNftJsonAsset as Asset>::content",
"DiskFileSystem::new_internal",
"NextConfig::asset_suffix_path",
"NextConfig::base_path",
"NextConfig::bundle_pages_router_dependencies",
"NextConfig::cache_handler",
"NextConfig::cache_handlers",
"NextConfig::cache_kinds",
"NextConfig::client_source_maps",
"NextConfig::client_static_folder_name",
"NextConfig::compiler",
"NextConfig::computed_asset_prefix",
"NextConfig::config_file_path",
"NextConfig::cross_origin",
"NextConfig::css_chunking",
"NextConfig::dist_dir",
"NextConfig::dist_dir_root",
"NextConfig::enable_cache_components",
"NextConfig::enable_concurrent_router_queue",
"NextConfig::enable_durable_use_cache_entries",
"NextConfig::enable_expose_testing_api_in_production_build",
"NextConfig::enable_immutable_assets",
"NextConfig::enable_react_production_profiling",
"NextConfig::enable_taint",
"NextConfig::enable_use_cache",
"NextConfig::enable_use_cache_static_root_param_tracking",
"NextConfig::experimental_sri",
"NextConfig::experimental_swc_env_options",
"NextConfig::experimental_swc_plugins",
"NextConfig::experimental_turbopack_local_postcss_config",
"NextConfig::experimental_turbopack_use_builtin_babel",
"NextConfig::experimental_turbopack_use_builtin_sass",
"NextConfig::explicit_parallel_route_children",
"NextConfig::from_string",
"NextConfig::image_config",
"NextConfig::import_externals",
"NextConfig::inline_css",
"NextConfig::instrumentation_client_inject",
"NextConfig::is_global_not_found_enabled",
"NextConfig::is_standalone",
"NextConfig::is_using_adapter",
"NextConfig::lightningcss_feature_flags",
"NextConfig::mdx_rs",
"NextConfig::modularize_imports",
"NextConfig::module_fragments_enabled_for_foreign_code",
"NextConfig::module_fragments_enabled_for_user_code",
"NextConfig::module_ids",
"NextConfig::optimize_package_imports",
"NextConfig::output",
"NextConfig::output_file_tracing_excludes",
"NextConfig::output_file_tracing_includes",
"NextConfig::output_hash_salt",
"NextConfig::page_extensions",
"NextConfig::react_compiler_options",
"NextConfig::report_system_env_inlining",
"NextConfig::resolve_alias_options",
"NextConfig::resolve_extension",
"NextConfig::rust_react_compiler",
"NextConfig::sass_config",
"NextConfig::server_external_packages",
"NextConfig::server_source_maps",
"NextConfig::should_append_server_deployment_id_at_runtime",
"NextConfig::strict_route_matching",
"NextConfig::transpile_packages",
"NextConfig::turbo_client_minify",
"NextConfig::turbo_nested_async_chunking",
"NextConfig::turbo_scope_hoisting",
"NextConfig::turbo_server_minify",
"NextConfig::turbo_shared_runtime",
"NextConfig::turbopack_chunk_loading_global",
"NextConfig::turbopack_chunking",
"NextConfig::turbopack_cjs_scope_hoisting",
"NextConfig::turbopack_cjs_tree_shaking",
"NextConfig::turbopack_cross_module_constants",
"NextConfig::turbopack_debug_ids",
"NextConfig::turbopack_generate_component_chunks",
"NextConfig::turbopack_ignore_issue_rules",
"NextConfig::turbopack_import_type_bytes",
"NextConfig::turbopack_infer_module_side_effects",
"NextConfig::turbopack_lazy_dynamic_imports",
"NextConfig::turbopack_lazy_dynamic_imports_ssr",
"NextConfig::turbopack_mangle_export_names",
"NextConfig::turbopack_mangle_via_materialized_namespace_object",
"NextConfig::turbopack_plugin_runtime_strategy",
"NextConfig::turbopack_remove_unused_exports",
"NextConfig::turbopack_remove_unused_imports",
"NextConfig::turbopack_worker_asset_prefix",
"NextConfig::typescript_tsconfig_path",
"NextConfig::use_react_experimental",
"NextConfig::webpack_rules",
"ProjectContainer::project",
"emit_all_output_assets_once_with_issues_operation",
"get_all_written_entrypoints_with_issues_operation",
"inner_entrypoints_without_collectibles_operation",
"project_root_path_operation",
"uppercase_env_map",
]
`)
return
}
expect(movedNames).toMatchInlineSnapshot(`
[
"<DiskFileSystem as FileSystem>::raw_read_dir",
"<DiskFileSystem as FileSystem>::read",
"<DiskFileSystem as FileSystem>::write",
"<DiskFileSystem as turbo_tasks :: ValueToString>::to_string",
"<NftJsonAsset as Asset>::content",
"<ServerNftJsonAsset as Asset>::content",
"DiskFileSystem::new_internal",
"NextConfig::asset_suffix_path",
"NextConfig::base_path",
"NextConfig::bundle_pages_router_dependencies",
"NextConfig::cache_handler",
"NextConfig::cache_handlers",
"NextConfig::cache_kinds",
"NextConfig::client_source_maps",
"NextConfig::client_static_folder_name",
"NextConfig::compiler",
"NextConfig::computed_asset_prefix",
"NextConfig::config_file_path",
"NextConfig::cross_origin",
"NextConfig::css_chunking",
"NextConfig::dist_dir",
"NextConfig::dist_dir_root",
"NextConfig::enable_cache_components",
"NextConfig::enable_concurrent_router_queue",
"NextConfig::enable_durable_use_cache_entries",
"NextConfig::enable_expose_testing_api_in_production_build",
"NextConfig::enable_immutable_assets",
"NextConfig::enable_react_production_profiling",
"NextConfig::enable_taint",
"NextConfig::enable_use_cache",
"NextConfig::experimental_sri",
"NextConfig::experimental_swc_env_options",
"NextConfig::experimental_swc_plugins",
"NextConfig::experimental_turbopack_local_postcss_config",
"NextConfig::experimental_turbopack_use_builtin_babel",
"NextConfig::experimental_turbopack_use_builtin_sass",
"NextConfig::explicit_parallel_route_children",
"NextConfig::from_string",
"NextConfig::image_config",
"NextConfig::import_externals",
"NextConfig::inline_css",
"NextConfig::instrumentation_client_inject",
"NextConfig::is_global_not_found_enabled",
"NextConfig::is_standalone",
"NextConfig::is_using_adapter",
"NextConfig::lightningcss_feature_flags",
"NextConfig::mdx_rs",
"NextConfig::modularize_imports",
"NextConfig::module_fragments_enabled_for_foreign_code",
"NextConfig::module_fragments_enabled_for_user_code",
"NextConfig::module_ids",
"NextConfig::optimize_package_imports",
"NextConfig::output",
"NextConfig::output_file_tracing_excludes",
"NextConfig::output_file_tracing_includes",
"NextConfig::output_hash_salt",
"NextConfig::page_extensions",
"NextConfig::react_compiler_options",
"NextConfig::report_system_env_inlining",
"NextConfig::resolve_alias_options",
"NextConfig::resolve_extension",
"NextConfig::rust_react_compiler",
"NextConfig::sass_config",
"NextConfig::server_external_packages",
"NextConfig::server_source_maps",
"NextConfig::should_append_server_deployment_id_at_runtime",
"NextConfig::strict_route_matching",
"NextConfig::transpile_packages",
"NextConfig::turbo_client_minify",
"NextConfig::turbo_nested_async_chunking",
"NextConfig::turbo_scope_hoisting",
"NextConfig::turbo_server_minify",
"NextConfig::turbo_shared_runtime",
"NextConfig::turbopack_chunk_loading_global",
"NextConfig::turbopack_chunking",
"NextConfig::turbopack_cjs_scope_hoisting",
"NextConfig::turbopack_cjs_tree_shaking",
"NextConfig::turbopack_cross_module_constants",
"NextConfig::turbopack_debug_ids",
"NextConfig::turbopack_generate_component_chunks",
"NextConfig::turbopack_ignore_issue_rules",
"NextConfig::turbopack_import_type_bytes",
"NextConfig::turbopack_infer_module_side_effects",
"NextConfig::turbopack_lazy_dynamic_imports",
"NextConfig::turbopack_lazy_dynamic_imports_ssr",
"NextConfig::turbopack_mangle_export_names",
"NextConfig::turbopack_mangle_via_materialized_namespace_object",
"NextConfig::turbopack_plugin_runtime_strategy",
"NextConfig::turbopack_remove_unused_exports",
"NextConfig::turbopack_remove_unused_imports",
"NextConfig::turbopack_worker_asset_prefix",
"NextConfig::typescript_tsconfig_path",
"NextConfig::use_react_experimental",
"NextConfig::webpack_rules",
"NextConfig::*",
"ProjectContainer::project",
"emit_all_output_assets_once_with_issues_operation",
"get_all_written_entrypoints_with_issues_operation",
......@@ -378,7 +194,7 @@ describe('turbopack-portable-build-cache', () => {
expect(cold.executions.length).toBeGreaterThan(10_000)
const sameDir = await tracedBuild(next)
expect(executedFunctionNames(sameDir.executions)).toMatchInlineSnapshot(`
expect(functionNames(sameDir.executions)).toMatchInlineSnapshot(`
[
"<DiskFileSystem as FileSystem>::raw_read_dir",
"<DiskFileSystem as FileSystem>::read",
......@@ -397,124 +213,7 @@ describe('turbopack-portable-build-cache', () => {
await moveProject(next, workspaceRoot())
const moved = await tracedBuild(next)
await expectAllFeatures(moved.cliOutput)
const movedNames = executedFunctionNames(moved.executions)
if (isCacheComponents) {
expect(movedNames).toMatchInlineSnapshot(`
[
"<DiskFileSystem as FileSystem>::raw_read_dir",
"<DiskFileSystem as FileSystem>::read",
"<DiskFileSystem as FileSystem>::read_link",
"<DiskFileSystem as FileSystem>::write",
"<DiskFileSystem as turbo_tasks :: ValueToString>::to_string",
"<EnvMap as ProcessEnv>::read_all",
"<NftJsonAsset as Asset>::content",
"<ServerNftJsonAsset as Asset>::content",
"DiskFileSystem::new_internal",
"NextConfig::asset_suffix_path",
"NextConfig::base_path",
"NextConfig::bundle_pages_router_dependencies",
"NextConfig::cache_handler",
"NextConfig::cache_handlers",
"NextConfig::cache_kinds",
"NextConfig::client_source_maps",
"NextConfig::client_static_folder_name",
"NextConfig::compiler",
"NextConfig::computed_asset_prefix",
"NextConfig::config_file_path",
"NextConfig::cross_origin",
"NextConfig::css_chunking",
"NextConfig::dist_dir",
"NextConfig::dist_dir_root",
"NextConfig::enable_cache_components",
"NextConfig::enable_concurrent_router_queue",
"NextConfig::enable_durable_use_cache_entries",
"NextConfig::enable_expose_testing_api_in_production_build",
"NextConfig::enable_immutable_assets",
"NextConfig::enable_react_production_profiling",
"NextConfig::enable_taint",
"NextConfig::enable_use_cache",
"NextConfig::enable_use_cache_static_root_param_tracking",
"NextConfig::experimental_sri",
"NextConfig::experimental_swc_env_options",
"NextConfig::experimental_swc_plugins",
"NextConfig::experimental_turbopack_local_postcss_config",
"NextConfig::experimental_turbopack_use_builtin_babel",
"NextConfig::experimental_turbopack_use_builtin_sass",
"NextConfig::explicit_parallel_route_children",
"NextConfig::from_string",
"NextConfig::i18n",
"NextConfig::image_config",
"NextConfig::import_externals",
"NextConfig::inline_css",
"NextConfig::instrumentation_client_inject",
"NextConfig::is_global_not_found_enabled",
"NextConfig::is_standalone",
"NextConfig::is_using_adapter",
"NextConfig::lightningcss_feature_flags",
"NextConfig::mdx_rs",
"NextConfig::modularize_imports",
"NextConfig::module_fragments_enabled_for_foreign_code",
"NextConfig::module_fragments_enabled_for_user_code",
"NextConfig::module_ids",
"NextConfig::optimize_package_imports",
"NextConfig::output",
"NextConfig::output_file_tracing_excludes",
"NextConfig::output_file_tracing_includes",
"NextConfig::output_hash_salt",
"NextConfig::page_extensions",
"NextConfig::react_compiler_options",
"NextConfig::report_system_env_inlining",
"NextConfig::resolve_alias_options",
"NextConfig::resolve_extension",
"NextConfig::rust_react_compiler",
"NextConfig::sass_config",
"NextConfig::server_external_packages",
"NextConfig::server_source_maps",
"NextConfig::should_append_server_deployment_id_at_runtime",
"NextConfig::strict_route_matching",
"NextConfig::transpile_packages",
"NextConfig::turbo_client_minify",
"NextConfig::turbo_edge_minify",
"NextConfig::turbo_nested_async_chunking",
"NextConfig::turbo_scope_hoisting",
"NextConfig::turbo_server_minify",
"NextConfig::turbo_shared_runtime",
"NextConfig::turbopack_chunk_loading_global",
"NextConfig::turbopack_chunking",
"NextConfig::turbopack_cjs_scope_hoisting",
"NextConfig::turbopack_cjs_tree_shaking",
"NextConfig::turbopack_cross_module_constants",
"NextConfig::turbopack_debug_ids",
"NextConfig::turbopack_generate_component_chunks",
"NextConfig::turbopack_ignore_issue_rules",
"NextConfig::turbopack_import_type_bytes",
"NextConfig::turbopack_infer_module_side_effects",
"NextConfig::turbopack_lazy_dynamic_imports",
"NextConfig::turbopack_lazy_dynamic_imports_ssr",
"NextConfig::turbopack_mangle_export_names",
"NextConfig::turbopack_mangle_via_materialized_namespace_object",
"NextConfig::turbopack_plugin_runtime_strategy",
"NextConfig::turbopack_remove_unused_exports",
"NextConfig::turbopack_remove_unused_imports",
"NextConfig::turbopack_worker_asset_prefix",
"NextConfig::typescript_tsconfig_path",
"NextConfig::use_react_experimental",
"NextConfig::webpack_rules",
"ProjectContainer::project",
"common_node_env",
"create_evaluate_pool_assets_operation",
"emit_all_output_assets_once_with_issues_operation",
"evaluate_webpack_loader",
"get_all_written_entrypoints_with_issues_operation",
"get_evaluate_pool",
"inner_entrypoints_without_collectibles_operation",
"project_root_path_operation",
"uppercase_env_map",
]
`)
return
}
expect(movedNames).toMatchInlineSnapshot(`
expect(functionNames(moved.executions)).toMatchInlineSnapshot(`
[
"<DiskFileSystem as FileSystem>::raw_read_dir",
"<DiskFileSystem as FileSystem>::read",
......@@ -525,95 +224,7 @@ describe('turbopack-portable-build-cache', () => {
"<NftJsonAsset as Asset>::content",
"<ServerNftJsonAsset as Asset>::content",
"DiskFileSystem::new_internal",
"NextConfig::asset_suffix_path",
"NextConfig::base_path",
"NextConfig::bundle_pages_router_dependencies",
"NextConfig::cache_handler",
"NextConfig::cache_handlers",
"NextConfig::cache_kinds",
"NextConfig::client_source_maps",
"NextConfig::client_static_folder_name",
"NextConfig::compiler",
"NextConfig::computed_asset_prefix",
"NextConfig::config_file_path",
"NextConfig::cross_origin",
"NextConfig::css_chunking",
"NextConfig::dist_dir",
"NextConfig::dist_dir_root",
"NextConfig::enable_cache_components",
"NextConfig::enable_concurrent_router_queue",
"NextConfig::enable_durable_use_cache_entries",
"NextConfig::enable_expose_testing_api_in_production_build",
"NextConfig::enable_immutable_assets",
"NextConfig::enable_react_production_profiling",
"NextConfig::enable_taint",
"NextConfig::enable_use_cache",
"NextConfig::experimental_sri",
"NextConfig::experimental_swc_env_options",
"NextConfig::experimental_swc_plugins",
"NextConfig::experimental_turbopack_local_postcss_config",
"NextConfig::experimental_turbopack_use_builtin_babel",
"NextConfig::experimental_turbopack_use_builtin_sass",
"NextConfig::explicit_parallel_route_children",
"NextConfig::from_string",
"NextConfig::i18n",
"NextConfig::image_config",
"NextConfig::import_externals",
"NextConfig::inline_css",
"NextConfig::instrumentation_client_inject",
"NextConfig::is_global_not_found_enabled",
"NextConfig::is_standalone",
"NextConfig::is_using_adapter",
"NextConfig::lightningcss_feature_flags",
"NextConfig::mdx_rs",
"NextConfig::modularize_imports",
"NextConfig::module_fragments_enabled_for_foreign_code",
"NextConfig::module_fragments_enabled_for_user_code",
"NextConfig::module_ids",
"NextConfig::optimize_package_imports",
"NextConfig::output",
"NextConfig::output_file_tracing_excludes",
"NextConfig::output_file_tracing_includes",
"NextConfig::output_hash_salt",
"NextConfig::page_extensions",
"NextConfig::react_compiler_options",
"NextConfig::report_system_env_inlining",
"NextConfig::resolve_alias_options",
"NextConfig::resolve_extension",
"NextConfig::rust_react_compiler",
"NextConfig::sass_config",
"NextConfig::server_external_packages",
"NextConfig::server_source_maps",
"NextConfig::should_append_server_deployment_id_at_runtime",
"NextConfig::strict_route_matching",
"NextConfig::transpile_packages",
"NextConfig::turbo_client_minify",
"NextConfig::turbo_edge_minify",
"NextConfig::turbo_nested_async_chunking",
"NextConfig::turbo_scope_hoisting",
"NextConfig::turbo_server_minify",
"NextConfig::turbo_shared_runtime",
"NextConfig::turbopack_chunk_loading_global",
"NextConfig::turbopack_chunking",
"NextConfig::turbopack_cjs_scope_hoisting",
"NextConfig::turbopack_cjs_tree_shaking",
"NextConfig::turbopack_cross_module_constants",
"NextConfig::turbopack_debug_ids",
"NextConfig::turbopack_generate_component_chunks",
"NextConfig::turbopack_ignore_issue_rules",
"NextConfig::turbopack_import_type_bytes",
"NextConfig::turbopack_infer_module_side_effects",
"NextConfig::turbopack_lazy_dynamic_imports",
"NextConfig::turbopack_lazy_dynamic_imports_ssr",
"NextConfig::turbopack_mangle_export_names",
"NextConfig::turbopack_mangle_via_materialized_namespace_object",
"NextConfig::turbopack_plugin_runtime_strategy",
"NextConfig::turbopack_remove_unused_exports",
"NextConfig::turbopack_remove_unused_imports",
"NextConfig::turbopack_worker_asset_prefix",
"NextConfig::typescript_tsconfig_path",
"NextConfig::use_react_experimental",
"NextConfig::webpack_rules",
"NextConfig::*",
"ProjectContainer::project",
"common_node_env",
"create_evaluate_pool_assets_operation",
......@@ -642,8 +253,8 @@ const env = {
// server-action-dependent work, depending on the environment.
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY:
'cG9ydGFibGUtYnVpbGQtY2FjaGUtdGVzdC1rZXktMzI=',
// Build telemetry reads additional config values, which would make the
// snapshots depend on whether telemetry is enabled.
// Keep the build independent of the local telemetry setting (CI disables
// it); build telemetry reads additional config values.
NEXT_TELEMETRY_DISABLED: '1',
}
......
......@@ -27,7 +27,7 @@ use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{
CapturedEffect, Completion, Effect, EffectExt, EffectStateStorage, InvalidationReason,
Invalidator, NonLocalValue, OperationVc, ReadRef, ResolvedVc, TurboTasksApi, ValueToString, Vc,
debug::ValueDebugFormat, turbo_tasks_weak, turbobail, turbofmt,
debug::ValueDebugFormat, turbo_tasks_weak, turbobail,
};
use turbo_tasks_hash::{hash_xxh3_hash64, hash_xxh3_hash128};
use turbo_unix_path::{normalize_path, sys_to_unix, unix_to_sys};
......@@ -1711,19 +1711,11 @@ impl FileSystem for DiskFileSystem {
self.inner.register_read_invalidator(&full_path).await?;
let _lock = self.inner.lock_path(full_path.clone()).await;
let meta = match retry_blocking(|| std::fs::metadata(&**full_path))
let meta = retry_blocking(|| std::fs::metadata(&**full_path))
.instrument(tracing::info_span!("read metadata", name = ?full_path))
.concurrency_limited(&self.inner.read_semaphore)
.await
{
Ok(meta) => meta,
// The error is part of this task's output. Use the location-independent path instead
// of the absolute one, so that the output doesn't change when the project is moved.
Err(err) => {
let message = turbofmt!("reading metadata for {fs_path}").await?;
return Err(anyhow::Error::new(err).context(message));
}
};
.with_context(|| format!("reading metadata for {:?}", full_path))?;
Ok(FileMeta::cell(meta.into()))
}
......@@ -1885,47 +1877,6 @@ mod tests {
Ok(())
}
/// The error of a failed `metadata` call is part of the task output, so it must not contain
/// the absolute root path. Otherwise moving the project would invalidate every dependent.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_metadata_error_is_location_independent() {
let root = tempfile::tempdir().unwrap();
let root = RcStr::from(root.path().to_str().unwrap());
let tt = turbo_tasks::TurboTasks::new(TurboTasksBackend::new(
BackendOptions::default(),
noop_backing_storage(),
));
tt.run_once(async move {
let error = metadata_error_operation(root.clone())
.read_strongly_consistent()
.await?;
assert!(
error.contains("reading metadata for [project]/missing.json"),
"unexpected error: {error}"
);
assert!(
!error.contains(root.as_str()),
"error contains the absolute root path: {error}"
);
anyhow::Ok(())
})
.await
.unwrap();
}
#[turbo_tasks::function(operation, root)]
async fn metadata_error_operation(sys_root: RcStr) -> anyhow::Result<Vc<RcStr>> {
let fs = DiskFileSystem::new(rcstr!("project"), Vc::cell(sys_root));
let path = fs.root().await?.join("missing.json")?;
let error = path
.metadata()
.await
.err()
.context("expected reading the metadata of a missing file to fail")?;
Ok(Vc::cell(format!("{error:#}").into()))
}
#[cfg(test)]
mod symlink_tests {
use std::{
......
......@@ -246,10 +246,6 @@ pub async fn resolve_options(
TsConfigHandling::Disabled => resolve_options,
TsConfigHandling::ContextFile => find_tsconfig().await?,
TsConfigHandling::Fixed(tsconfig_path) => {
// Check existence via the entry type (derived from the parent directory listing)
// instead of reading the file's metadata. This is cheaper, and doesn't depend on
// the error that reading the metadata of a missing file returns.
//
// A symlink counts as existing, even if it's dangling: reading it will fail
// loudly instead of silently ignoring it. A failure to read the parent directory
// is treated like a missing file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment