power-assert-js/espower-typescript

when I added into tsconfig.json some outDir, the test with use your library has crashed

nskazki opened this issue · 5 comments

All my tests that depend on the espower-typescript started to crash after I've added an outDir into my tsconfig.json.

Small research:

The filename should have been passed alongside the file content to solve this problem.

I won't make a PR because I'm not confident enough but this works for me:

  function loadTypeScript(localModule, filepath) {
    var result = tss.compile(fs.readFileSync(filepath, 'utf-8'), filepath.replace(process.cwd(), ''));
    // var result = tss.compile(fs.readFileSync(filepath, 'utf-8'));
    if (minimatch(filepath, pattern)) {
      result = espowerSource(result, filepath, options);
    }
    localModule._compile(result, filepath);
  };

@nskazki Thanks for nice report! I've confirmed this issue.

@nskazki fixed in v5.0.1

@teppeis Many thanks, I checked on my example - now it works with the outDir option.