Configuring jsdom in Jest across multiple tests without using modules
问题 I want to test scripts in an environment where we can not export modules. I have installed Jest version 23.1.0 and there aren't other packages in my package.json file. Using jsdom 'old' api I have come up with a solution that works as expected: script.js var exVar = "test"; script.test.js const jsdom = require('jsdom/lib/old-api.js'); test('old jsdom api config', function(done) { jsdom.env({ html: "<html><body></body></html>", scripts: [__dirname + "/script.js"], done: function (err, window)