Skip to content

Commit 491a2cf

Browse files
committed
fix eslint-airbnb-base linting for tests
1 parent 6ce312e commit 491a2cf

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

docs/end-to-end_testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# End-to-end testing
22

3-
electron-vue makes use of [Spectron](http://electron.atom.io/spectron/) and the [Mocha](https://mochajs.org/) test framework for end-to-end testing.
3+
electron-vue makes use of [Spectron](http://electron.atom.io/spectron/) and the [Mocha](https://mochajs.org/) (with [Chai](http://chaijs.com/)) test framework for end-to-end testing. Mocha & Chai APIs, including `expect`, `should`, and `assert`, are made available in global scope.
44

55
### Running tests
66
```bash
@@ -19,7 +19,7 @@ my-project
1919
│ │ ├─ specs
2020
│ │ │ └─ Launch.spec.js
2121
│ │ ├─ index.js
22-
│ │ └─ utils.js
22+
└─ └─ └─ utils.js
2323
```
2424

2525
**For the most part, you can ignore `index.js` and focus solely on writing `specs/`.**

docs/unittesting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ my-project
1818
│ │ ├─ specs
1919
│ │ │ └─ LandingPageView.spec.js
2020
│ │ ├─ index.js
21-
│ │ └─ karma.conf.js
21+
└─ └─ └─ karma.conf.js
2222
```
2323

2424
**For the most part, you can ignore both `index.js` and `karma.conf.js` and focus solely on writing `specs/`.**
@@ -33,4 +33,4 @@ This is the entry file used by `karma-webpack`. The purpose of this file is to g
3333
Here you will find the actual `karma` configuration, set up with spec/coverage reporters. Further customization can be made in accordance to the [official karma documentation](http://karma-runner.github.io/1.0/config/configuration-file.html).
3434

3535
### Mocking dependencies
36-
electron-vue comes with [`inject-loader`](https://github.com/plasticine/inject-loader) installed by default. For usage with Vue component files see [`vue-loader` docs on testing with mocks](http://vue-loader.vuejs.org/en/workflow/testing-with-mocks.html).
36+
electron-vue comes with [`inject-loader`](https://github.com/plasticine/inject-loader) installed by default. For usage with Vue component files see [`vue-loader` docs on testing with mocks](http://vue-loader.vuejs.org/en/workflow/testing-with-mocks.html).

template/.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
app/node_modules/**
22
app/dist/**
33
app/electron.js
4+
{{#testing unit e2e}}
5+
test/unit/coverage/**
6+
test/unit/*.js
7+
test/e2e/*.js
8+
{{/testing}}

template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{{/if}}
1616
{{#if eslint}}
1717
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter app",
18-
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix app",
18+
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix app{{#testing unit e2e}} test{{/testing}}",
1919
{{/if}}
2020
"pack": "cross-env NODE_ENV=production webpack -p --progress --colors",
2121
{{#testing unit e2e}}

template/test/.eslintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": {
3+
"mocha": true
4+
},
5+
"globals": {
6+
"assert": true,
7+
"expect": true,
8+
"should": true
9+
}{{#if eslint}}{{#if_eq eslintConfig 'airbnb'}},
10+
"rules": {
11+
"func-names": 0,
12+
"prefer-arrow-callback": 0
13+
}{{/if_eq}}{{/if}}
14+
}

template/test/unit/.eslintrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

template/test/unit/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
// require all test files (files that ends with .spec.js)
42
const testsContext = require.context('./specs', true, /\.spec$/)
53
testsContext.keys().forEach(testsContext)

0 commit comments

Comments
 (0)