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

path-tool does not check value #129

Closed
ChristophAtAdlos opened this issue Jun 7, 2017 · 6 comments
Closed

path-tool does not check value #129

ChristophAtAdlos opened this issue Jun 7, 2017 · 6 comments
Labels
Milestone

Comments

@ChristophAtAdlos
Copy link

I got this error:

[2017-06-07 19:47:17.114] [DEBUG] project.karma-typescript - File system changed, resolving tsconfig
=> ANNOTATION: At this point, path-tool has an empty value <<<
[2017-06-07 19:47:17.114] [DEBUG] project.karma-typescript - Fallback to default compiler options
[2017-06-07 19:28:14.355] [DEBUG] project.karma-typescript - Resolved configFileJson:  
{...}  
Fatal error: value.replace is not a function

With this fix, it runs:

Index: node_modules/karma-typescript/dist/shared/path-tool.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- node_modules/karma-typescript/dist/shared/path-tool.js	(revision )
+++ node_modules/karma-typescript/dist/shared/path-tool.js	(revision )
@@ -1,6 +1,7 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 function fixWindowsPath(value) {
+    value = typeof value === "string" ? value : value.toString();
     return value.replace(/\\/g, "/");
 }
 exports.fixWindowsPath = fixWindowsPath;

Is this in relation with this error in the "Resolved tsconfig"?

   "errors": [
      {
         "messageText": "No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were  XXX",
         "category": 1,
         "code": 18003
      }
   ],
@erikbarke erikbarke added the bug label Jun 7, 2017
@erikbarke erikbarke added this to the 3.0.4 milestone Jun 7, 2017
@erikbarke
Copy link
Collaborator

Hey @ChristophAtAdlos, could you attach a file with the complete debug log output here please?

@ChristophAtAdlos
Copy link
Author

You will find the debug log at Gist.

@erikbarke
Copy link
Collaborator

There's an error in your Karma config, the setting karmaTypescriptConfig.exclude contains a {} according to the debug log you provided, which makes path-tool.ts barf.

I've added a check in the configuration class which asserts that karmaTypescriptConfig.exclude is an array of strings, so a broken exclude setting should never get as far as the path tool.

To try it out, you can install the latest from the development branch, npm i github:monounity/karma-typescript#next!

@erikbarke erikbarke added bug and removed enhancement labels Jun 9, 2017
@ChristophAtAdlos
Copy link
Author

Monday, I can try it out.

@ChristophAtAdlos
Copy link
Author

Today, I installed the development branch:

Running "karma:unit" (karma) task   
Warning: Expected a string in 'karmaTypescriptConfig.exclude', got [object]: /\.d\.ts$/ Use --force to continue.

After removing the line /\.d\.ts$/ it worked well:

karmaTypescriptConfig: {
    exclude: [
        "src/com/XXX/bl/api",
        /\.d\.ts$/
    ]
}

Now I'm happy with karma-typescript. Thank you!

What was the problem:

I misunderstood the section in the doc:

karmaTypescriptConfig.exclude - An array of file patterns to be excluded by the compiler. The values will be merged with existing options.

I assumed patterns can be all patterns including regexp, like in tsconfig.

Troubles with node modules

With the new npm version, I ran into big troubles. Now I can understand, why project internally the old version of npm was recommended. We have linked projects and with npm 3+ this doesn't work well. An npm install steals all modules out from the linked project. And since more than 19 mounts, it seems that the npm staff does nothing to solve this BIG issue.

It's possible, to get karma-typescript running with the old node_modules structure from npm <3?

Otherwise, we have to migrate to yarn, I think.

@erikbarke
Copy link
Collaborator

So the fix worked for you, great!! Regarding the npm issue, I'm afraid there really isn't much I can do, my hands are as tied as yours 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants