Skip to content

Commit

Permalink
fix: .each argument type detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ChALkeR committed Jul 12, 2024
1 parent 60ffbf9 commit dfbf0a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dfbf0a4

Please sign in to comment.