Skip to content

Commit

Permalink
Feature/es6 first tests (#1152)
Browse files Browse the repository at this point in the history
* First draft of babel+eslint+rollup

* Moved to gulp 4, improved some logging output during builds.

* Tweaks to the build process.

* Fixing the versioning task.

* Created separate copies of the .eslintrc files, one for each package.

* Started converting the first of the tests to es6.
Started by converting HttpProvider to es6, which led to the conversion of contract.js, eth.sendTransaction.js, and setProvider.js
Enabling ES6 support in Mocha led to fixes in method.buildCall.js and utils.sha3.js
Fixed the problems in test/eth.sendTransaction.js that were causing the error "Transaction was not mined within 50 blocks, please make sure your transaction was properly send. Be aware that it might still be mined!".
There may be deeper issues with the tests in eth.sendTransaction.js, these will require some conversation with Fabian before moving forward.

* Fixing coverage problems by upgrading to nyc (the new istanbul)

* Fixed test failure on node 8
  • Loading branch information
dacarley authored and frozeman committed Nov 27, 2017
1 parent 44fee04 commit 6a133ab
Show file tree
Hide file tree
Showing 15 changed files with 1,790 additions and 1,916 deletions.
22 changes: 22 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
"extends": "airbnb-base",
"plugins": [],
"rules": {
"curly": [
"error",
"all"
],
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": false
}
],
"quotes": [
"error",
"single",
Expand All @@ -16,7 +27,17 @@
"allowTemplateLiterals": true
}
],
"no-plusplus": "off",
"no-underscore-dangle": "off",
"newline-before-return": "error",
"no-unused-vars": [
"error",
{
"vars": "all",
"args": "all",
"argsIgnorePattern": "^_"
}
],
"no-multiple-empty-lines": [
"error",
{
Expand Down Expand Up @@ -52,6 +73,7 @@
{
"devDependencies": [
"gulpfile.babel.js",
"test/**/*.js",
"gulp/**/*.js"
]
}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ node_modules
.idea/
.npm/
/packages/**/lib/*
.vscode/
/.nyc_output
package-lock.json

3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ install:
- npm install
script:
- npm run build
- npm run test-coveralls
- npm run test
- npm run coverage
5 changes: 3 additions & 2 deletions gulp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export default {
lintableFiles: [
scripts,
'./*.js',
'./gulp/**/*.js',
'./test/**/*.js'
'./gulp/**/*.js'
// Disable linting tests until we've finished converting them to ES6
// './test/**/*.js'
]
};
4 changes: 2 additions & 2 deletions gulp/transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ function transpile() {
dest: config.PACKAGES_DIR,
map: swapSrcWithLib
}))
.pipe(through.obj((file, enc, callback) => {
.pipe(through.obj((file, _enc, callback) => {
gutil.log('Compiling', `'${chalk.cyan(file.relative)}'...`);
callback(null, file);
}))
.pipe(babel())
.pipe(through.obj((file, enc, callback) => {
.pipe(through.obj((file, _enc, callback) => {
// Passing 'file.relative' for consistency with newer() above
// eslint-disable-next-line no-param-reassign
file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"watch": "gulp watch",
"docs": "cd docs; make html;",
"lint": "gulp lint",
"test": "mocha; gulp lint",
"test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose"
"test": "nyc --reporter=html --reporter=text mocha",
"coverage": "nyc report --reporter=text-lcov | coveralls --verbose"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -91,10 +91,10 @@
"gulp-plumber": "^1.1.0",
"gulp-replace": "^0.6.1",
"gulp-util": "^3.0.8",
"istanbul": "^0.4.5",
"lerna": "^2.4.0",
"lodash": "^4.17.4",
"mocha": "^4.0.1",
"nyc": "^11.2.1",
"rollup": "^0.50.0",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-commonjs": "^8.2.4",
Expand Down
20 changes: 0 additions & 20 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
{
"root": true,
"env": {
"node": true,
"mocha": true
},
"rules": {
"no-bitwise": 2,
"camelcase": 2,
"eqeqeq": 2,
"no-extend-native": 2,
"block-scoped-var": 0,
"complexity": [
2,
10
],
"max-depth": [
2,
4
],
"no-new": 0,
"no-unused-vars": 0,
"no-undef": 0
}
}
Loading

0 comments on commit 6a133ab

Please sign in to comment.