browserify.js 583 B

123456789101112131415161718192021
  1. import browserify from "browserify";
  2. import path from "path";
  3. import vm from "vm";
  4. describe("browserify", function() {
  5. it("@babel/register may be used without breaking browserify", function(done) {
  6. const bundler = browserify(
  7. path.join(__dirname, "fixtures/browserify/register.js"),
  8. );
  9. bundler.bundle(function(err, bundle) {
  10. if (err) return done(err);
  11. expect(bundle.length).toBeTruthy();
  12. // ensure that the code runs without throwing an exception
  13. vm.runInNewContext("var global = this;\n" + bundle, {});
  14. done();
  15. });
  16. });
  17. });