Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

Apply template - Closes #568,#569,#570,#571,#572,#573,#575 #558

Merged
merged 15 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist-*/
docs/
browsertest/browsertest.js
browsertest/browsertest.min.js
cypress/plugins/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jspm_packages

# IDE directories
.idea
tmp

# Distribution folders
dist-browser/*.js
Expand All @@ -59,3 +60,6 @@ dist-node
browsertest/package.json
browsertest/browsertest.js
browsertest/browsertest.min.js

# Lock files
yarn.lock
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.11.1
6.12.3
104 changes: 0 additions & 104 deletions Gruntfile.js

This file was deleted.

36 changes: 26 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,35 @@ pipeline {
stages {
stage('Install dependencies') {
steps {
sh '''
cp -r ~/cache/${CHANGE_TARGET:-${BRANCH_NAME:-development}}/node_modules ./ || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to this step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up the template mainly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we had it for a reason @fchavant - can you have a look please? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think main reason is the cypress dependency, which takes quite long time.
However, I seems like not being a problem with current 1.0.0, also test should be as stateless as possible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that would be quite cool actually. Yes, I agree to your point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cypress is still around.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fchavant Ah, sorry. What I meant was not being problem with this current branch.
Install dependency step finishes in 1.5 min

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think probably 1 minute of the 1.5 minutes is alone cypress. Since we do not care so much about cypress version, maintaining the cache here would make sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is not critical to have cache here, I prefer not having the cache here.
For example, the version of cypress was affecting this PR, which would not be able to be detected easily if it was cached.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I was not aware this was causing problems already. In that case not cached is fine with me 👍

npm install --verbose
cp ~/.coveralls.yml .
'''
sh 'npm install --verbose'
}
}
stage('Run lint') {
steps{
sh 'grunt eslint-ci'
steps {
ansiColor('xterm') {
sh 'npm run lint'
}
}
}
stage('Build') {
steps {
sh 'npm run build'
}
}
stage('Run node tests') {
stage('Run tests') {
steps {
sh 'npm run jenkins'
ansiColor('xterm') {
sh 'npm run test'
sh '''
cp ~/.coveralls.yml .coveralls.yml
npm run cover
'''
}
}
}
stage('Run browser tests') {
steps {
sh '''
npm run build
npm run build:check
npm run build:browsertest
HTTP_PORT=808${EXECUTOR_NUMBER:-0}
Expand All @@ -50,9 +58,17 @@ pipeline {
post {
success {
deleteDir()
githubNotify context: 'continuous-integration/jenkins/lisk-js', description: 'The build passed.', status: 'SUCCESS'
}
failure {
archiveArtifacts allowEmptyArchive: true, artifacts: 'cypress/screenshots/'
githubNotify context: 'continuous-integration/jenkins/lisk-js', description: 'The build failed.', status: 'FAILURE'
}
aborted {
githubNotify context: 'continuous-integration/jenkins/lisk-js', description: 'The build was aborted.', status: 'ERROR'
}
always {
archiveArtifacts allowEmptyArchive: true, artifacts: 'logs/*'
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### What was the problem?

### How did I fix it?

### How to test it?

### Review checklist

* The PR solves #INSERT_ISSUE_NUMBER
* All new code is covered with unit tests
* All new code was formatted with Prettier
* Linting passes
* Tests pass
* Commit messages follow the
[commit guidelines](CONTRIBUTING.md#git-commit-messages)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would need to be a full link - it does not seem to work by mere reference to the CONTRIBUTING file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it's working by looking at the view on this github

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub has some magic here. ✨

* Documentation has been added/updated
87 changes: 55 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,67 @@
"name": "lisk-js",
"version": "0.4.5",
"description": "JavaScript library for sending Lisk transactions from the client or server",
"main": "./dist-node/index.js",
"author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>",
"license": "GPL-3.0",
"keywords": [
"lisk",
"blockchain",
"nodejs",
"javascript",
"library"
],
"homepage": "https://github.com/LiskHQ/lisk-js#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/LiskHQ/lisk-js.git"
},
"bugs": {
"url": "https://github.com/LiskHQ/lisk-js/issues"
},
"engines": {
"node": ">=6.3 <=9.5",
"npm": ">=3 <=5"
},
"main": "dist-node/index.js",
"scripts": {
"prestart": "./bin/prestart.sh",
"start": "./bin/start.sh",
"test": "nyc mocha test --recursive",
"test:watch": "chokidar \"./(src|test)/**/*.js\" -c \"mocha test --recursive\" --initial",
"format": "prettier --write \"browsertest/{setup,runTests}.js\" \"{cypress/integration,src,test}/**/*.js\"",
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix",
"babel": "babel src -d dist-node",
"babel:browsertest": "babel src -d ./browsertest/src && BABEL_ENV=browsertest babel test --ignore test/transactions/dapp.js -d ./browsertest/test",
"browserify": "browserify ./dist-node/index.js -o ./dist-browser/lisk-js.js -s lisk -t rewireify",
"browserify:browsertest": "browserify ./browsertest/test/*.js ./browsertest/test/**/*.js -o ./browsertest/browsertest.js -s lisk -t rewireify",
"uglify": "uglifyjs -nm -o ./dist-browser/lisk-js.min.js ./dist-browser/lisk-js.js",
"uglify:browsertest": "uglifyjs -o ./browsertest/browsertest.min.js ./browsertest/browsertest.js",
"serve:browsertest": "http-server browsertest",
"test": "NODE_ENV=test nyc mocha test",
"test:watch": "npm test -- --watch",
"test:watch:min": "npm run test:watch -- --reporter=min",
"test:node": "npm run build:check && BABEL_ENV=buildcheck mocha test --recursive",
"test:browser": "cypress run --env ROOT_DIR=\"${PWD##*/}\"",
"cover": "nyc report --reporter=lcov",
"eslint": "grunt eslint",
"prettier": "prettier --write \"browsertest/{setup,runTests}.js\" \"{cypress/integration,src,test}/**/*.js\"",
"serve:browsertest": "http-server browsertest",
"jenkins": "grunt jenkins --verbose",
"build": "grunt build",
"cover": "if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi",
"cover:base": "NODE_ENV=test nyc report",
"cover:local": "npm run cover:base -- --reporter=html --reporter=text",
"cover:ci": "npm run cover:base -- --reporter=text-lcov | coveralls -v",
"prebuild:browsertest": "cp package.json browsertest/",
"build:browsertest": "npm run babel:browsertest && npm run browserify:browsertest && npm run uglify:browsertest",
"postbuild:browsertest": "rm -r browsertest/src browsertest/test",
"prebuild:node": "rm -r dist-node/* || mkdir dist-node | echo",
"build:node": "npm run babel",
"prebuild:browser": "rm ./dist-browser/lisk-js.js ./dist-browser/lisk-js.min.js | echo",
"build:browser": "npm run babel && npm run browserify && npm run uglify",
"prebuild": "npm run prebuild:node && npm run prebuild:browser",
"build": "npm run babel && npm run browserify && npm run uglify",
"build:check": "node -e \"require('./dist-node')\"",
"build:browsertest": "grunt build-browsertest",
"precommit": "lint-staged && npm run eslint",
"prepush": "npm run eslint && npm test",
"prepublishOnly": "npm run prepush && npm run build",
"precommit": "lint-staged && npm run lint",
"prepush": "npm run lint && npm test",
"prepublishOnly": "rm -r ./node_modules && npm install && npm run prepush && npm run build",
"prepublish:browser": "npm run prepublishOnly",
"publish:browser": "./bin/publish_browser.sh",
"postpublish": "npm run publish:browser"
},
"repository": {
"type": "git",
"url": "git@github.com:LiskHQ/lisk-js.git"
},
"author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>",
"license": "GPL-3.0",
"dependencies": {
"babel-runtime": "=6.26.0",
"bip39": "=2.4.0",
Expand All @@ -50,29 +78,24 @@
"babel-plugin-rewire": "=1.1.0",
"babel-plugin-transform-runtime": "=6.23.0",
"babel-preset-env": "=1.6.0",
"chokidar-cli": "=1.2.0",
"coveralls": "=2.13.1",
"browserify": "=16.0.0",
"coveralls": "=3.0.0",
"cypress": "=2.0.2",
"eslint": "=4.16.0",
"eslint-config-airbnb-base": "=11.3.1",
"eslint-config-lisk-base": "=0.1.0",
"eslint-plugin-import": "=2.7.0",
"grunt": "=1.0.1",
"grunt-browserify": "=5.0.0",
"grunt-contrib-uglify": "=3.0.1",
"grunt-coveralls": "=1.0.1",
"grunt-eslint": "=20.0.0",
"grunt-exec": "=2.0.0",
"eslint-plugin-mocha": "=4.11.0",
"http-server": "=0.10.0",
"husky": "=0.14.3",
"lint-staged": "=4.2.3",
"load-grunt-tasks": "=3.5.2",
"mocha": "=3.4.2",
"mocha-lcov-reporter": "=1.3.0",
"mocha": "=4.0.1",
"nyc": "=11.3.0",
"prettier": "=1.7.4",
"prettier": "=1.8.2",
"rewireify": "=0.2.5",
"should": "=11.2.1",
"should-sinon": "=0.0.6",
"sinon": "=2.2.0"
"sinon": "=4.1.2",
"uglify-js": "=3.3.10"
}
}
1 change: 1 addition & 0 deletions test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"plugins": ["mocha"],
"env": {
"mocha": true
},
Expand Down
1 change: 1 addition & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--timeout 10000
--require ./test/setup.js
--compilers js:babel-register
--recursive
8 changes: 5 additions & 3 deletions test/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Object.defineProperty(global, 'should', { value: should });
global.sinon = sinon;
global.sandbox = sinon.sandbox.create();

naclFactory.instantiate(nacl => {
global.naclInstance = nacl;
});
if (!global.naclInstance) {
naclFactory.instantiate(nacl => {
global.naclInstance = nacl;
});
}
5 changes: 4 additions & 1 deletion test/transactions/utils/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ describe('time module', () => {
let clock;

before(() => {
clock = sinon.useFakeTimers(nowRealTime, 'Date');
clock = sinon.useFakeTimers({
now: nowRealTime,
toFake: ['Date'],
});
});

after(() => {
Expand Down
Loading