From dfbf0a4cd37a6715e19e9a7bb1c60108929a37c7 Mon Sep 17 00:00:00 2001 From: Nikita Skovoroda Date: Fri, 12 Jul 2024 21:46:40 +0300 Subject: [PATCH] fix: .each argument type detection --- src/jest.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jest.js b/src/jest.js index 1398cae..d6d0792 100644 --- a/src/jest.js +++ b/src/jest.js @@ -42,10 +42,12 @@ const makeEach = // Hack for common testing with simple arrow functions, until we can disable esbuild minification const formatArg = (x) => (x && x instanceof Function && `${x}` === '()=>{}' ? '() => {}' : x) - for (const arg of parseArgs(list, rest)) { + const args = parseArgs(list, rest) + const wrapped = args.every((x) => Array.isArray(x)) + for (const arg of args) { let name = template - const args = !arg || typeof arg !== 'object' ? [arg] : arg + const args = wrapped ? arg : [arg] for (const [key, value] of Object.entries(args)) { name = name.replace(`$${key}`, formatArg(value)) // can collide but we don't care much yet