mozilla / shield-studies-addon-utils

Mozilla Public License 2.0
7 stars 21 forks source link

Easier import/export of testUtils? #250

Open pdehaan opened 6 years ago

pdehaan commented 6 years ago

Re: https://github.com/mozilla/shield-studies-addon-utils/tree/master/testUtils

Not sure if it'd be easier to create some ./testUtils/index.js which would let us convert this (via mozilla/shield-studies-addon-template /test/functional/utils.js:38-45):

// Re-usable test methods from shield-studies-addon-utils
const { executeJs } = require("shield-studies-addon-utils/testUtils/executeJs");
const { nav } = require("shield-studies-addon-utils/testUtils/nav");
const { setupWebdriver } = require("shield-studies-addon-utils/testUtils/setupWebdriver");
const { telemetry } = require("shield-studies-addon-utils/testUtils/telemetry");
const { ui } = require("shield-studies-addon-utils/testUtils/ui");

Into this:

// Re-usable test methods from shield-studies-addon-utils
const { executeJs, nav, setupWebdriver, telemetry, ui } = require("shield-studies-addon-utils/testUtils");

Although I suppose /testUtils/index.js would still need to import/export all the files anyways, so maybe it isn't any better:

module.exports = {
  executeJs: require("./executeJs"),
  nav: require("./nav"),
  setupWebdriver: require("./setupWebdriver"),
  telemetry: require("./telemetry"),
  ui: require("./ui"),
};
motin commented 6 years ago

I welcome this simplification :)