mirror of
https://github.com/hanzoai/elliptic.git
synced 2026-09-23 23:51:03 +00:00
test: improvements with Saucelabs/Codeclimate
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
engines:
|
||||||
|
duplication:
|
||||||
|
enabled: true
|
||||||
|
config:
|
||||||
|
languages:
|
||||||
|
- javascript
|
||||||
|
eslint:
|
||||||
|
enabled: true
|
||||||
|
fixme:
|
||||||
|
enabled: true
|
||||||
|
ratings:
|
||||||
|
paths:
|
||||||
|
- "lib/**/*"
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
test/lib/
|
||||||
node_modules/
|
node_modules/
|
||||||
coverage/
|
coverage/
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|||||||
Regular → Executable
+16
-4
@@ -11,12 +11,24 @@ node_js:
|
|||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
secure: ewqsRnX7z3+g6q+mM6peRPhuTlTlkJIRmVG/Ya9AcDXEb7as49KDTdqfMcOu7+FxF50ehqla+TRRCLRPOcVkWqs72OVUXEsjRASp9jQwpQGl+g/vZhyTMwlM2ENEkyiFQtobI1hYKgVW1ogftkc6vm7ywvoyTrFp/leVJBrTuHk=
|
secure: ewqsRnX7z3+g6q+mM6peRPhuTlTlkJIRmVG/Ya9AcDXEb7as49KDTdqfMcOu7+FxF50ehqla+TRRCLRPOcVkWqs72OVUXEsjRASp9jQwpQGl+g/vZhyTMwlM2ENEkyiFQtobI1hYKgVW1ogftkc6vm7ywvoyTrFp/leVJBrTuHk=
|
||||||
|
secure: d4Yj0rUDUSFrUKU9vuZZc3p4aiQmKwZVWigVhybU2RfZHpxoakTYd3z7Ys23z+yQZt+BWcul1L3H5DwvACGTwyltwVmHzTWSBtunHax41TN9ZwOY4y37qWNfzEkz72URPL65ujd8ozkyxsiysAq+BE9+5gl9OZxfzExXNfRD3e4
|
||||||
matrix:
|
matrix:
|
||||||
- TEST_SUITE=unit
|
- TEST_SUITE='npm run unit'
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- node_js: "4"
|
- node_js: "4"
|
||||||
env: TEST_SUITE=lint
|
env: TEST_SUITE='npm run lint'
|
||||||
- node_js: "4"
|
- node_js: "4"
|
||||||
env: TEST_SUITE=coveralls
|
env: TEST_SUITE='grunt coveralls'
|
||||||
script: npm run $TEST_SUITE
|
- node_js: "4"
|
||||||
|
env: TEST_SUITE='grunt saucelabs'
|
||||||
|
allow_failures:
|
||||||
|
- env: TEST_SUITE='grunt saucelabs'
|
||||||
|
fast_finish: true
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- node_modules
|
||||||
|
before_script:
|
||||||
|
- npm install -g grunt-cli
|
||||||
|
script:
|
||||||
|
- $TEST_SUITE
|
||||||
|
|||||||
+180
@@ -0,0 +1,180 @@
|
|||||||
|
module.exports = function(grunt) {
|
||||||
|
grunt.initConfig({
|
||||||
|
browserify: {
|
||||||
|
unittests: {
|
||||||
|
files: {
|
||||||
|
'test/lib/unittests-bundle.js': [ 'test/index.js']
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
transform: ['brfs']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
connect: {
|
||||||
|
server: {
|
||||||
|
options: {
|
||||||
|
port: 3000,
|
||||||
|
base: './test'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
copy: {
|
||||||
|
test: {
|
||||||
|
expand: true,
|
||||||
|
flatten: true,
|
||||||
|
cwd: 'node_modules/',
|
||||||
|
src: ['mocha/mocha.css', 'mocha/mocha.js'],
|
||||||
|
dest: 'test/lib/'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mocha_istanbul: {
|
||||||
|
coverage: {
|
||||||
|
src: ['test'],
|
||||||
|
options: {
|
||||||
|
coverage: false,
|
||||||
|
timeout: 6000,
|
||||||
|
reportFormats: ['cobertura','lcovonly']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
coveralls: {
|
||||||
|
src: ['test'],
|
||||||
|
options: {
|
||||||
|
coverage: true,
|
||||||
|
timeout: 6000,
|
||||||
|
reportFormats: ['cobertura','lcovonly']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'saucelabs-mocha': {
|
||||||
|
all: {
|
||||||
|
options: {
|
||||||
|
username: process.env.SAUCE_USERNAME,
|
||||||
|
key: process.env.SAUCE_ACCESS_KEY,
|
||||||
|
urls: ['http://127.0.0.1:3000/unittests.html'],
|
||||||
|
build: process.env.TRAVIS_JOB_ID,
|
||||||
|
testname: 'Sauce Unit Test for ellipticjs',
|
||||||
|
browsers: [
|
||||||
|
{
|
||||||
|
browserName: "safari",
|
||||||
|
platform: "OS X 10.11",
|
||||||
|
version: "9"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "safari",
|
||||||
|
platform: "OS X 10.10",
|
||||||
|
version: "8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "microsoftedge",
|
||||||
|
version: "13.10586",
|
||||||
|
platform: "Windows 10"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "internet explorer",
|
||||||
|
version: "11",
|
||||||
|
platform: "Windows 8.1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "internet explorer",
|
||||||
|
version: "10",
|
||||||
|
platform: "Windows 8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "internet explorer",
|
||||||
|
version: "9",
|
||||||
|
platform: "Windows 7"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "internet explorer",
|
||||||
|
version: "8",
|
||||||
|
platform: "Windows 7"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "android",
|
||||||
|
platform: "Linux",
|
||||||
|
version: "5.1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "android",
|
||||||
|
platform: "Linux",
|
||||||
|
version: "4.4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "iphone",
|
||||||
|
platform: "OS X 10.10",
|
||||||
|
version: "7.1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "iphone",
|
||||||
|
platform: "OS X 10.10",
|
||||||
|
version: "9.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "chrome",
|
||||||
|
platform: "Linux",
|
||||||
|
version: "38"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "chrome",
|
||||||
|
platform: "Linux",
|
||||||
|
version: "47"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "chrome",
|
||||||
|
platform: "Linux",
|
||||||
|
version: "beta"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "firefox",
|
||||||
|
platform: "Linux",
|
||||||
|
version: "38"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "firefox",
|
||||||
|
platform: "Linux",
|
||||||
|
version: "43"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
browserName: "firefox",
|
||||||
|
platform: "Linux",
|
||||||
|
version: "beta"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
public: "public",
|
||||||
|
maxRetries: 3,
|
||||||
|
throttled: 2,
|
||||||
|
pollInterval: 4000,
|
||||||
|
statusCheckAttempts: 200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
uglify: {
|
||||||
|
scrypt: {
|
||||||
|
files: {
|
||||||
|
'elliptic.min.js' : [ 'elliptic.js' ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-browserify');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
|
grunt.loadNpmTasks('grunt-mocha-istanbul');
|
||||||
|
grunt.loadNpmTasks('grunt-saucelabs');
|
||||||
|
|
||||||
|
grunt.event.on('coverage', function(lcov, done){
|
||||||
|
require('coveralls').handleInput(lcov, function(err){
|
||||||
|
if (err) {
|
||||||
|
return done(err);
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.registerTask('build', ['uglify']);
|
||||||
|
grunt.registerTask('coverage', ['browserify', 'copy:test', 'mocha_istanbul:coverage']);
|
||||||
|
grunt.registerTask('coveralls', ['browserify', 'copy:test', 'mocha_istanbul:coveralls']);
|
||||||
|
grunt.registerTask('saucelabs', ['browserify', 'copy:test', 'connect', 'saucelabs-mocha']);
|
||||||
|
};
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
# Elliptic [](http://travis-ci.org/indutny/elliptic) [](https://coveralls.io/github/indutny/elliptic?branch=master)
|
# Elliptic [](http://travis-ci.org/indutny/elliptic) [](https://coveralls.io/github/indutny/elliptic?branch=master) [](https://codeclimate.com/github/indutny/elliptic)
|
||||||
|
|
||||||
|
[](https://saucelabs.com/u/elliptic)
|
||||||
|
|
||||||
Fast elliptic-curve cryptography in a plain javascript implementation.
|
Fast elliptic-curve cryptography in a plain javascript implementation.
|
||||||
|
|
||||||
|
|||||||
+12
-6
@@ -7,13 +7,11 @@
|
|||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"coverage": "npm run unit --coverage",
|
"jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
|
||||||
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
|
"jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
|
||||||
"jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/*.js",
|
|
||||||
"jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/*.js",
|
|
||||||
"lint": "npm run jscs && npm run jshint",
|
"lint": "npm run jscs && npm run jshint",
|
||||||
"test": "npm run lint && npm run unit",
|
"unit": "istanbul test _mocha --reporter=spec test/index.js",
|
||||||
"unit": "istanbul test _mocha --reporter=spec test/*-test.js"
|
"test": "npm run lint && npm run unit"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -32,7 +30,15 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/indutny/elliptic",
|
"homepage": "https://github.com/indutny/elliptic",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"brfs": "^1.4.3",
|
||||||
"coveralls": "^2.11.3",
|
"coveralls": "^2.11.3",
|
||||||
|
"grunt": "^0.4.5",
|
||||||
|
"grunt-browserify": "^5.0.0",
|
||||||
|
"grunt-contrib-connect": "^1.0.0",
|
||||||
|
"grunt-contrib-copy": "^1.0.0",
|
||||||
|
"grunt-contrib-uglify": "^1.0.1",
|
||||||
|
"grunt-mocha-istanbul": "^3.0.1",
|
||||||
|
"grunt-saucelabs": "^8.6.2",
|
||||||
"istanbul": "^0.4.2",
|
"istanbul": "^0.4.2",
|
||||||
"jscs": "^2.9.0",
|
"jscs": "^2.9.0",
|
||||||
"jshint": "^2.6.0",
|
"jshint": "^2.6.0",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var fs = require('fs');
|
|
||||||
var elliptic = require('../');
|
var elliptic = require('../');
|
||||||
var utils = elliptic.utils;
|
var utils = elliptic.utils;
|
||||||
var toArray = elliptic.utils.toArray;
|
var toArray = elliptic.utils.toArray;
|
||||||
@@ -48,7 +47,7 @@ describe('sign.input ed25519 test vectors', function() {
|
|||||||
|
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
ed25519 = new eddsa('ed25519');
|
ed25519 = new eddsa('ed25519');
|
||||||
fs.readFile(__dirname + '/fixtures/sign.input', function(err, f) {
|
require('fs').readFile(__dirname + '/fixtures/sign.input', function(err, f) {
|
||||||
lines = f.toString().split('\n');
|
lines = f.toString().split('\n');
|
||||||
assert.equal(lines.length, expectedTests + 1 /*blank line*/);
|
assert.equal(lines.length, expectedTests + 1 /*blank line*/);
|
||||||
done();
|
done();
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
describe('Test specs', function () {
|
||||||
|
require('./api-test.js');
|
||||||
|
require('./curve-test.js');
|
||||||
|
require('./ecdh-test.js');
|
||||||
|
require('./ecdsa-test.js');
|
||||||
|
require('./ed25519-test.js');
|
||||||
|
require('./hmac-drbg-test.js');
|
||||||
|
});
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>scrypt-async Unit Tests</title>
|
||||||
|
<link rel="stylesheet" href="lib/mocha.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<script src="lib/mocha.js"></script>
|
||||||
|
<script>
|
||||||
|
mocha.setup('bdd');
|
||||||
|
mocha.timeout(20000);
|
||||||
|
</script>
|
||||||
|
<script src="lib/unittests-bundle.js"></script>
|
||||||
|
<script>
|
||||||
|
mocha.setup('bdd');
|
||||||
|
mocha.timeout(20000);
|
||||||
|
|
||||||
|
var runner = mocha.run();
|
||||||
|
var failedTests = [];
|
||||||
|
runner.on('end', function(){
|
||||||
|
window.mochaResults = runner.stats;
|
||||||
|
window.mochaResults.reports = failedTests;
|
||||||
|
});
|
||||||
|
runner.on('fail', function(test, err) {
|
||||||
|
var flattenTitles = function(test) {
|
||||||
|
var titles = [];
|
||||||
|
while (test.parent.title) {
|
||||||
|
titles.push(test.parent.title);
|
||||||
|
test = test.parent;
|
||||||
|
}
|
||||||
|
return titles.reverse();
|
||||||
|
};
|
||||||
|
failedTests.push({name: test.title, result: false, message: err.message, stack: err.stack, titles: flattenTitles(test)});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user