0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Webstorm v.2022.3.2 から Jest 実行すると勝手に --experimental-vm-modules が付与される

Posted at

現行Webstorm 2022.3.2版 の JEST実行機能は --experimental-vm-modules オプションを勝手に付与するようだ

というはなしです。

Webstorm の JEST 実行機能はとても便利なのですが、2022.3.1版 および 2022.3.2 版で Webstorm内から JEST を実行すると、

SyntaxError: The requested module 'xxx' does not provide an export named 'default'

というエラーが出ました。

xxx はライブラリ名。

ローカルで npm test をコマンドラインでやったり、circle ci ではとくに問題もなくテストも実行されるので、Webstormさんが何かやらかしているのかとおもい調べてみました

原因

調査の結果 Webstormさん が 勝手に --experimental-vm-modules を node options に追加してくれていることが判明。

ESMをテストしたいとか、必要なときに自分で追加するので、Webstorm さん、勝手に node options を追加しないでほしいです。

回避策

  • その1
    Webstorm の JEST 実行の Edit Configuration で手動で --experimental-vm-modules を消す

  • その2
    2023年3月末にリリースされる 2023.1 版を待つ( その1 をやりながら耐える)

以下にあるとおり、Webstorm 2023.1 で勝手に追加するのをやめてくれるらしいです。
2023.1 は 2023年3月リリースらしいので、あと1か月弱がまんします。

image.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?