UNPKG

@lou.codes/test

Version:

✅ Equality test with enforced readability

47 lines (46 loc) 1.18 kB
import { importTest } from "./importTest.js"; /** * Imports all the tests of the given Iterable of urls and yields `TestTuple`. * * @category File System * @example * ```typescript * testsImport([ * "file:///example/test-1.test.js", * "file:///example/test-2.test.js", * ]); * // AsyncIterable< * // [ * // [ * // "file:///example/test-1.test.js", * // { * // given: "example", * // must: "example", * // received: () => "value", * // wanted: () => "value", * // }, * // ], * // [ * // "file:///example/test-2.test.js", * // { * // given: "example", * // must: "example", * // received: () => "value", * // wanted: () => "value", * // }, * // ], * // ] * // >; * ``` * @param urls Array of urls of tests. * @yields `TestTuple` containing url and test for it. */ export const importTests = async function* (urls) { // eslint-disable-next-line functional/no-loop-statements for await (const url of urls) { // eslint-disable-next-line functional/no-loop-statements for await (const test of importTest(url)) { yield [url, test]; } } };