prettier / prettier/plugin-php
Unexpected Indentation Level in Tests
まだ誰も着手していません。
- 主要言語
- PHP
- スター
- 1.9k
- フォーク
- 139
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
As mentioned in #950, the tests produce a strange behavior with indentation of PHP code blocks in markdown.
Even when no tabWidth is configured in the markdown test (currently it is set to 4 to work around this issue), PHP code is indented by 2 spaces with the standalone build:
[...]
```php
function test(){$a=1;}
```
[...]
becomes
[...]
```php
function test()
{
$a = 1;
}
```
[...]
Note: Be careful when copy-pasting the code above. The code fences contain zero-width spaces to retain syntax highlighting.
This incorrect behavior is pretty unique:
-
It does not occur in the same test for the Node.js build, which correctly indents by 4 spaces in the tests.
-
It does not occur in the standalone build when used in the browser.
-
It does not even occur in the test for the standalone build, when the
jest.config.jsis changed to not using projects (which it currently does), to something like this:module.exports = { setupFiles: ["<rootDir>/tests_config/run_spec.js"], testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$", snapshotSerializers: ["jest-snapshot-serializer-raw"], testEnvironment: "jsdom", globals: { STANDALONE: true } };
So especially because of the last point, I'm assuming this has something to do with the architecture of the tests. I wasn't able to narrow it down any further.
As mentioned above, currently there's a workaround (introduced in #950) to not break the tests with something that doesn't occur "in the wild", but it should probably be taken a deeper look on.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
tests/markdown にある markdown テストから始め、Node.js と standalone の結果を比較します。jest.config.js、特にその projects 設定を調べ、tests_config/run_spec.js を使って差異を再現します。standalone テストで回避策の tabWidth: 4 が不要になり、期待されるインデントと一致すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js, php
- 領域
- testing-qa
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100