SublimeText / UnitTesting

Testing Sublime Text Packages
MIT License
112 stars 32 forks source link

Refactor command structure #253

Closed deathaxe closed 7 months ago

deathaxe commented 7 months ago

This commit mainly intents to provide a single unit_testing command, which adapts its behavior based on passed arguments.

As a result the following obsolete commands are replaced:

The new command integrates better with ST build systems, which rely on variables such as $file_name.

 {
     "target": "unit_testing",
     "package": "$package_name",
     "pattern": "$file_name",
     "coverage": false

     // all known settings from unittesting.json are valid within build systems.
}

It also significantly reduces required commands to forward tests to python 3.3 and does so as early as possible, reducing redundant function and API calls.

A BaseUnittestingCommand window command handles shared functionality across unit tests, syntax tests and color scheme tests. A WindowCommand is chosen, to replace sublime.active_window() API calls across methods by self.window, to prevent unwanted side effects as unit tests may create and focus new windows at any time.

The JsonFile is replaced by more use-case specific implementations as it is only used to load unittesting.json or schedule.json, which both have some unique requirements.

Main functionality or test run implementation is however unchanged.