Using Aurelia 1.x and am trying to convert jasmine/karma to jest. For the most part I figured out the babel-jest setup and it seems like everything is working until I hit a little bit of advanced code where we dynamically load a couple classes using the DefaultLoader (aurelia-loader-default).
It doesn’t like the “var nonAnonDefine = define” in the addPlugin.
Wondering if anyone has encountered similar scenario.
babel.config.json
{
"targets": "> 0.25%, not dead",
"presets": [
["@babel/preset-env", {
"loose": true,
"exclude": ["@babel/plugin-proposal-dynamic-import"]
}]
],
"plugins": [
["@babel/plugin-proposal-decorators", {"legacy": true}],
["@babel/plugin-proposal-class-properties", {"loose": true}],
["@babel/plugin-proposal-private-methods", {"loose": true}],
["@babel/plugin-proposal-private-property-in-object", {"loose": true}],
"@babel/plugin-syntax-dynamic-import"
]
}
DefaultLoader.prototype.addPlugin = function (pluginName, implementation) {
var nonAnonDefine = define;
nonAnonDefine(pluginName, [], {
'load': function load(name, req, onload) {
var result = implementation.fetch(name);
Promise.resolve(result).then(onload);
}
});
};