Skip to content

Comments

102 - Rewrite configuration handling#110

Merged
Derpius merged 3 commits intomasterfrom
102-config-refactor
Dec 10, 2023
Merged

102 - Rewrite configuration handling#110
Derpius merged 3 commits intomasterfrom
102-config-refactor

Conversation

@Derpius
Copy link
Member

@Derpius Derpius commented Dec 3, 2023

Issue

Resolves #102, resolves #97, resolves #104

Changes

  • Completely removed old cli.lua command line option handling
  • Added new config loader class following the builder pattern
  • Migrated config properties to the new system

Impact

  • Fixes a critical bug preventing the use of the --luaCommand option in the TypeScript wrapper
  • Fixes a minor bug where you had to have a lest config file to run tests
  • Allows setting testMatch from the command line with a comma separated list of patterns
  • Defines a solid technical approach for all future config properties, with a clear path to extend with features such as a --help option

Testing

Some of the features implemented here can't be QA'd without implementing additional options (like --watch for booleans).

  • lest --luaCommand=/path/to/lua runs lest using that executable without any errors
  • lest --testMatch=pattern%.test%.lua runs the matching tests
  • lest --testTimeout=1 runs tests with the given millisecond timeout
  • lest --testTimeout=notanumber displays a clean error message and exits with a non-zero status code
  • lest --config=path/to/lest.config.lua runs lest with the given config
    • Also try -c=path/to/lest.config.lua
  • When the --config option is not set, tests are run with the lest.config.lua in the working directory
  • When the config option doesn't point to a file, the file isn't lua, or no config is given and lest.config.lua doesn't exist in the working directory, then tests are run with default options
  • All CLI options override those given in lest.config.lua

Helpful Links

API Docs

Project Board

Discord

@Derpius Derpius added the scope - cli Command line experience label Dec 3, 2023
@Derpius Derpius linked an issue Dec 3, 2023 that may be closed by this pull request
@Derpius Derpius requested a review from a team December 3, 2023 21:20
Copy link
Contributor

@yogwoggf yogwoggf left a comment

Choose a reason for hiding this comment

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

The code looks good to me, will try to QA as much as possible today.

@yogwoggf
Copy link
Contributor

yogwoggf commented Dec 10, 2023

QA Result: Passed ✅

✅ Passed

  • lest --luaCommand=path/to/lua.exe correctly used the given executable.
  • lest --testMatch=testPattern correctly ran the matched tests.
  • lest --testTimeout=notanumber outputted a clean error message, and exited with a non-zero status code.
  • lest --testTimeout=1 ran each test with a 1 millisecond timeout.
  • lest --config=path/to/lest.config.lua successfully used the specified config path.
  • lest -c=path/to/lest.config.lua successfuly used the specified config path.
  • When no config path is set, it used the one in current working directory
  • When the config option doesn't point to a file, the file isn't lua, or no config is given and lest.config.lua doesn't exist in the working directory, it ran the tests with the default settings.
  • CLI options overrode the config settings.

@yogwoggf yogwoggf self-requested a review December 10, 2023 21:51
Copy link
Contributor

@yogwoggf yogwoggf left a comment

Choose a reason for hiding this comment

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

Like the prior review, code is good and QA passed on my end, so I'm doing this to switch my review to "Approve"

@Derpius Derpius merged commit 22093e3 into master Dec 10, 2023
@Derpius Derpius deleted the 102-config-refactor branch December 10, 2023 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope - cli Command line experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix --luaCommand argument being passed down to Lest Refactor how configuration options are loaded lest.config.lua is required for Lest to run

2 participants