Open
Description
As raised in chaijs/chai-http#310, the move to ESM actually had another breaking change we didn't catch
in the past, you could do something like this:
const chai = require('chai');
chai.use((ex) => {
ex['oogabooga'] = 303;
});
chai.oogabooga; // 303
of course, in es modules, this will no longer work:
import * as chai from 'chai';
chai.oogabooga = 303; // TypeError, object is not extensible
chai.use((ex) => {
ex['oogabooga'] = 303; // works but doesn't mutate `chai`
});
chai.oogabooga; // undefined
we can't really 'fix' this. imports are immutable objects when using *
, so we can't just stick things onto the end.
it means we probably need to make a decision of what the 'new way' of doing this is. some suggestions:
- require that consumers do something like
chai = chaiOriginal.use(foo).use(bar);
- introduce some kind of
chai.extensions
, a mutable object we store these things in
Metadata
Metadata
Assignees
Labels
No labels