Skip to content

feat(test): go test coverage to be 100%. - #1845

Merged
samchon merged 15 commits into
nextfrom
test/coverage
May 11, 2026
Merged

samchon merged 15 commits into
nextfrom
test/coverage

Conversation

@samchon

@samchon samchon commented May 10, 2026 •

Copy link
Copy Markdown
Owner

This pull request introduces significant improvements to the native adapter's test coverage and code organization, especially around the TypeScript transformation cleanup logic. It moves and refactors the TypeScript cleanup logic to a more appropriate location, and adds comprehensive unit tests for the adapter's behavior, including import injection, cleanup correctness, and option handling. Additionally, it updates the test workflow and scripts to ensure new tests are run.

Refactoring and Code Organization:

  • Moved and refactored the TypeScript transformation cleanup logic from packages/typia/native/cmd/ttsc-typia/transform.go to packages/typia/native/adapter/cleanup.go, encapsulating it as CleanupTypeScriptTransformText and its helper, and simplifying the transform command to delegate to this new function. [1] [2] [3]

Test Coverage Improvements:

  • Added a suite of targeted unit tests in packages/typia/test/adapter/cleanup/ to verify:

    • Correct injection of runtime imports for both ESM and CommonJS output (cleanup_injects_es_module_runtime_imports_test.go, cleanup_injects_runtime_imports_test.go) [1] [2]
    • Proper removal of unused typia imports and preservation of referenced imports (cleanup_removes_unused_typia_imports_test.go, cleanup_preserves_referenced_typia_imports_test.go) [1] [2]
    • Normalization of parenthesized return types in transformed TypeScript (transform_cleanup_test.go)
  • Added adapter-level tests in packages/typia/test/adapter/options/ and packages/typia/test/adapter/visit/ to verify:

    • No-op behavior for incomplete program inputs (adapter_emit_call_with_options_ignores_incomplete_program_test.go)
    • Correct formatting of transform errors and plugin option projection (adapter_format_transform_error_includes_module_path_test.go, adapter_plugin_options_transform_options_test.go) [1] [2]
    • Proper unsupported reason reporting and call-site collection logic (adapter_unsupported_reason_rejects_invalid_call_test.go, adapter_collect_call_sites_ignores_nil_inputs_test.go) [1] [2]

Build and Workflow Updates:

  • Updated the GitHub Actions test workflow and package.json scripts to ensure new Go-based adapter tests are run as part of the CI process, and adjusted the test command to include both package and toolchain (Go) tests. [1] [2]

These changes collectively improve the maintainability, reliability, and correctness of the native adapter's transformation and testing infrastructure.

@samchon samchon self-assigned this May 10, 2026
@samchon samchon added the enhancement New feature or request label May 10, 2026
@samchon samchon changed the title feat(test): go test coverage to be 100. feat(test): go test coverage to be 100%. May 11, 2026
samchon added 11 commits May 11, 2026 14:40
* deps(ttsc): bump up `ttsc@0.10.0`

* fix by `ttsc@0.10.0` logic.

* fix shim and testing problem

* publish next version

* fix tsconfig.json bugs

* fix bugs

* more tsconfig.json file config.

* fix one thing more

* fix format

* fix ci error
@samchon
samchon marked this pull request as ready for review May 11, 2026 07:02
Copilot AI review requested due to automatic review settings May 11, 2026 07:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to improve the Go-side test coverage for typia’s native toolchain and adapter behaviors, and to centralize TypeScript transform text cleanup logic inside the native adapter.

Changes:

  • Refactors TypeScript transform cleanup by moving the cleanup pipeline into packages/typia/native/adapter/cleanup.go and delegating from the ttsc-typia command.
  • Adds a large suite of Go unit tests targeting adapter behaviors, metadata DTO round-trips, and protobuf/helper utilities.
  • Updates CI/test scripts to run Go tests from the new packages/typia/test Go module as part of pnpm test.

Reviewed changes

