When I try with the following code
script.js
var aMyVar = [];
[...]
async function load(bHard){
console.log(aMyVar);
[...]
}
[...]
module.exports = {
load
}
script.test.js
const {
load
} = require('../script.js');
[...]
describe('My Block', function () {
test('My Test', async () => {
global.aMyVar = [{"Key":"Test"}];
await load(true);
[...]
});
});
[...]
Expected behaviour: console.log prints "[{"Key":"Test"}]"
Observed behaviour: console.log prints "[]"
What's wrong?