Add npm test to travis ci

10.3.x-maintenance
Adem Gaygusuz 2018-06-01 17:46:10 +01:00
parent aff6f3c8a1
commit 2e5bdae80e
5 changed files with 21 additions and 7 deletions

View File

@ -19,11 +19,15 @@ language: node_js
node_js:
- 8.11.2
addons:
chrome: stable
before_install:
- npm i -g npm@6.0.1
- npm install gulp -g
script:
- npm test
- gulp release
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then gulp release --chromeos; fi

View File

@ -10,7 +10,7 @@
"_postinstall": "node ./node_modules/platform-dependent-modules/cli.js",
"postinstall": "npm run _postinstall",
"gulp": "gulp",
"test": "karma start src/test/karma.conf.js"
"test": "karma start test/karma.conf.js"
},
"window": {
"show": false,

View File

@ -256,14 +256,14 @@ TABS.cli.read = function (readInfo) {
case lineFeedCode:
if (GUI.operating_system != "MacOS") {
writeLineToOutput(this.cliBuffer);
}
this.cliBuffer = "";
}
break;
case carriageReturnCode:
if (GUI.operating_system == "MacOS") {
writeLineToOutput(this.cliBuffer);
}
this.cliBuffer = "";
}
break;
case 60:
this.cliBuffer += '&lt';

View File

@ -1,6 +1,6 @@
module.exports = function(config) {
config.set({
basePath: '../../',
basePath: '../',
frameworks: ['mocha', 'chai', 'sinon-chai'],
files: [
'./libraries/jquery-2.1.4.min.js',
@ -10,9 +10,15 @@ module.exports = function(config) {
'./src/js/localization.js',
'./src/js/gui.js',
'./src/js/tabs/cli.js',
'./src/test/**/*.js'
'./test/**/*.js'
],
browsers: ['ChromeHeadless'],
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
singleRun: true
});
};

View File

@ -39,7 +39,11 @@ describe('TABS.cli', () => {
data: toArrayBuffer('\r\033[Kserialpassthrough\tservo\r\n# ser')
});
expect(cliOutput.html()).to.equal('<br>serialpassthrough\tservo<br>');
// Ambigous auto-complete from firmware is preceded with an \r carriage return
const expectedValue = GUI.operating_system === "MacOS" ?
'<br>serialpassthrough\tservo<br>' :
'serialpassthrough\tservo<br>';
expect(cliOutput.html()).to.equal(expectedValue);
expect(cliPrompt.val()).to.equal('ser');
});