Copilot reviewed 128 out of 128 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/tsconfig.rspack.json Adjusts TypeScript ignoreDeprecations setting for the website build.
website/tsconfig.json Adjusts TypeScript ignoreDeprecations setting for the website build.
packages/typia/test/utils/protobuf/protobuf_name_encoder_round_trip_test.go Adds a round-trip test for protobuf name encoding/decoding helpers.
packages/typia/test/utils/pattern/pattern_util_fix_and_escape_test.go Adds tests for regex pattern anchoring and escaping utilities.
packages/typia/test/typings/writable_returns_input_test.go Adds tests for Writable runtime identity behavior.
packages/typia/test/native/transform/typia_generator_helpers_coverage_test.go Adds internal-coverage tests for generator filesystem helpers (currently mislocated under the test module).
packages/typia/test/native/transform/import_transformer_coverage_test.go Adds internal-coverage tests for import rewrite helpers (currently mislocated under the test module).
packages/typia/test/native/transform/file_transformer_coverage_test.go Adds internal-coverage tests for file-level transformer scaffolding (currently mislocated under the test module).
packages/typia/test/native/transform/features/reflect/reflect_transformer_entry_coverage_test.go Adds internal-coverage tests for reflect transformer entrypoints (currently mislocated under the test module).
packages/typia/test/native/transform/features/reflect/reflect_metadata_transformer_edge_branches_test.go Adds internal-coverage tests for reflect metadata edge branches (currently mislocated under the test module).
packages/typia/test/native/transform/features/protobuf/protobuf_transformer_entry_coverage_test.go Adds internal-coverage tests for protobuf transformer entrypoints (currently mislocated under the test module).
packages/typia/test/native/transform/features/notations/notation_transformer_entry_coverage_test.go Adds internal-coverage tests for notation transformer entrypoints (currently mislocated under the test module).
packages/typia/test/native/transform/features/misc/misc_transformer_entry_coverage_test.go Adds internal-coverage tests for misc transformer entrypoints (currently mislocated under the test module).
packages/typia/test/native/transform/features/llm/llm_transformer_entry_coverage_test.go Adds internal-coverage tests for LLM transformer entrypoints (currently mislocated under the test module).
packages/typia/test/native/transform/features/json/json_transformer_entry_coverage_test.go Adds internal-coverage tests for JSON transformer entrypoints (currently mislocated under the test module).
packages/typia/test/native/transform/features/http/http_transformer_entry_coverage_test.go Adds internal-coverage tests for HTTP transformer entrypoints (currently mislocated under the test module).
packages/typia/test/native/transform/features/feature_transformer_entry_coverage_test.go Adds internal-coverage tests for root feature transformer entrypoints (currently mislocated under the test module).
packages/typia/test/native/transform/call_expression_transformer_registry_coverage_test.go Adds internal-coverage tests for call-expression registry helpers (currently mislocated under the test module).
packages/typia/test/native/core/schemas/protobuf/protobuf_marker_coverage_test.go Adds internal-coverage tests to exercise protobuf marker methods (currently mislocated under the test module).
packages/typia/test/native/core/programmers/programmer_direct_helper_coverage_test.go Adds internal-coverage tests for direct programmer helpers (currently mislocated under the test module).
packages/typia/test/native/core/programmers/misc/misc_prune_programmer_branch_matrix_test.go Adds internal-coverage tests for prune programmer recursive branches (currently mislocated under the test module).
packages/typia/test/native/core/programmers/iterate/iterate_check_coverage_test.go Adds internal-coverage tests for iterate dynamic/union check helpers (currently mislocated under the test module).
packages/typia/test/native/core/programmers/iterate/check_dynamic_key_tag_rows_test.go Adds internal-coverage tests for dynamic key tag-row filtering (currently mislocated under the test module).
packages/typia/test/native/core/programmers/import_programmer_statement_coverage_test.go Adds internal-coverage tests for import statement assembly (currently mislocated under the test module).
packages/typia/test/native/core/programmers/http/http_programmer_helper_coverage_test.go Adds internal-coverage tests for HTTP programmer helpers (currently mislocated under the test module).
packages/typia/test/native/core/programmers/helpers/union_explorer_coverage_test.go Adds internal-coverage tests for union explorer helpers (currently mislocated under the test module).
packages/typia/test/native/core/programmers/helpers/joiner_branch_coverage_test.go Adds internal-coverage tests for joiner helper branches (currently mislocated under the test module).
packages/typia/test/native/core/programmers/functional/functional_assert_helper_coverage_test.go Adds internal-coverage tests for functional assert helper lookup (currently mislocated under the test module).
packages/typia/test/native/core/factories/internal/metadata/sort_constants_coverage_test.go Adds internal-coverage tests for metadata constant sorting (currently mislocated under the test module).
packages/typia/test/native/core/factories/internal/metadata/optional_coalesce_coverage_test.go Adds internal-coverage tests for optional coalesce dispatch (currently mislocated under the test module).
packages/typia/test/native/core/factories/internal/metadata/iterate_metadata_intersection_coverage_test.go Adds internal-coverage tests for intersection tag helpers/analyzer dispatch (currently mislocated under the test module).
packages/typia/test/native/core/factories/internal/metadata/iterate_metadata_collection_branch_matrix_test.go Adds internal-coverage tests for recursion detection over schema graphs (currently mislocated under the test module).
packages/typia/test/native/core/factories/internal/metadata/comment_tags_coverage_test.go Adds internal-coverage tests for comment-tag application and JSDoc parsing (currently mislocated under the test module).
packages/typia/test/native/core/context/transformer_error_formatting_test.go Adds internal-coverage tests for transformer error formatting (currently mislocated under the test module).
packages/typia/test/native/cmd/ttsc-typia/transform_declaration_source_produces_no_js_test.go Adds internal-coverage tests for CLI transform behavior (currently mislocated under the test module).
packages/typia/test/native/cmd/ttsc-typia/run_default_build_route_test.go Adds internal-coverage tests for CLI argument dispatch (currently mislocated under the test module).
packages/typia/test/native/cmd/ttsc-typia/project_catalog_transform_coverage_test.go Adds internal-coverage tests for running existing TS catalogs through transform (currently mislocated under the test module).
packages/typia/test/native/cmd/ttsc-typia/plugin_options_missing_config_test.go Adds internal-coverage tests for plugin option fallback (currently mislocated under the test module).
packages/typia/test/native/cmd/ttsc-typia/main_exit_coverage_test.go Adds internal-coverage tests for main() exit wrapper (currently mislocated under the test module).
packages/typia/test/native/cmd/ttsc-typia/demo_rejects_bad_flag_test.go Adds internal-coverage tests for demo flag parsing (currently mislocated under the test module).
packages/typia/test/native/cmd/ttsc-typia/build_reports_syntactic_diagnostics_test.go Adds internal-coverage tests for syntactic diagnostic handling (currently mislocated under the test module).
packages/typia/test/native/cmd/ttsc-typia/build_reports_semantic_diagnostics_test.go Adds internal-coverage tests for semantic diagnostic handling (currently mislocated under the test module).
packages/typia/test/native/adapter/visit_property_chain_edges_test.go Adds internal-coverage tests for call-site property-chain parsing (currently mislocated under the test module).
packages/typia/test/native/adapter/commonjs_import_substitution_matrix_test.go Adds internal-coverage tests for CommonJS import substitution rules (currently mislocated under the test module).
packages/typia/test/native/adapter/cleanup_printed_expression_matrix_test.go Adds internal-coverage tests for printed expression normalization (currently mislocated under the test module).
packages/typia/test/native/adapter/cleanup_branch_matrix_test.go Adds internal-coverage tests for cleanup helper edge cases (currently mislocated under the test module).
packages/typia/test/native/adapter/adapter_options_branch_matrix_test.go Adds internal-coverage tests for adapter options/error formatting (currently mislocated under the test module).
packages/typia/test/metadata/schema/metadata_schema_unalias_chases_single_required_alias_test.go Adds tests for schema unalias behavior.
packages/typia/test/metadata/schema/metadata_schema_sole_literal_and_size_test.go Adds tests for literal metadata size/bucket helpers.
packages/typia/test/metadata/schema/metadata_schema_merge_deduplicates_constants_test.go Adds tests for constant deduplication during merge.
packages/typia/test/metadata/schema/metadata_schema_json_round_trip_for_primitive_buckets_test.go Adds JSON DTO round-trip tests for primitive buckets.
packages/typia/test/metadata/schema/metadata_schema_is_union_bucket_merges_atomic_constants_test.go Adds tests for union-bucket classification rules.
packages/typia/test/metadata/schema/metadata_schema_intersects_primitives_test.go Adds tests for primitive intersection logic.
packages/typia/test/metadata/schema/metadata_schema_initialize_defaults_test.go Adds tests for initializer defaults and invariants.
packages/typia/test/metadata/schema/metadata_schema_get_name_sorts_union_members_test.go Adds tests for stable/sorted union name formatting.
packages/typia/test/metadata/schema/metadata_schema_empty_reflects_bucket_and_size_test.go Adds tests for empty-schema detection.
packages/typia/test/metadata/schema/metadata_schema_covers_constants_with_atomic_bucket_test.go Adds tests for “covers” rules between atomic/constant buckets.
packages/typia/test/metadata/object/metadata_object_type_sanitizes_invalid_utf8_names_test.go Adds tests for invalid UTF-8 name sanitization.
packages/typia/test/metadata/object/metadata_object_type_plain_object_edges_test.go Adds edge-case tests for plain object classification.
packages/typia/test/metadata/object/metadata_object_type_plain_object_detection_test.go Adds “happy path” tests for plain object detection.
packages/typia/test/metadata/object/metadata_object_type_literal_name_rules_test.go Adds tests for literal-object naming rules.
packages/typia/test/metadata/object/metadata_object_type_intersects_and_covers_properties_test.go Adds tests for object intersects/covers property logic.
packages/typia/test/metadata/names/metadata_template_base_name_escapes_literals_test.go Adds tests for template base-name escaping/formatting.
packages/typia/test/metadata/names/metadata_native_get_name_formats_tags_test.go Adds tests for native type name + tag formatting.
packages/typia/test/metadata/names/metadata_map_and_set_get_name_with_tags_test.go Adds tests for map/set name composition with tags.
packages/typia/test/metadata/names/metadata_constant_value_get_name_quotes_and_tags_test.go Adds tests for constant value quoting and tag display.
packages/typia/test/metadata/names/metadata_atomic_get_name_formats_tags_test.go Adds tests for atomic name formatting with tags.
packages/typia/test/metadata/names/metadata_array_object_alias_get_name_with_tags_test.go Adds tests for reference-name formatting with tags.
packages/typia/test/metadata/components/metadata_type_without_value_constructors_test.go Adds tests for “without value” component constructors.
packages/typia/test/metadata/components/metadata_tuple_type_rest_and_json_test.go Adds tests for tuple rest detection and JSON serialization.
packages/typia/test/metadata/components/metadata_references_to_json_preserve_tags_test.go Adds tests ensuring reference DTOs preserve tags.
packages/typia/test/metadata/components/metadata_property_json_round_trip_test.go Adds tests for property DTO JSON round-trip.
packages/typia/test/metadata/components/metadata_function_parameter_json_round_trip_test.go Adds tests for function metadata DTO JSON round-trip.
packages/typia/test/metadata/components/metadata_escaped_json_round_trip_test.go Adds tests for escaped metadata DTO JSON round-trip.
packages/typia/test/metadata/components/metadata_components_from_resolves_references_test.go Adds tests for component dictionary restoration.
packages/typia/test/metadata/components/metadata_collection_tracks_union_indices_test.go Adds tests for union index tracking and clone behavior.
packages/typia/test/metadata/components/metadata_collection_replaces_and_escapes_special_names_test.go Adds tests for name replacement/escape utilities.
packages/typia/test/metadata/application/metadata_application_json_round_trip_test.go Adds tests for application DTO conversion.
packages/typia/test/internal/testutil/helpers.go Introduces shared Go test helpers and metadata constructors.
packages/typia/test/helpers/protobuf/protobuf_util_static_object_requires_literal_keys_test.go Adds tests for protobuf static object constraints.
packages/typia/test/helpers/protobuf/protobuf_util_size_and_union_for_object_map_mix_test.go Adds tests for protobuf size/union classification for mixed buckets.
packages/typia/test/helpers/protobuf/protobuf_util_numeric_constant_deduction_test.go Adds tests for numeric constant scalar deduction.
packages/typia/test/helpers/protobuf/protobuf_util_get_sequence_accepts_numeric_shapes_test.go Adds tests for sequence-tag parsing across numeric shapes.
packages/typia/test/helpers/protobuf/protobuf_util_explicit_bigint_type_tags_test.go Adds tests for explicit bigint type-tag precedence.
packages/typia/test/helpers/protobuf/protobuf_util_branch_matrix_test.go Adds branch-matrix tests for scalar extraction fallbacks.
packages/typia/test/helpers/protobuf/protobuf_util_bigint_constant_deduction_test.go Adds tests for signed/unsigned bigint constant deduction.
packages/typia/test/helpers/protobuf/protobuf_util_atomics_and_sequences_test.go Adds tests for atomic extraction and sequence preservation.
packages/typia/test/helpers/protobuf/http_metadata_util_atomics_and_union_test.go Adds tests for HTTP metadata util aggregation/union logic.
packages/typia/test/helpers/programmer/function_programmer_tracks_locals_and_sequence_test.go Adds tests for function programmer bookkeeping.
packages/typia/test/helpers/programmer/function_programmer_disable_declare_handles_nil_test.go Adds tests for nil-safe declare-disabling helper.
packages/typia/test/helpers/programmer/function_programmer_disable_declare_copies_state_test.go Adds tests ensuring declare disabling doesn’t mutate original programmer.
packages/typia/test/helpers/predicator/stringify_predicator_detects_escape_and_undefined_test.go Adds tests for stringify escape + undefinable predicates.
packages/typia/test/helpers/predicator/option_predicator_defaults_and_flags_test.go Adds tests for option predicate defaults and flag behavior.
packages/typia/test/helpers/predicator/atomic_predicator_rejects_native_overlaps_test.go Adds tests for filtering primitive/native overlaps.
packages/typia/test/helpers/predicator/atomic_predicator_recognizes_primitive_native_names_test.go Adds tests for primitive native-name detection.
packages/typia/test/go.work.sum Adds workspace dependency checksums for Go toolchain testing.
packages/typia/test/go.work Introduces a Go workspace for the test module and local shim replacements.
packages/typia/test/go.mod Introduces a dedicated Go module for the new Go test suite.
packages/typia/test/contract/package/package_contract_test.go Adds a contract test validating package publishing/plugin metadata invariants.
packages/typia/test/adapter/visit/adapter_collect_call_sites_ignores_nil_inputs_test.go Adds adapter call-site collection nil-input test.
packages/typia/test/adapter/options/adapter_unsupported_reason_rejects_invalid_call_test.go Adds adapter unsupported-reason invalid input test.
packages/typia/test/adapter/options/adapter_plugin_options_transform_options_test.go Adds tests for plugin options projection to transform options.
packages/typia/test/adapter/options/adapter_format_transform_error_includes_module_path_test.go Adds tests for transform error formatting including module path.
packages/typia/test/adapter/options/adapter_emit_call_with_options_ignores_incomplete_program_test.go Adds tests ensuring adapter emission is a no-op on incomplete inputs.
packages/typia/test/adapter/cleanup/transform_cleanup_test.go Adds tests for TypeScript transform cleanup (parenthesized return type normalization).
packages/typia/test/adapter/cleanup/cleanup_removes_unused_typia_imports_test.go Adds tests for removing unused typia imports in cleanup.
packages/typia/test/adapter/cleanup/cleanup_preserves_referenced_typia_imports_test.go Adds tests ensuring referenced typia imports are preserved.
packages/typia/test/adapter/cleanup/cleanup_injects_runtime_imports_test.go Adds tests for runtime helper import injection (CommonJS).
packages/typia/test/adapter/cleanup/cleanup_injects_es_module_runtime_imports_test.go Adds tests for runtime helper import injection (ESM).
packages/typia/native/cmd/ttsc-typia/transform.go Delegates TS cleanup to adapter.CleanupTypeScriptTransformText and removes inline cleanup logic.
packages/typia/native/adapter/cleanup.go Adds exported CleanupTypeScriptTransformText and moves TS-specific cleanup pipeline into adapter.
package.json Updates scripts to run Go toolchain tests as part of pnpm test.
.github/workflows/test.yml Updates CI to run pnpm test (which now includes Go tests).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +10
//go:build typia_native_internal
// +build typia_native_internal

package transform

import (
"path/filepath"
"testing"

shimast "github.com/microsoft/typescript-go/shim/ast"
Comment thread package.json
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​autobe/​interface@​0.31.181100759670

View full report

@samchon
samchon merged commit 384460e into next May 11, 2026
7 checks passed
@samchon
samchon deleted the test/coverage branch May 11, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants