lunarmodules / busted

Elegant Lua unit testing.
https://lunarmodules.github.io/busted/
MIT License
1.39k stars 184 forks source link

feat(fixtures) add helpers to read/load fixtures #662

Closed Tieske closed 3 years ago

Tieske commented 3 years ago

Also moves the fixture_path function (see #646) from a global to the 'fixtures' module. This is non-breaking since that hasn't been released yet.

I really don't like the global fixture_path hence the move into a separate module

local fixtures = "busted.fixtures"

local absolute_path = fixtures.path("../file/some/where.txt")
local my_file = fixtures.read("../file/some/where.txt")
local my_mod = fixtures.load("../some/path/file.lua")
Tieske commented 3 years ago

@DorianGray @ajacksified wdyt, can we merge this?

DorianGray commented 3 years ago

I definitely like this 1000% better