-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: toc test fails due to separator on Windows #88
fix: toc test fails due to separator on Windows #88
Conversation
Windowsではpath.relativeで付与されるセパレータが<a href="..\test.html">のように"\"になるためテストに失敗する。 生成されたtoc.htmlをMacにコピーしてChromeで試した限りでは"/"でも"\"でも区切りとして機能しているようなので修正しなくても実用上は問題ないと思われる。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows環境が無いため、他の方のReviewを待ちたいです。
ところで、path.relative
は他のコードでも多数利用されていますが、この箇所以外の変更は不要でしょうか?
Windows環境あるので、見てみます。 upath はWindowsでもパス区切りを '/' で扱うようにするものです。 |
upathは関数の引数も戻り値も toUnix() で '/' 区切りに直すので、 |
再度テストを実行してみました。
Microsoft Windows [Version 10.0.18363.1256]
Git for Windows付属のbash
開発環境をようやくWindowsにも入れたのでこれから少し調べてみます。 |
分かりました。upathの最新版で問題は修正されています。古いupathのこの問題でした。 6a4ab12 を取り消して、upath を最新(2.0.1)にすれば解決します。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'path' のかわりに 'upath' を使う理由はWindowsでのパス区切りによる問題をなくすためです。ところがupath 2.0.0までjestから使われたときに 'upath' の関数がただの 'path' の関数に変わってしまう不具合があったために、testに失敗していました。 posix.
を入れたのは元に戻して、この問題が解決されている最新版のupath 2.0.1に更新してください。
upathをアップデートすることで問題が解決することを確認しました。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.jsonが更新されているため、yarn installを再度実行してyarn.lockファイルの更新も含めてください。
yarn.lock を追加しました。 package関係を変更した場合はyarn.lockを忘れないようにします。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良さそうです!
マージありがとうございます。 |
前にWindowsでvivliostyle-cliが動かなかったのを調べて直すのに、upath を使うことにしました: fix: Errors due to path problem on Windows (#69)。それから upath の中身をみて少し直したりもした(anodynos/upath#38 )ので upath の動作について知ってました。 upath使用で |
Windowsではpath.relativeで付与されるセパレータが<a href="..¥test.html">のように"¥"になるためテストに失敗します。
生成されたtoc.htmlをMacにコピーしてChromeで試した限りでは"/"でも"¥"でも区切りとして機能しているようなのでテストで引っ掛るところ以外は修正しなくても実用上は問題ないと思います。
import path form 'upath'; の順番が変わってしまったのはpretty-quickによる自動フォーマットの結果です。