xolvio / qualityfaster

An example project showing how to create robust and maintainable acceptance tests
262 stars 58 forks source link

wallaby.js with meteor 1.5 #71

Closed louismarie closed 7 years ago

louismarie commented 7 years ago

I'm trying to get wallaby working with meteor 1.5 Using current wallaby-server.js config in master branch gave me that issue :

ReferenceError: dynamicImportInfo is not defined
    at meteorInstall.node_modules.meteor.dynamic-import.server.js (meteor://💻app/packages/dynamic-import/server.js:15:13)
    at fileEvaluate (packages/modules-runtime.js:333:9)
    at require (packages/modules-runtime.js:228:16)
    at Function._.each._.forEach (/Users/Projects/MeteorApp/node_modules/underscore/underscore.js:153:9)

It seems to be caused by a new feature in meteor described here : https://blog.meteor.com/dynamic-imports-in-meteor-1-5-c6130419c3cd

To me the solution would be in boot.js copy (in wallaby-server.js) around this piece of code :

var isModulesRuntime =
            fileInfo.path === "packages/modules-runtime.js";

          var wrapParts = ["(function(Npm,Assets"];
          if (isModulesRuntime) {
            wrapParts.push(",npmRequire");

But I don't know how to load dynamic-import. Any idea ?

NOTE : original boot.js


var specialArgPaths = {
  "packages/modules-runtime.js": function () {
    return {
      npmRequire: npmRequire,
      Profile: Profile
    };
  },

  "packages/dynamic-import.js": function (file) {
    var dynamicImportInfo = {};

    Object.keys(configJson.clientPaths).map(function (key) {
      var programJsonPath = path.resolve(configJson.clientPaths[key]);
      var programJson = require(programJsonPath);

      dynamicImportInfo[key] = {
        dynamicRoot: path.join(path.dirname(programJsonPath), "dynamic")
      };
    });

    dynamicImportInfo.server = {
      dynamicRoot: path.join(serverDir, "dynamic")
    };

    return { dynamicImportInfo: dynamicImportInfo };
  }
};
ghost commented 7 years ago

If you still use the wallaby-server.js that had pretty much a copy of "boot.js" in it, you can probably figure out how to update the boot.js code inside wallaby-server.js to match the Meteor 1.5 boot.js. I nowadays run the unit tests without Fibers and with stubbed Meteor packages.

damonmaria commented 7 years ago

@louismarie I've been following the same path as you and am still using Wallaby with the real Meteor packages loaded. I've also put in the effort to merge the project's .babelrc into how Meteor's babel setup to correctly match how Meteor does it. You can see what I've done here: https://github.com/mindhivenz/wallaby-meteor-config

I've just got this working with Meteor 1.5.

If you've got any other ideas in to bring to the table then please add an issue there so we can collaborate going forward.

ghost commented 7 years ago

👍