2.1.0 • Published 1 year ago
@flemist/html-css-dev v2.1.0
Runs a test function with all possible combinations of its parameters.
Usage
Sync only
const result = []
const testVariants = createTestVariants(({a, b, c}: { a: number, b: string, c: boolean }) => {
result.push([a, b, c])
})
const count = await testVariants({
a: [1, 2],
b: ['3', '4'],
c: [true, false],
})({
pauseInterval: 10000, // pause after each 10 seconds and log inerations count, it needed for karma tests
pauseTime: 10, // continue after 10 milliseconds
})
// result == [
// [1, '3', true],
// [1, '3', false],
// [1, '4', true],
// [1, '4', false],
// [2, '3', true],
// [2, '3', false],
// [2, '4', true],
// [2, '4', false],
// ]
// count == 8
Async
const result = []
const testVariants = createTestVariants(async ({a, b, c}: { a: number, b: string, c: boolean }) => {
await delay(10)
result.push([a, b, c])
})
const count = await testVariants({
a: [1, 2],
b: ['3', '4'],
c: [true, false],
})() // no extra parameters
Calculable variants
const result = []
const testVariants = createTestVariants(async ({a, b, c}: { a: number, b: number, c: number }) => {
await delay(10)
result.push([a, b, c])
})
const count = await testVariants({
a: [1, 2],
b: ({a}) => [ a + 1, a + 2 ], // you can use 'a', but you can't use 'c' because it will initialize after 'b'
c: ({a, b}) => [ a, b, a + b ],
})()
License
2.1.0
1 year ago
2.0.3
1 year ago
2.0.2
1 year ago
2.0.1
1 year ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
0.0.17
2 years ago
0.0.18
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
0.0.16
2 years ago
0.0.12
3 years ago
0.0.13
3 years ago
0.0.14
3 years ago
0.0.15
3 years ago
0.0.10
3 years ago
0.0.11
3 years ago
0.0.9
3 years ago
0.0.8
3 years ago
0.0.5
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.3
3 years ago
0.0.4
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago