Files
Bubberstation/code/modules/unit_tests/mapping.dm
SimplyLogan 2faa874b3b Speed up Mapper testing with a prefix "maptest_" in VSCode (#93238)
## About The Pull Request

One of the development hell cycles with mapping is how long it takes to
fix quality or run issues with maps.

By adding a prefix called "maptest_" to some of the unit tests it allows
mappers to only target some tests instead of the usual 350+ tests to run
each time or trying to trigger them individually and faffing.

This does not rename the unit test files themselves to preserve history
but just the "/datum/unit_test/" in each file.

This does not break the current CI or obstruct other tests - A few other
map files that call these tests specifically have been edited to point
at the new datum name.

This assumes you are using the TG testing extension to do this.

| All Tests | maptest_ |
|--------|--------|
| <img width="426" height="106" alt="image"
src="https://github.com/user-attachments/assets/d1d6f81e-16bd-473a-88da-e8b56f8bd3d0"
/> | <img width="434" height="96" alt="image"
src="https://github.com/user-attachments/assets/ea1c47fe-a6ce-40c6-b2cb-65b9c8e94a29"
/> |
| <img width="360" height="886" alt="image"
src="https://github.com/user-attachments/assets/65bcd774-79ad-432e-8211-c67fb9d3e443"
/> | <img width="370" height="833" alt="Screenshot 2025-10-01 204609"
src="https://github.com/user-attachments/assets/ad360796-5698-42fd-bd2e-51de1a02ab87"
/> |
## Why It's Good For The Game

- Should make it easier for mappers to test locally, saving CI/Github
resource for TG
- Mappers can now test their work 56% faster
## Changelog
🆑
code: Mappers can now run just mapping unit tests - Should be 56% faster
- Should have no player impact
/🆑

Co-authored-by: loganuk <falseemail@aol.com>
2025-10-05 16:25:51 -06:00

20 lines
858 B
Plaintext

/// Conveys all log_mapping messages as unit test failures, as they all indicate mapping problems.
/datum/unit_test/maptest_log_mapping
// Happen before all other tests, to make sure we only capture normal mapping logs.
priority = TEST_PRE
/datum/unit_test/maptest_log_mapping/Run()
var/static/regex/test_areacoord_regex = regex(@"\(-?\d+,-?\d+,(-?\d+)\)")
for(var/log_entry in GLOB.unit_test_mapping_logs)
// Only fail if AREACOORD was conveyed, and it's a station or mining z-level.
// This is due to mapping errors don't have coords being impossible to diagnose as a unit test,
// and various ruins frequently intentionally doing non-standard things.
if(!test_areacoord_regex.Find(log_entry))
continue
var/z = text2num(test_areacoord_regex.group[1])
if(!is_station_level(z) && !is_mining_level(z))
continue
TEST_FAIL(log_entry)