Merge branch 'jmm-node_modules-robust'
This commit is contained in:
commit
a7848c1822
@ -6,6 +6,7 @@ import * as babel from "../node";
|
||||
import each from "lodash/collection/each";
|
||||
import * as util from "../../util";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
sourceMapSupport.install({
|
||||
handleUncaughtExceptions: false,
|
||||
@ -81,7 +82,7 @@ var compile = function (filename, opts = {}) {
|
||||
|
||||
var shouldIgnore = function (filename) {
|
||||
if (!ignore && !only) {
|
||||
return /node_modules/.test(filename);
|
||||
return filename.split(path.sep).indexOf("node_modules") >= 0;
|
||||
} else {
|
||||
return util.shouldIgnore(filename, ignore || [], only || []);
|
||||
}
|
||||
|
||||
1
test/core/fixtures/require-hook/not_node_modules/input.js
generated
Normal file
1
test/core/fixtures/require-hook/not_node_modules/input.js
generated
Normal file
@ -0,0 +1 @@
|
||||
() => {};
|
||||
12
test/core/require-hook.js
Normal file
12
test/core/require-hook.js
Normal file
@ -0,0 +1,12 @@
|
||||
var chai = require("chai");
|
||||
|
||||
// Require-hook.
|
||||
require("../../lib/babel/api/register/node");
|
||||
|
||||
suite("require hook", function () {
|
||||
test("not node_modules", function () {
|
||||
chai.expect(function () {
|
||||
require("./fixtures/require-hook/not_node_modules/input");
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user