refactor: remove unused dependencies and code (#36)

Move code withRoot method from e2e utils to test one, as it is used there.
Leave e2e-utils as placeholder for future e2e utils.

Add editorconfig
This commit is contained in:
Dimitar Terziev 2017-10-31 12:56:44 +02:00 коммит произвёл GitHub
Родитель 41b060a1dd
Коммит 6da5610872
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 41 добавлений и 167 удалений

11
.editorconfig Normal file
Просмотреть файл

@ -0,0 +1,11 @@
# EditorConfig is awesome: http://EditorConfig.org
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Indentation override for all source files
[**.js]
indent_style = space
indent_size = 4

Просмотреть файл

@ -1,3 +1,3 @@
{
"extends": "./node_modules/@telerik/eslint-config/react.js"
"extends": "./node_modules/@telerik/eslint-config/index.js"
}

Просмотреть файл

@ -5,9 +5,6 @@ cache:
- node_modules
notifications:
email: false
slack:
on_success: never
secure: QFMZSJNCI5H5xzoIcDbJfzgR9AH7FuBD4tOyqRr/FMfEm1mV5eInvgUSmz0xFN3TpDMwJXKi41mrquK6/ey3DEgI0Jm5M32FTis+HahXp3R6zamD7+6Y0WaTxhILcULPqJVo2Ce4WtMqbmrEyk2xLFSYPhFt9wPna9aFO4j+OZw=
node_js:
- '6'
env:
@ -25,6 +22,8 @@ before_install:
before_script:
- git fetch origin refs/heads/master:refs/remotes/origin/master
- npm prune
script:
- npm run lint
after_success:
- npm run semantic-release
branches:

Просмотреть файл

@ -3,10 +3,12 @@
An internal utility package exporting gulp tasks for the Kendo React components infrastructure.
- `gulp test` - runs the tests (single run);
- `gulp test` - runs the unit tests (single run);
- `gulp watch-test` - runs the unit tests in continuous mode;
- `gulp e2e` - runs the end-to-end tests (single run);
- `gulp watch-test` - runs the tests in continuous mode;
- `gulp build-npm-package` - packages the component in a format suitable for publishing as an NPM package (commonjs module)
- `gulp watch-e2e` - runs the end-to-end tests in continuous mode;
- `gulp build-npm-bundle` - packages the component in a format suitable for publishing as an NPM package (commonjs module)
- `gulp build-cdn` - packages the component in a format suitable for CDN upload (UMD format)
- `gulp build-package` - packages the component in all formats
- `gulp start` - launches a dev server for preview/authoring of the examples
- `gulp docs` - runs a dev server for preview/authoring of the markdown documentation

Просмотреть файл

@ -1,10 +0,0 @@
const noop = function() { };
const elementStub = { appendChild: noop };
module.exports = {
createElement: () => elementStub,
getElementsByTagName: () => [ elementStub ],
appendChild: noop,
createTextNode: noop
};

Просмотреть файл

@ -1,5 +0,0 @@
Error.stackTraceLimit = Infinity;
const e2eContext = require.context('./e2e', true, /(.*)\.jsx$/);
e2eContext.keys().forEach(e2eContext);

Просмотреть файл

@ -1,4 +0,0 @@
const commonTasks = require('@telerik/kendo-common-tasks');
module.exports = (config) =>
commonTasks.karmaConfig(config, require('./webpack.config.js').e2eNpmPackage, 'e2e-bundle.js');

Просмотреть файл

@ -1,30 +1 @@
/*eslint no-var: 0 */
var $ = require('jquery');
var chai = require('chai');
var chaiJquery = require('chai-jquery');
var expect = chai.expect;
global.jQuery = $;
chai.should();
chai.use(chaiJquery);
function withRoot(closure) {
return function() {
var root = $("<div />").appendTo(document.body);
afterEach(function() {
root.empty();
});
closure(root);
};
}
module.exports = {
"$": $,
"expect": expect,
"withRoot": withRoot
};
/* Any utilities for e2e testing goes here */

Просмотреть файл

@ -1,4 +0,0 @@
const commonTasks = require('@telerik/kendo-common-tasks');
module.exports = (config) =>
commonTasks.karmaConfig(config, require('./webpack.config.js').e2e, 'e2e-bundle.js');

Просмотреть файл

@ -18,25 +18,13 @@
"dependencies": {
"@progress/kendo-typescript-tasks": "dev",
"@telerik/eslint-config": "1.1.0",
"@types/enzyme": "^2.8.2",
"@types/jasmine": "^2.6.0",
"babel-core": "~6",
"babel-loader": "^6.2.0",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-transform-es2015-modules-umd": "~6",
"babel-plugin-transform-object-assign": "^6.5.0",
"babel-preset-es2015": "~6",
"babel-preset-react": "~6",
"babel-preset-stage-1": "~6",
"babel-traverse": "6.3.19",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.1",
"nightwatch": "^0.9.16",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-test-renderer": "^16.0.0",
"selenium-standalone": "^6.9.0",
"webpack-karma-die-hard": "^1.0.4"
"selenium-standalone": "^6.9.0"
},
"author": "Telerik",
"license": "Apache-2.0",

Просмотреть файл

@ -8,4 +8,4 @@ module.exports = {
baseURL: 'https://chromedriver.storage.googleapis.com'
}
}
};
};

