babel/packages/babel-core/test/get-possible-plugin-names.js
Richard Macklin f4389a1886 Extract resolvePlugin method to babel-core public API
This encapsulates the logic for turning an acceptable plugin name into
the absolute path for that plugin. It can be used to preprocess a
plugins list to map each plugin to its absolute path, which is necessary
if `babel.transform` is going to be executed on a file outside the
directory subtree where the plugins are installed.

This adds a getPossiblePluginNames helper encapsulating the logic for
what plugin names we should try to resolve, and the resolvePlugin method
just calls this helper and actually resolves them.
2016-10-16 10:52:13 -07:00

9 lines
331 B
JavaScript

let assert = require("assert");
let getPossiblePluginNames = require("../lib/helpers/get-possible-plugin-names");
describe("getPossiblePluginNames", function () {
it("adds the babel-plugin prefix", function() {
assert.deepEqual(getPossiblePluginNames("foobar"), ["babel-plugin-foobar", "foobar"]);
});
});