Skip to content

Ignore ts-rs tests by default#253

Closed
escritorio-gustavo wants to merge 3 commits intomainfrom
ignore_tests
Closed

Ignore ts-rs tests by default#253
escritorio-gustavo wants to merge 3 commits intomainfrom
ignore_tests

Conversation

@escritorio-gustavo
Copy link
Contributor

@escritorio-gustavo escritorio-gustavo commented Mar 7, 2024

Currently ts-rs exports its TypeScript bindings in every test run. This seems to really upset some people, and with good reasons:

  • One cannot run their own tests without triggering ts-rs
  • One cannot trigger ts-rs without running their own tests
  • Both situations cause slowdowns due to running more tests than expected

So this PR proposes a way to change that by adding #[ignore] to all ts-rs tests. This enables users to:

  • Run only their own tests with cargo test
  • Run only ts-rs tests with cargo test export_bindings_ -- --ignored
  • Run everything with cargo test -- --ignored (though this does have the downside of running the user's own ignored tests)

Fixes #62

@escritorio-gustavo
Copy link
Contributor Author

As discussed in #251, this will be kept on hold until the CLI release

@escritorio-gustavo escritorio-gustavo marked this pull request as draft March 7, 2024 14:14
@escritorio-gustavo escritorio-gustavo added Next Major Release CLI This issue/PR is related to or requires the implementation of the CLI tool labels Mar 7, 2024
@escritorio-gustavo escritorio-gustavo mentioned this pull request Apr 9, 2024
12 tasks
@escritorio-gustavo
Copy link
Contributor Author

Obsolete as of #304

@escritorio-gustavo escritorio-gustavo deleted the ignore_tests branch April 10, 2024 17:38
amireh added a commit to amireh/ts-rs that referenced this pull request Dec 23, 2025
this patch introduces a new feature - "export-bindings" - to grant
downstream more control over when the bindings are generated.

With the feature disabled in Cargo.toml, the bindings are not exported
automatically on every test run. The user can choose when to export by
explicitly enabling the feature with the --features cargo test flag.

For example, in my Cargo.toml:

```toml
[dependencies]
ts-rs = { version = "11", default-features = false, features = [
  "serde-compat",
  "no-serde-warnings",
] }
```

And at the time I need to export the bindings:

    cargo test --features export-bindings -- 'export_bindings_'

This is somewhat related to Aleph-Alpha#62 and Aleph-Alpha#253.
amireh added a commit to amireh/ts-rs that referenced this pull request Dec 23, 2025
this patch introduces a new feature - "export-bindings" - to grant
downstream more control over when the bindings are generated.

With the feature disabled in Cargo.toml, the bindings are not exported
automatically on every test run. The user can choose when to export by
explicitly enabling the feature with the --features cargo test flag.

For example, in my Cargo.toml:

```toml
[dependencies]
ts-rs = { version = "11", default-features = false, features = [
  "serde-compat",
  "no-serde-warnings",
] }
```

And at the time I need to export the bindings:

    cargo test --features export-bindings -- 'export_bindings_'

This is somewhat related to Aleph-Alpha#62 and Aleph-Alpha#253.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI This issue/PR is related to or requires the implementation of the CLI tool Next Major Release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoiding the testcase workaround

1 participant