* @param {string} key key * @param {EXPECTED_ANY} value value * @param {string} type type * @returns {Promise } created test case
(key, value, type)
| 65 | * @returns {Promise<void>} created test case |
| 66 | */ |
| 67 | function createTestCase(key, value, type) { |
| 68 | it(`should ${ |
| 69 | type === "success" ? "successfully validate" : "throw an error on" |
| 70 | } the "${key}" option with "${stringifyValue(value)}" value`, async (t) => { |
| 71 | const compiler = getCompiler("./basic.less", { |
| 72 | [key]: value, |
| 73 | }); |
| 74 | let stats; |
| 75 | |
| 76 | try { |
| 77 | stats = await compile(compiler); |
| 78 | } finally { |
| 79 | if (type === "success") { |
| 80 | assert.strictEqual(stats.hasErrors(), false); |
| 81 | } else if (type === "failure") { |
| 82 | const { |
| 83 | compilation: { errors }, |
| 84 | } = stats; |
| 85 | |
| 86 | assert.strictEqual(errors.length, 1); |
| 87 | t.assert.snapshot(errors[0].error.message); |
| 88 | } |
| 89 | } |
| 90 | }); |
| 91 | } |
| 92 | |
| 93 | for (const [key, values] of Object.entries(tests)) { |
| 94 | for (const type of Object.keys(values)) { |
no test coverage detected
searching dependent graphs…