Skip to content

Feature request: Run Generation Only When Flag Is Present #496

Description

@mcmah309

Generation should not run every cargo test. I only want to generation to run when I provide the env variables to configure the generation, such as where I want the output to go. Generation should be more explicit, we could use a rust flag e.g. RUSTFLAGS='--cfg ts_rs' cargo test. All that would need to change, is that the generated tests would need to be annotated with #[cfg(ts_rs)]. E.g.

#[cfg(ts_rs)]
#[cfg(test)]
#[test]
fn export_bindings_alignmentinteraction() {
    let cfg = ::ts_rs::Config::from_env();
    <AlignmentInteraction as ::ts_rs::TS>::export_all(&cfg).expect("could not export type");
}

Now cargo test does not run these.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions