Commit 7cb68de
`Data(table)` threw "Invalid data type" for a valid DataTable when the test
file is loaded via `require: ['tsx/cjs']`. tsx transpiles the test to CommonJS
and gives it its own copy of the `DataTable` class, while the framework runs as
ESM with a different copy, so the `instanceof DataTable` check fails for a
genuine DataTable.
Detect a DataTable by its structure (`array`/`rows` arrays + `add` method) in
addition to `instanceof`, which survives duplicate module instances. Plain
arrays, generators and functions still fall through to their own branches.
Co-authored-by: DavertMik <davert@testomat.io>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 060d72a commit 7cb68de
2 files changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
85 | 90 | | |
86 | | - | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
100 | 124 | | |
101 | 125 | | |
0 commit comments