ionic-team / ionic-team/ionic-cli

`npm run test` does not work on Windows cmd

未關閉
#4,886 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
triage
主要語言
TypeScript
星號
2k
分支
682
PR 合併指標
30 天內沒有已合併 PR

描述

**Description:**

Default script of `npm run test` does not work on Windows cmd.

```
"test": "react-scripts test --transformIgnorePatterns 'node_modules/blahblah...'"
```

I think the reason is that Windows cmd can't handle single quoted arguments.
The script works when I replace the single quotes with the double quotes.

```
"test": "react-scripts test --transformIgnorePatterns \"node_modules/blahblah...\""
```

**Steps to Reproduce:**

- Create a project using `ionic start`
- Run `npm run test`

**Output:**

```
> cmdtest@0.0.1 test
> react-scripts test --transformIgnorePatterns 'node_modules/(?!(@ionic/react|@ionic/react-router|@ionic/core|@stencil/core|ionicons)/)'

'stencil'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다.
(=> This sentence means 'stencil' is not a command or an executable)
[ERROR] Unable to find command: /core
[ERROR] Unable to find command: /react-router
node:events:498
throw er; // Unhandled 'error' event
^

Error: EPIPE: broken pipe, write
...
```

**My `ionic info`:**

```
Ionic:

Ionic CLI : 6.20.1 (C:\Users\mathe\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/react 6.1.13

Capacitor:

Capacitor CLI : 3.6.0
@capacitor/android : not installed
@capacitor/core : 3.6.0
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 1.6.0

System:

NodeJS : v16.14.0 (C:\Program Files\nodejs\node.exe)
npm : 8.3.1
OS : Windows 10
```

**Other Information:**

None

貢獻指南

開啟貢獻指南

研究方向

Start with the default test script generated by `ionic start` and compare how its `react-scripts` argument is parsed by Windows cmd. Reproduce the failure with `npm run test` on Windows, then verify that the corrected default script runs successfully without the command or EPIPE errors shown here.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
shell, typescript
領域
cli
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。