Closed
Description
Sometimes, I'd have some dumb parse error in my test like forgetting a comma and wind up with a huge error like
nested task error: LoadError: Test files must only include `@testitem` and `@testsetup` calls.
In "/Users/mbarbar/omitted.jl" got:
$(Expr(:error, Base.Meta.ParseError("ParseError:\n# Error @ ...
...
...
1, [1, 26, 100, 101, 156, 175, 219, 241, 275, 303, 325, 355, 406, 455, 476, 491, 501, 502, 521, 565, 587, 621, 646, 678, 698, 720, 750, 805, 858, 879, 894, 904, 905, 924, 968, 990, 1024, 1053, 1075, 1105, 1160, 1213, 1234, 1249, 1259, 1260, 1279, 1323, 1347, 1378, 1395, 1449, 1459, 1460, 1479, 1523, 1547, 1575, 1591, 1608, 1656, 1666, 1667, 1686, 1730, 1754, 1798, 1845, 1862, 1872, 1873, 1892, 1936, 1960, 1986, 2032, 2048, 2098, 2115, 2125, 2126, 2145, 2189, 2213, 2239, 2287, 2303, 2350, 2367, 2448, 2458, 2459, 2478, 2522, 2546, 2572, 2616, 2632, 2633, 2683, 2700, 2784, 2820, 2847, 2857, 2858, 2877, 2933, 2957, 2983, 3011, 3027, 3028, 3052, 3053, 3103, 3148, 3165, 3175, 3176, 3195, 3241, 3265, 3291, 3321, 3354, 3370, 3371, 3423, 3440, 3450, 3451, 3470, 3515, 3539, 3
What I do is something like
s = read("omitted.jl", String)
Meta.parse(s)
and that gives me the parse error in an easy to read way like
julia> Meta.parse(s)
ERROR: ParseError:
# Error @ none:708:17
""")
# ┌────────────
omitted1("""
omitted2
"""),
#─────────────────┘ ── Expected `]`
Stacktrace:
[1] #parse#3
@ ./meta.jl:244 [inlined]
[2] parse
@ ./meta.jl:236 [inlined]
[3] parse(str::String; filename::String, raise::Bool, depwarn::Bool)
@ Base.Meta ./meta.jl:278
[4] parse(str::String)
@ Base.Meta ./meta.jl:276
[5] top-level scope
@ REPL[40]:1
Clearly in the unwieldy error above, it catches a ParseError
. Could ReTestItems either pass that error along, or even "manually" do a Meta.parse
before any of its other checks?
Metadata
Metadata
Assignees
Labels
No labels