How to use the babel-helper-fixtures.readFile function in babel-helper-fixtures

To help you get started, we’ve selected a few babel-helper-fixtures examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github babel / babel-preset-env / test / debug-fixtures.js View on Github external
fs.readdirSync(fixtureLoc).forEach((testName) => {
    if (testName.slice(0, 1) === ".") return;
    const testLoc = path.join(fixtureLoc, testName);

    const opts = {
      args: ["src", "--out-dir", "lib"],
      testLoc: testLoc,
    };

    const stdoutLoc = path.join(testLoc, "stdout.txt");

    if (fs.existsSync(stdoutLoc)) {
      opts.stdout = helper.readFile(stdoutLoc);
    }

    const optionsLoc = path.join(testLoc, "options.json");

    if (!fs.existsSync(optionsLoc)) {
      throw new Error(`Debug test '${testName}' is missing an options.json file`);
    }

    opts.inFiles = {
      "src/in.js": "",
      ".babelrc": helper.readFile(optionsLoc),
    };

    it(testName, buildTest(opts));
  });
});
github babel / babel-preset-env / test / debug-fixtures.js View on Github external
const stdoutLoc = path.join(testLoc, "stdout.txt");

    if (fs.existsSync(stdoutLoc)) {
      opts.stdout = helper.readFile(stdoutLoc);
    }

    const optionsLoc = path.join(testLoc, "options.json");

    if (!fs.existsSync(optionsLoc)) {
      throw new Error(`Debug test '${testName}' is missing an options.json file`);
    }

    opts.inFiles = {
      "src/in.js": "",
      ".babelrc": helper.readFile(optionsLoc),
    };

    it(testName, buildTest(opts));
  });
});

babel-helper-fixtures

Helper function to support fixtures

MIT
Latest version published 6 years ago

Package Health Score

73 / 100
Full package analysis

Popular babel-helper-fixtures functions

Similar packages