Reason#
When writing tests for Debbl/eslint-config
await Promise.all(
files.map(async (file) => {
let content = await fs.readFile(join(target, file), "utf-8");
const source = await fs.readFile(join(from, file), "utf-8");
if (content === source) {
content = "// unchanged\n";
}
await expect.soft(content).toMatchFileSnapshot(join(output, file));
}),
);
Multiple systems are used for testing in GitHub Actions
strategy:
matrix:
node: [lts/*]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
However, when testing on Windows, there is always an error test, indicating that the input and output do not match. After testing, it was found that the eol
in git's default download on Windows is crlf
So I searched for how to set eol
to lf
in GitHub Actions actions/checkout#135
Finally, the following command was added ci.yml
Windows can be set to lf
with the following command
git config --global core.autocrlf false
git config --global core.eol lf
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
Set through .gitattributes
#
* text=auto eol=lf