Просмотреть файл

@ -1,3 +0,0 @@
module.exports = function() {
return '{}';
};

Просмотреть файл

@ -3,6 +3,23 @@ const Adapter = require('enzyme-adapter-react-16');
Enzyme.configure({ adapter: new Adapter() });
function withRoot(closure) {
return function() {
const root = document.createElement('div');
document.body.appendChild(root);
afterEach(function() {
while (root.firstChild) {
root.removeChild(root.firstChild);
}
});
closure(root);
};
}
module.exports = {
Enzyme
};
Enzyme,
withRoot
};

Просмотреть файл

@ -25,25 +25,6 @@ const jsonLoader = {
loader: require.resolve('json-loader')
};
const babelLoader = {
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: require.resolve('babel-loader'),
plugins: [
require.resolve('babel-plugin-add-module-exports')
],
query: {
presets: [
require.resolve('babel-preset-react'),
require.resolve('babel-preset-es2015'),
require.resolve('babel-preset-stage-1') // Note: stage-1 should be after es2015 in order to work
],
plugins: [
require.resolve('babel-plugin-transform-object-assign')
]
}
};
const packageDependencies = () => (
Object.keys(packageInfo["dependencies"] || {})
.filter(x => x !== "@progress/kendo-theme-default")
@ -151,69 +132,5 @@ module.exports = {
{ test: /\.json$/, loader: require.resolve('json-loader') }
]
}
}),
/* Deprecated configuration, to be removed */
e2e: commonTasks.webpackThemeConfig({ stubResources: true }, {
resolve: {
cache: false,
fallback: resolve.fallback,
alias: {
"./e2e": process.cwd() + "/e2e",
"e2e-utils": require.resolve("./e2e-utils.js"),
[packageInfo.name]: '../src/main'
},
extensions: [ '', '.jsx', '.js', '.json', '.scss' ]
},
devtool: 'inline-source-map',
module: {
preLoaders: [
{
test: /\.js$/,
loader: require.resolve("source-map-loader")
}
],
loaders: [
babelLoader,
{ test: /\.json$/, loader: require.resolve('json-loader') }
]
},
stats: { colors: true, reasons: true },
debug: false,
plugins: [
new commonTasks.webpack.ContextReplacementPlugin(/\.\/e2e/, process.cwd() + '/e2e')
]
}),
/* Deprecated configuration, to be removed */
e2eNpmPackage: commonTasks.webpackThemeConfig({ stubResources: true }, {
resolve: {
cache: false,
fallback: resolve.fallback,
alias: {
"./e2e": process.cwd() + "/e2e",
"e2e-utils": require.resolve("./e2e-utils.js"),
[packageInfo.name]: '../dist/npm/js/main'
},
extensions: [ '', '.jsx', '.js', '.json', '.scss' ]
},
devtool: 'inline-source-map',
module: {
preLoaders: [
{
test: /\.js$/,
loader: require.resolve("source-map-loader")
}
],
loaders: [
babelLoader,
{ test: /\.json$/, loader: require.resolve('json-loader') }
]
},
stats: { colors: true, reasons: true },
debug: false,
plugins: [
new commonTasks.webpack.ContextReplacementPlugin(/\.\/e2e/, process.cwd() + '/e2e')
]
})
};

Просмотреть файл

@ -1,5 +0,0 @@
module.exports = {
navigator: {
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"
}
};