mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Run JavaScript tests on Travis
Using Sauce Labs and Grunt. Also install runtime dependencies using Bower to get the Jed package that's used in testing, and save the Bower version resolutions for Travis so that step can be automated.
This commit is contained in:
+19
-1
@@ -20,6 +20,7 @@ addons:
|
||||
- libssl-dev
|
||||
- gcc-5
|
||||
- g++-5
|
||||
sauce_connect: true
|
||||
|
||||
install:
|
||||
# Use GCC 5.
|
||||
@@ -27,6 +28,16 @@ install:
|
||||
# Run install step script to download and build dependencies.
|
||||
- chmod +x scripts/install-step.travis.sh
|
||||
- ./scripts/install-step.travis.sh
|
||||
# Install the latest stable Node.js. The default Node.js version is too old
|
||||
# for some of the JavaScript syntax used.
|
||||
- npm install -g nvm
|
||||
- nvm install node
|
||||
# Install Node.js dependencies
|
||||
- npm install
|
||||
# Add local binary path to PATH
|
||||
- export PATH="./node_modules/.bin:$PATH"
|
||||
# Install runtime dependencies using Bower
|
||||
- bower install
|
||||
|
||||
before_script:
|
||||
# Build Google Test
|
||||
@@ -46,7 +57,9 @@ before_script:
|
||||
# Travis machines are 64 bit, and the dependencies use dynamic linking.
|
||||
- cmake .. -DPROJECT_ARCH=64 -DPROJECT_STATIC_RUNTIME=OFF -DBUILD_SHARED_LIBS=OFF -DGTEST_ROOT=../../googletest-release-1.7.0
|
||||
|
||||
script: make tests && ./tests
|
||||
script:
|
||||
- npm test
|
||||
- make tests && ./tests
|
||||
|
||||
before_deploy:
|
||||
# Build the metadata validator
|
||||
@@ -69,3 +82,8 @@ notifications:
|
||||
- "chat.freenode.net#loot"
|
||||
use_notice: true
|
||||
skip_join: true
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: OWgDkff/b+0eKk/P75rBnecaPDv1E/gMkCzsTUUtofmzj+sttpMUsh8VOVUvckGs5m3fRwRhc/t99gR4FuDtMOVE5JZ8CqZn7tcv2wNAspQ613pS0nWyIX/IUbyF+gjtPW2dWy81hKVtTP4yFvUn1Gk+JRjJLSyxM53Xt6oTOlY=
|
||||
- secure: XpGbqizjWfaGiWDkrcW4UhSW8ijm00jgSo2qkthza3QmHQ3C0Vye3gQjjITCq+y6izQTPa46fxaI+Ozligyh4aQ1G8SpCa77tXMBfvo31led+s81FlAOSVGDJ/2eDOoawFuj5dTKTPR1zLniDYH8AqG8EDZuLoK6fhx7CchU2Yw=
|
||||
|
||||
+17
@@ -37,5 +37,22 @@
|
||||
"jed-gettext-parser": "~1.0.0",
|
||||
"paper-toggle-button": "Polymer/paper-toggle-button#~0.5.4",
|
||||
"core-overlay": "WrinklyNinja/core-overlay#fix-focus-self-as-next"
|
||||
},
|
||||
"resolutions": {
|
||||
"polymer": "^0.5",
|
||||
"core-icons": "^0.5",
|
||||
"core-icon": "^0.5",
|
||||
"core-collapse": "^0.5",
|
||||
"core-focusable": "^0.5",
|
||||
"core-icon-button": "^0.5",
|
||||
"core-resizable": "^0.5",
|
||||
"core-iconset-svg": "^0.5",
|
||||
"core-dropdown": "null-dimensions-positions-fix",
|
||||
"core-transition": "^0.5",
|
||||
"core-overlay": "fix-focus-self-as-next",
|
||||
"webcomponentsjs": "^0.7.18",
|
||||
"core-iconset": "^0.5",
|
||||
"core-selection": "^0.5",
|
||||
"core-meta": "^0.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
module.exports = (grunt) => {
|
||||
grunt.initConfig({
|
||||
connect: {
|
||||
server: {
|
||||
options: {
|
||||
base: '',
|
||||
port: 9999,
|
||||
},
|
||||
},
|
||||
},
|
||||
'saucelabs-mocha': {
|
||||
all: {
|
||||
options: {
|
||||
urls: ['http://127.0.0.1:9999/src/tests/gui/html/js/test.html'],
|
||||
build: process.env.TRAVIS_JOB_ID,
|
||||
throttled: 3,
|
||||
browsers: [{
|
||||
browserName: 'chrome',
|
||||
platform: 'Windows 10',
|
||||
version: '47',
|
||||
}],
|
||||
testname: 'LOOT UI JS tests',
|
||||
},
|
||||
},
|
||||
},
|
||||
watch: {},
|
||||
});
|
||||
|
||||
// Loading dependencies
|
||||
for (const key in grunt.file.readJSON('package.json').devDependencies) {
|
||||
if (key !== 'grunt' && key.indexOf('grunt') === 0) {
|
||||
grunt.loadNpmTasks(key);
|
||||
}
|
||||
}
|
||||
|
||||
grunt.registerTask('dev', ['connect', 'watch']);
|
||||
grunt.registerTask('test', ['connect', 'saucelabs-mocha']);
|
||||
};
|
||||
@@ -17,8 +17,16 @@
|
||||
"eslint": "^1.10.3",
|
||||
"eslint-config-airbnb": "^2.0.0",
|
||||
"fs-extra": "^0.26.2",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-cli": "^0.1.13",
|
||||
"grunt-contrib-connect": "^0.11.2",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-saucelabs": "^8.6.2",
|
||||
"mocha": "^2.3.4",
|
||||
"should": "^8.0.1",
|
||||
"vulcanize": "^0.7.11"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,27 @@
|
||||
<script src="../../../../gui/html/js/plugin.js"></script>
|
||||
<script src="test_plugin.js"></script>
|
||||
<script>
|
||||
mocha.checkLeaks();
|
||||
mocha.run();
|
||||
onload = function(){
|
||||
mocha.checkLeaks();
|
||||
var runner = mocha.run();
|
||||
var failedTests = [];
|
||||
runner.on('end', function(){
|
||||
window.mochaResults = runner.stats;
|
||||
window.mochaResults.reports = failedTests;
|
||||
});
|
||||
runner.on('fail', logFailure);
|
||||
function logFailure(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