I had a file testing various utils with the structure:
import { foo, bar, baz } from "../src/util.js";
export default {
tests: [
{ name: "foo()", run: foo, tests: [...] },
{ name: "bar()", run: bar, tests: [...] },
// ...
]
}
So I thought, 💡 I can just use this.run.name and generate their names!
import { foo, bar, baz } from "../src/util.js";
export default {
getName() {
return this.run.name + "()";
}
tests: [
{ name: "foo()", run: foo, tests: [...] },
{ name: "bar()", run: bar, tests: [...] },
// ...
]
}
However, this did not work because this is the top-level test, which is useless.
Same with all the other getXXX() functions.