LoginSignup
1
0

More than 5 years have passed since last update.

fish:fish:で$(npm bin)/cypressを実行するとき

Last updated at Posted at 2018-09-09

fishでcypressを実行:fish:

$(npm bin)/cypress

shell知らないけど、fishな私は

fish: Illegal command name '$(npm bin)/cypress'

と怒られてまうのです:fish::anger:

cypressを実行するには実行文をpackage.jsonのscriptsに設定しますがちょっと独特です。
そしてそれをfishで実行するときのスクリプトも載せておきます:fish:

TL;DR

  • cypress実行文をfish用に変えるだけです

対象読者

  • fish初心者:fish:
  • cypress使用している人

cypressの実行文

https://docs.cypress.io/guides/guides/command-line.html#Installation
公式ドキュメントにもありますが、cypress ~でそのまま実行しないようです。

fishでcypressを実行するときは、

パターン1: シェルで実行

$(npm bin)/cypress

# $ごと必要です

fishの場合

$ではなく、eval ()で実行する

eval (npm bin)/cypress

初心者なのでevalの存在を知らなかったのですが、
()の中に変数を入れて、()の中にいれた変数をコマンドとして実行するのがevalだそうです。
http://fish.rubikitch.com/eval/

パターン2 package.jsonに設定する場合

package.json
{
 scripts: {
  "test":"./node_modules/.bin/cypress"
 }
}

ま、だいたい2のパターンでやるでしょうが:fishing_pole_and_fish::santa:

参考

https://docs.cypress.io/guides/guides/command-line.html#Installation
http://fish.rubikitch.com/eval/

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