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

fix(@angular/cli): ignore ts-node when attempting to run karma with a linked cli #4997

Merged
merged 1 commit into from Feb 25, 2017
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
5 changes: 4 additions & 1 deletion lib/bootstrap-local.js
Expand Up @@ -12,7 +12,7 @@ global.angularCliPackages = require('./packages');
const compilerOptions = JSON.parse(fs.readFileSync(path.join(__dirname, '../tsconfig.json')));

const oldRequireTs = require.extensions['.ts'];
require.extensions['.ts'] = function(m, filename) {
require.extensions['.ts'] = function (m, filename) {
// If we're in node module, either call the old hook or simply compile the
// file without transpilation. We do not touch node_modules/**.
// We do touch `Angular CLI` files anywhere though.
Expand Down Expand Up @@ -52,6 +52,9 @@ if (!__dirname.match(new RegExp(`\\${path.sep}node_modules\\${path.sep}`))) {
const Module = require('module');
const oldLoad = Module._load;
Module._load = function (request, parent) {
if (request.match(/ts-node/) && parent && parent.id && parent.id.match(/karma/)) {
throw new Error();
}
if (request in packages) {
return oldLoad.call(this, packages[request].main, parent);
} else if (request.startsWith('@angular/cli/')) {
Expand Down