Closed vanillajonathan closed 11 months ago
That seems outside of the scope of fileTests
— it doesn't directly integrate with any test framework, and skipping tests should be done on that level.
I was able to do this!
My test file:
# Addition {"skip":true}
1 + 1
==>
My JavaScript test file:
for (let file of fs.readdirSync(caseDir)) {
if (!/\.txt$/.test(file)) continue
let name = /^[^\.]*/.exec(file)[0]
describe(name, () => {
for (let {config, name, run} of fileTests(fs.readFileSync(path.join(caseDir, file), "utf8"), file)) {
(config?.skip ? it.skip : it)(name, () => run(parser))
}
})
}
The fileTests
function returns a list of objects, each containing a config
object. If the config object has a property named skip
(which I define in my test file) then I call the it.skip
function instead of the it
function.
I would like to declare tests that the parser should parse, but that I know it doesn't parse yet.
This would allow Alice to write the the test strings that should pass and mark them as skipped, so that Bob can iterate over the parser until it passes the tests and then remove the skipped flag from each test as he manages to get the parser pass it. All while allowing the tests to pass in CI.