Skip to content

Commit

Permalink
Get rid of Babel and rewrite @wdio/repl (webdriverio#5804)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann authored Sep 21, 2020
1 parent 07c4d4e commit 6712e31
Show file tree
Hide file tree
Showing 191 changed files with 3,568 additions and 5,530 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{.babelrc,.eslintrc,.codeclimate.yml,.travis.yml,**/*.json,.eslintrc.js,.github/**/*.yml}]
[{.travis.yml,**/*.json,.github/**/*.yml}]
indent_size = 2
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
/packages/**/node_modules
/packages/node_modules
/packages/**/coverage
/tests/typings/**/dist
tests/typings/**/node_modules
/tests/typings
*.d.ts
82 changes: 41 additions & 41 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings'
],
env: {
node: true,
es6: true
},
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2016,
sourceType: 'module'
},
rules: {
semi: ['error', 'never'],
quotes: ['error', 'single'],
indent: [2, 4],
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended'
],
env: {
node: true,
es6: true
},
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
},
rules: {
semi: ['error', 'never'],
indent: [2, 4],

'import/no-unresolved': [2, { commonjs: true, amd: true }],
'import/named': 2,
'import/namespace': 2,
'import/default': 2,
'import/export': 2,

'no-multiple-empty-lines': [2, {'max': 1, 'maxEOF': 1}],
'array-bracket-spacing': ['error', 'never'],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
camelcase: ['error', { properties: 'never' }],
'comma-spacing': ['error', { before: false, after: true }],
'no-lonely-if': 'error',
'no-else-return': 'error',
'no-tabs': 'error',
'no-trailing-spaces': ['error', {
skipBlankLines: false,
ignoreComments: false
}],
quotes: ['error', 'single', { avoidEscape: true }],
'unicode-bom': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'require-atomic-updates': 0
}
'no-multiple-empty-lines': [2, { 'max': 1, 'maxEOF': 1 }],
'array-bracket-spacing': ['error', 'never'],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
camelcase: ['error', { properties: 'never' }],
'comma-spacing': ['error', { before: false, after: true }],
'no-lonely-if': 'error',
'no-else-return': 'error',
'no-tabs': 'error',
'no-trailing-spaces': ['error', {
skipBlankLines: false,
ignoreComments: false
}],
quotes: ['error', 'single', { avoidEscape: true }],
'unicode-bom': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'require-atomic-updates': 0
},
overrides: [{
files: ['*.ts'],
rules: {
// see https://github.com/typescript-eslint/typescript-eslint/issues/46
'@typescript-eslint/no-unused-vars': [2, { args: 'none' }]
}
}]
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ tests/typings/**/dist
/*.js
allure-reporter.d.ts
devtools.d.ts
!babel.config.js
!.eslintrc.js
!jest.config.js
packages/**/package-lock.json
.DS_Store

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ In order to set up this project and start contributing follow this step by step

* Builds all subpackages via ```npm run build```

As the last step you need to build all sub-packages in order to resolve the internal dependencies. We also have a NPM command for that:
As the last step you need to build all sub-packages in order to resolve the internal dependencies. WebdriverIO uses [TypeScript](https://www.typescriptlang.org/) as compiler. We are currently transitioning to TypeScript so you will see a mixture of normal JS files and TypeScript files.

* Run Tests to ensure that everything is set up correctly

Expand Down Expand Up @@ -77,13 +77,13 @@ If you only work on a single package you can watch only for that one by calling:

```sh
# e.g. `$ npm run watch:pkg @wdio/runner`
$ npm run watch:pkg <package-name>
$ npm run watch <package-name>
```

It is also a good idea to run jest in watch mode while developing on a single package to see if changes affect any tests:

```sh
$ npx jest ./packages/<package-name>/tests --watch
$ npx jest ./packages/<package-name>/tests --watch --coverageReporters lcov
```

## Create New Package
Expand Down
21 changes: 0 additions & 21 deletions babel.config.js

This file was deleted.

5 changes: 4 additions & 1 deletion e2e/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ module.exports = {
'<rootDir>/*.test.js'
],
moduleFileExtensions: ['js', 'ts'],
setupFilesAfterEnv: ['./jest.setup.js']
setupFilesAfterEnv: ['./jest.setup.js'],
transform: {
'^.+\\.(ts|js)$': 'ts-jest'
}
}
1 change: 0 additions & 1 deletion examples/devtools/intercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* $ npm install devtools webdriverio
*
*/
// eslint-disable-next-line import/no-unresolved
const { remote } = require('../../packages/webdriverio')

let browser;
Expand Down
59 changes: 59 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* workaround for bug
* https://github.com/jsdom/jsdom/issues/2795
* https://github.com/jsdom/jsdom/issues/2961
*/
const SKIPPED_NODE_10_TESTS = process.version.startsWith('v10')
? [
'<rootDir>/packages/webdriverio/tests/commands/browser/newWindow.test.js',
'<rootDir>/packages/webdriverio/tests/commands/element/isFocused.test.js',
'<rootDir>/packages/webdriverio/tests/scripts/resq.test.js',
'<rootDir>/packages/webdriverio/tests/scripts/isFocused.test.js'
]
: []

module.exports = {
testMatch: [
'**/tests/**/*.test.(js|ts)'
],
transform: {
'^.+\\.(ts|js)$': 'ts-jest'
},
testPathIgnorePatterns: [
'<rootDir>/tests/',
'<rootDir>/node_modules/',
...SKIPPED_NODE_10_TESTS
],
collectCoverageFrom: [
'packages/**/src/**/*.js'
],
moduleNameMapper: {
'graceful-fs': '<rootDir>/tests/helpers/fs.js'
},
coverageDirectory: './coverage/',
collectCoverage: true,
coverageThreshold: {
global: {
branches: 95,
functions: 98,
lines: 99,
statements: 98
}
},
testEnvironment: 'node',
coveragePathIgnorePatterns: [
'node_modules/',
'packages/devtools/src/scripts',
'packages/devtools/src/commands',
'packages/webdriverio/src/scripts',
'packages/wdio-devtools-service/src/scripts',
'packages/webdriverio/build',
'packages/webdriver/build',
'packages/wdio-cucumber-framework/tests/fixtures',
'packages/wdio-logger/build',
'packages/wdio-webdriver-mock-service',
'packages/wdio-lambda-runner',
'packages/wdio-smoke-test-reporter',
'packages/wdio-smoke-test-service'
]
}
Loading

0 comments on commit 6712e31

Please sign in to comment.