Skip to content

Commit

Permalink
Simplify development and test configuration (#378)
Browse files Browse the repository at this point in the history
* Simplify development and test configuration

* chore: yarn

Co-authored-by: oguhpereira <oguhpereira@protonmail.com>
  • Loading branch information
KELiON and ogustavo-pereira committed Feb 17, 2022
1 parent 73dcaa6 commit 71a9a64
Show file tree
Hide file tree
Showing 11 changed files with 799 additions and 600 deletions.
19 changes: 2 additions & 17 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
{
"presets": ["react"],
"plugins": [
"transform-object-rest-spread",
"transform-es2015-classes"
],
"presets": ["cerebro-plugin"],
"env": {
"production": {
"plugins": [
"babel-plugin-transform-remove-debugger"
]
},
"development": {
"development": {
"presets": ["react-hmre"]
},
"test": {
"plugins": [
"babel-plugin-add-module-exports",
"babel-plugin-transform-es2015-modules-commonjs"
]
}
}
}
11 changes: 8 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"extends": "airbnb",
"env": {
"browser": true,
"mocha": true,
"node": true
"node": true,
"jest": true
},
"rules": {
"consistent-return": 0,
Expand Down Expand Up @@ -34,7 +34,12 @@
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/label-has-for": "off"
},
"plugins": ["jsx-a11y", "import", "react"],
"plugins": [
"jsx-a11y",
"import",
"react",
"jest"
],
"settings": {
"import/core-modules": "electron",
"import/resolver": {
Expand Down
3 changes: 3 additions & 0 deletions __mocks__/lib/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {

}
3 changes: 3 additions & 0 deletions __mocks__/lib/plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
get: () => undefined
}
5 changes: 5 additions & 0 deletions __mocks__/plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
'test-plugin': {
fn: () => {}
}
}
26 changes: 3 additions & 23 deletions test/actions/search.spec.js → app/main/actions/search.spec.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
import expect from 'expect'
import searchInjector from 'inject-loader!../../app/main/actions/search'

import * as actions from './search'
import {
MOVE_CURSOR,
SELECT_ELEMENT,
UPDATE_RESULT,
HIDE_RESULT,
RESET,
} from '../../app/main/constants/actionTypes'

const testPlugin = {
fn: () => {}
}

const pluginsMock = {
'test-plugin': testPlugin
}


const actions = searchInjector({
electron: {},
plugins: pluginsMock,
'lib/config': {},
'lib/plugins': {
getUserSettings: () => undefined
}
})
} from '../constants/actionTypes'

describe('reset', () => {
it('returns valid action', () => {
Expand Down Expand Up @@ -61,7 +41,7 @@ describe('selectElement', () => {
})

describe('updateTerm', () => {
context('for empty term', () => {
describe('for empty term', () => {
it('returns reset action', () => {
expect(actions.updateTerm('')).toEqual({
type: RESET,
Expand Down
19 changes: 5 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"description": "Extendable electron-based open-source Spotlight and Alfred analogue",
"main": "main.js",
"scripts": {
"test": "cross-env NODE_ENV=test ./node_modules/.bin/mocha-webpack",
"test-watch": "yarn run test -- --watch",
"test": "cross-env NODE_ENV=test jest",
"test-watch": "jest -- --watch",
"lint": "eslint app/background app/lib app/main test *.js",
"hot-server": "node -r babel-register server.js",
"build-main": "cross-env NODE_ENV=production node -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.electron.js --progress --profile --colors",
Expand Down Expand Up @@ -145,15 +145,9 @@
"babel-core": "^6.25.0",
"babel-eslint": "7.2.3",
"babel-loader": "^7.1.1",
"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-transform-object-rest-spread": "6.23.0",
"babel-plugin-transform-remove-debugger": "^6.8.4",
"babel-preset-react": "6.24.1",
"babel-preset-cerebro-plugin": "^0.0.17",
"babel-preset-react-hmre": "1.1.1",
"babel-register": "^6.24.1",
"chai": "^4.1.0",
"chai-spies": "0.7.1",
"co-mocha": "1.2.0",
"concurrently": "^3.5.0",
"copy-webpack-plugin": "4.0.1",
"cross-env": "^5.0.2",
Expand All @@ -165,28 +159,25 @@
"eslint-config-airbnb": "^15.0.2",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jest": "^20.0.3",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-react": "^7.1.0",
"expect": "1.20.2",
"express": "^4.15.3",
"extract-text-webpack-plugin": "^3.0.0",
"fbjs-scripts": "^0.8.0",
"file-loader": "^0.11.2",
"inject-loader": "3.0.0",
"jest": "^20.0.4",
"jsdom": "^11.1.0",
"json-loader": "0.5.4",
"lodash-webpack-plugin": "^0.11.4",
"minimist": "1.2.0",
"mocha": "^3.4.2",
"mocha-webpack": "0.7.0",
"node-libs-browser": "2.0.0",
"null-loader": "0.1.1",
"optimize-js-plugin": "0.0.4",
"postcss-loader": "^2.0.6",
"postcss-nested": "^2.0.2",
"raw-loader": "0.5.1",
"react-addons-test-utils": "^15.6.0",
"sinon": "^2.3.7",
"style-loader": "^0.18.2",
"uglify-es": "^3.0.24",
"url-loader": "^0.5.9",
Expand Down
16 changes: 0 additions & 16 deletions test/.eslintrc

This file was deleted.

1 change: 0 additions & 1 deletion webpack.config.electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module.exports = {
options: {
plugins: [
"babel-plugin-transform-object-rest-spread",
"babel-plugin-add-module-exports",
"babel-plugin-transform-es2015-classes",
"babel-plugin-transform-es2015-modules-commonjs"
]
Expand Down
23 changes: 0 additions & 23 deletions webpack.config.test.js

This file was deleted.

Loading

0 comments on commit 71a9a64

Please sign in to comment.