LoginSignup
1
1

More than 5 years have passed since last update.

Intellij,WebStormなどでKarmaプラグインに変更が反映されない。

Last updated at Posted at 2016-01-11

現象

Intellij,WebStormなどで利用するKarmaプラグインを使っていると、テストファイルの変更が反映されない。
手動でKarma Serverを再起動すると変更は反映される。

Karma-browserifyを利用しているときに発生する。

未確認だが、karma-jspmなどでも発生する模様。

修正は難しいのかも

jetbrainsのIssuesを見るかぎり、2014年から問題は報告されているが、治っていない。
これは、バグというより仕様かもしれなない。

このため、karma-browserifyなどを利用する場合は、以下の回避策をとるほうがよい。

回避策

karmaプラグインのintellijRunner.jsを直接修正する。

intellijRunner.js

Macでは以下にある。

/Applications/WebStorm.app/Contents/plugins/js-karma/js_reporter/karma-intellij/lib/intellijRunner.js

修正箇所

refreshプロパティをfalseからtrueに変更する。

function runTests() {
  var serverPort = cli.getServerPort();
  var urlRoot = cli.getUrlRoot() || '/';
  if (urlRoot.charAt(urlRoot.length - 1) !== '/') {
    urlRoot = urlRoot + '/';
  }
  runWithConfig({
    port: serverPort,
    refresh: false,
    urlRoot: urlRoot
  });
}
function runTests() {
  var serverPort = cli.getServerPort();
  var urlRoot = cli.getUrlRoot() || '/';
  if (urlRoot.charAt(urlRoot.length - 1) !== '/') {
    urlRoot = urlRoot + '/';
  }
  runWithConfig({
    port: serverPort,
    refresh: true, //ココ
    urlRoot: urlRoot
  });
}

参考リンク

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1