-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improvements with Saucelabs/Codeclimate
- Loading branch information
Showing
9 changed files
with
274 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
engines: | ||
duplication: | ||
enabled: true | ||
config: | ||
languages: | ||
- javascript | ||
eslint: | ||
enabled: true | ||
fixme: | ||
enabled: true | ||
ratings: | ||
paths: | ||
- "lib/**/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
test/lib/ | ||
node_modules/ | ||
coverage/ | ||
npm-debug.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:https://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']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |