Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[babel-register] ignore packages directory when running from source #26098

Merged
merged 4 commits into from Nov 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/setup_node_env/babel_register/register.js
Expand Up @@ -42,7 +42,7 @@ var ignore = [
/\/node_modules\/(?!x-pack\/(?!node_modules)([^\/]+))([^\/]+\/[^\/]+)/,

// ignore paths matching `/canvas/canvas_plugin/{a}/{b}` unless
// is `x-pack` and `b` is not `node_modules`
// `a` is `functions` and `b` is `server`
/\/canvas\/canvas_plugin\/(?!functions\/server)([^\/]+\/[^\/]+)/,
];

Expand All @@ -56,6 +56,13 @@ if (global.__BUILT_WITH_BABEL__) {
// building their server code at require-time since version 4.2
// TODO: the plugin install process could transpile plugin server code...
ignore.push(resolve(__dirname, '../../../src'));
} else {
ignore.push(
// ignore any path in the packages, unless it is in the package's
// root `src` directory, in any test or __tests__ directory, or it
// ends with .test.js, .test.ts, or .test.tsx
/\/packages\/(eslint-|kbn-)[^\/]+\/(?!src\/.*|(.+\/)?(test|__tests__)\/.+|.+\.test\.(js|ts|tsx)$)(.+$)/
);
}

// modifies all future calls to require() to automatically
Expand Down