DerekNonGeneric / proposal-assertion-error

MIT License
2 stars 0 forks source link

initial thoughts #18

Open boneskull opened 1 year ago

boneskull commented 1 year ago

@DerekNonGeneric I'm not sure what exactly you're looking for, but here's this:

("assertion libraries" above also means "assertion subsystems of testing frameworks")

DerekNonGeneric commented 1 year ago
  • operator is probably far too limiting to be of use past trivial comparisons such as ===, >, !==, etc. Other comparisons such as regex matches, deep object equivalence, deep property comparisons or compound assertions won't have much use for it.

“relational or equality” operators, such as <, <=, >, >=, ==, etc. should definitely be considered for this, but there are also “identity and membership” operators like is or in that can also be considered for this… I think we can (and probably should) expand upon this in the proposal explainer (currently the readme file).

boneskull commented 1 year ago

@DerekNonGeneric How do you mean? I guess I'm not convinced the notion of an "operator" is any finite set of values, let alone one that can be standardized. For example, what if my assertion is "the STDOUT of this command-line app, when parsed into JSON, is equal to {foo: 'bar'} and the exit code was greater than zero?" (And yes, this can be a single assertion)

DerekNonGeneric commented 1 year ago

Okay, i actually didn't mean to disagree w/ you and see what you're saying now. I guess regarding that bullet point, we can't really say what that property would contain, but might want to be sure it exists?

boneskull commented 1 year ago

@DerekNonGeneric I guess I'd feel better if it was optional. Assuming operator is intended to be either a) a concise representation or b) a machine-readable representation, generating the value may be non-trivial; e.g., a hierarchical data structure or a DSL.

I mean--I guess it's a big ask for assertion libs that have composable assertions, as well as any ecosystem of plugins around those libs. Should we be considering the difficulty of adoption?