👩💻 Join our community of thousands of amazing developers!
Global variables are the worst thing in programming, but they are common in test runners due to history. Before the invention of bundlers, we used to include the test runner's script before the spec file to make it run.123<!-- or qunit or custom test runner script --><script src="vendor/mocha.js"></script><script src="tests/my-spec.js"></script>The vendor/mocha.js would set up global variables like describe and it, and the tests/my-spec.js would use them to define and execute tests. In addition ...