Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bacon test doesn't recognize --features #171

Closed
nc7s opened this issue Feb 23, 2024 · 4 comments
Closed

bacon test doesn't recognize --features #171

nc7s opened this issue Feb 23, 2024 · 4 comments

Comments

@nc7s
Copy link

nc7s commented Feb 23, 2024

After running this:

lazy-regex
❯ bacon test --features std

I got this:

[lazy-regex] [test] [Command error code: 101]

    Finished test [unoptimized + debuginfo] target(s) in 0.01s
     Running unittests src/lib.rs (target/debug/deps/lazy_regex-53bac6e93dd32e9b)
error: Unrecognized option: 'features'
error: test failed, to rerun pass `--lib`

Putting --features std before test, i.e. bacon --features std test, doesn't work either.

This feels rather bizarre as the default job check runs fine with it.

@Canop
Copy link
Owner

Canop commented Feb 23, 2024

What bacon does when you call it with --features is basically adding the argument at the end of the job command arguments.

Here's the default definition of the test job:

[jobs.test]
command = [
    "cargo", "test", "--color", "always",
    "--", "--color", "always", # see https://github.com/Canop/bacon/issues/124
]

The -- prevents the --features from being given to the the cargo test command.

A workaround is to just edit your bacon.toml file to remove the second line of this command, like this:

[jobs.test]
command = [
    "cargo", "test", "--color", "always",
]

I should probably detect in bacon when there's a -- and insert the --features arguments before.

@nc7s
Copy link
Author

nc7s commented Feb 23, 2024

Thanks for the advice, it worked ;)

I see that the second line came from #124, cargo # 1983 being the main obstacle for a more elegant solution.

In a general sense, adding -- to job commands, especially to default ones, feels like a bad choice: you don't know when that's needed, and "fixing" this one occasion means a full blown config file (speaking of that, maybe consider merging config with defaults rather than replacing?). If such arguments is absolutely necessary, maybe introduce a new field? Something like passthru_args (since they are "passed through to" artifacts).

Edit: after second thought, passthru_args doesn't work because if it exists a -- will be added by bacon, conflicting with user supplied -- on command line. There still needs to be a detecting mechanism.

@Canop Canop closed this as completed in 31db47f Feb 23, 2024
@Canop
Copy link
Owner

Canop commented Feb 23, 2024

Should be fixed now

@Canop
Copy link
Owner

Canop commented Mar 6, 2024

(released in 2.15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants