Skip to content

Commit

Permalink
test: Fix newlines handling in Windows (#184)
Browse files Browse the repository at this point in the history
* normalise line endings for test cases

This adds windows support

* This runs prettier via eslint --fix as the glob pattern matching didn't want to work

* Add lerna:bootstrap

* Update contributing to include lerna:bootstrap

* Add mlabrum as contributor
  • Loading branch information
mlabrum authored and tricoder42 committed Mar 16, 2018
1 parent a72c184 commit 34d690a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Expand Up @@ -75,6 +75,15 @@
"contributions": [
"code"
]
},
{
"login": "mlabrum",
"name": "Matt Labrum",
"avatar_url": "https://avatars2.githubusercontent.com/u/296106?v=4",
"profile": "https://github.com/mlabrum",
"contributions": [
"doc"
]
}
]
}
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Expand Up @@ -13,6 +13,7 @@ cd js-lingui

```bash
yarn
yarn run lerna:bootstrap
```

3. Run tests
Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -10,7 +10,7 @@ Seamless internationalization in Javascript and React
[![CircleCI][Badge-CI]][CI]
[![Code Coverage][Badge-Coverage]][Coverage]
[![PRs Welcome][Badge-PRWelcome]][PRWelcome]
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)
[![MIT License][Badge-License]][LICENSE]

[![Watch on GitHub][Badge-Watch]][Watch]
Expand Down Expand Up @@ -246,6 +246,7 @@ Thanks goes to these people ([emoji key][emojis]):
<!-- prettier-ignore -->
| [<img src="https://avatars1.githubusercontent.com/u/827862?v=3" width="100px;"/><br /><sub><b>Tom谩拧 Ehrlich</b></sub>](http://www.tomasehrlich.cz)<br />[馃捇](https://github.com/lingui/js-lingui/commits?author=tricoder42 "Code") [馃摉](https://github.com/lingui/js-lingui/commits?author=tricoder42 "Documentation") [馃挕](#example-tricoder42 "Examples") [鉁匽(#tutorial-tricoder42 "Tutorials") | [<img src="https://avatars1.githubusercontent.com/u/3697116?v=3" width="100px;"/><br /><sub><b>Josef Hornych</b></sub>](https://github.com/Peping)<br />[馃摉](https://github.com/lingui/js-lingui/commits?author=Peping "Documentation") [馃悰](https://github.com/lingui/js-lingui/issues?q=author%3APeping "Bug reports") | [<img src="https://avatars2.githubusercontent.com/u/307006?v=3" width="100px;"/><br /><sub><b>Christian Kaps</b></sub>](https://www.silhouette.rocks)<br />[馃悰](https://github.com/lingui/js-lingui/issues?q=author%3Aakkie "Bug reports") | [<img src="https://avatars0.githubusercontent.com/u/2085291?v=3" width="100px;"/><br /><sub><b>brunesto</b></sub>](https://github.com/brunesto)<br />[馃捇](https://github.com/lingui/js-lingui/commits?author=brunesto "Code") [馃悰](https://github.com/lingui/js-lingui/issues?q=author%3Abrunesto "Bug reports") | [<img src="https://avatars0.githubusercontent.com/u/614768?v=3" width="100px;"/><br /><sub><b>David Furlong</b></sub>](https://davidfurlong.github.io/)<br />[馃挰](#question-davidfurlong "Answering Questions") | [<img src="https://avatars2.githubusercontent.com/u/1416801?v=4" width="100px;"/><br /><sub><b>Thibaut</b></sub>](http://thibaut.re)<br />[馃悰](https://github.com/lingui/js-lingui/issues?q=author%3AthibautRe "Bug reports") [馃摉](https://github.com/lingui/js-lingui/commits?author=thibautRe "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/2965120?v=4" width="100px;"/><br /><sub><b>Sebastian Soboci艅ski</b></sub>](https://github.com/hiddenboox)<br />[馃捇](https://github.com/lingui/js-lingui/commits?author=hiddenboox "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars2.githubusercontent.com/u/296106?v=4" width="100px;"/><br /><sub><b>Matt Labrum</b></sub>](https://github.com/mlabrum)<br />[馃摉](https://github.com/lingui/js-lingui/commits?author=mlabrum "Documentation") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors][all-contributors] specification.
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -16,8 +16,9 @@
"lint": "yarn lint:eslint; yarn lint:flow",
"add": "all-contributors add",
"generate": "all-contributors generate",
"prettier": "prettier --write 'packages/**/*.js' > /dev/null",
"precommit": "yarn prettier"
"prettier": "yarn run lint:eslint --fix",
"precommit": "yarn prettier",
"lerna:bootstrap": "lerna bootstrap"
},
"engines": {
"node": ">=5.0"
Expand Down
7 changes: 6 additions & 1 deletion packages/babel-plugin-extract-messages/test/index.js
Expand Up @@ -109,7 +109,12 @@ describe("babel-plugin-lingui-extract-messages", function() {
const expected = fs.readFileSync(
path.join(__dirname, "fixtures", "noop", "expected.js")
)
expect(result.code.trim()).toEqual(expected.toString().trim())
expect(result.code.replace(/\r/g, "").trim()).toEqual(
expected
.toString()
.replace(/\r/g, "")
.trim()
)

const messages = JSON.parse(
fs.readFileSync(path.join(buildDir, "noop", "actual.json"))
Expand Down
11 changes: 8 additions & 3 deletions packages/babel-plugin-transform-js/test/index.js
Expand Up @@ -31,9 +31,14 @@ describe("babel-plugin-lingui-transform-js", function() {
it(testName, () => {
const expected =
fs.existsSync(expectedPath) &&
fs.readFileSync(expectedPath, "utf8").trim()

const actual = transformFileSync(actualPath, babelOptions).code.trim()
fs
.readFileSync(expectedPath, "utf8")
.replace(/\r/g, "")
.trim()

const actual = transformFileSync(actualPath, babelOptions)
.code.replace(/\r/g, "")
.trim()
expect(actual).toEqual(expected)
})
})
Expand Down
6 changes: 4 additions & 2 deletions packages/babel-plugin-transform-react/test/index.js
Expand Up @@ -41,8 +41,10 @@ describe("babel-plugin-lingui-transform-react", function() {
process.env.NODE_ENV = "production"
}

const expected = fs.readFileSync(expectedPath, "utf8")
const actual = transformFileSync(actualPath, babelOptions).code.trim()
const expected = fs.readFileSync(expectedPath, "utf8").replace(/\r/g, "")
const actual = transformFileSync(actualPath, babelOptions)
.code.replace(/\r/g, "")
.trim()

expect(actual).toEqual(expected.trim())

Expand Down

0 comments on commit 34d690a

Please sign in to comment.