Skip to content

Commit

Permalink
test(browser): fix jshint for browser platform and build process
Browse files Browse the repository at this point in the history
  • Loading branch information
bitjson committed Sep 28, 2016
1 parent b22ca13 commit 350bb43
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"clean-build": "trash dist/plugin.min.js && trash dist/www.min.js && trash src/browser/worker.min.js",
"install": "npm run build",
"test": "npm run jshint",
"jshint": "jshint www && jshint src && jshint tests",
"jshint": "jshint src/browser/src && jshint src/common/src && jshint tests",
"gen-tests": "npm run build && npm run clean-platform-tests && npm run mkdirp-platform-tests && npm run copy-platform-tests && npm run install-platform-tests",
"clean-platform-tests": "trash ../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests",
"mkdirp-platform-tests": "mkdirp ../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests",
Expand Down
2 changes: 1 addition & 1 deletion src/browser/src/createQRScannerInternal.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,4 @@ module.exports = function(){
getStatus: getStatus,
destroy: destroy
};
}
};
6 changes: 3 additions & 3 deletions src/browser/src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function QRScanner() {
openSettings: internal.openSettings,
getStatus: internal.getStatus,
destroy: internal.destroy
}
};

// shim cordova's functionality for library usage
var shimCordova = {
Expand All @@ -31,10 +31,10 @@ function QRScanner() {
functionList[functionName](successCallback, errorCallback);
}
}
}
};

var adapter = createQRScannerAdapter(shimCordova);
return adapter;
};
}

module.exports = new QRScanner();
2 changes: 1 addition & 1 deletion src/browser/src/worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global module:true, importScripts:false, postMessage:false, onmessage:true*/
/*global module:true, postMessage:false, onmessage:true*/

module = {};
var QrCode = require('qrcode-reader').default;
Expand Down
2 changes: 2 additions & 0 deletions src/common/src/cordova-remap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// This file is generated by `npm run build`.

/*global exports:false*/
/*jshint unused:false */
// remap parameter names from cordova.define
// see `externals` in webpack.cordova.config.js
var cordovaRequire = require;
Expand Down
4 changes: 2 additions & 2 deletions src/common/src/cordova-www.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var cordova = require('webpack/cordova');
var globalCordova = require('webpack/cordova');
var cordovaModule = require('webpack/cordova/module');

var createQRScannerAdapter = require('./createQRScannerAdapter.js');

// pass in global cordova object to expose cordova.exec
var QRScannerAdapter = createQRScannerAdapter(cordova);
var QRScannerAdapter = createQRScannerAdapter(globalCordova);
cordovaModule.exports = QRScannerAdapter;
2 changes: 1 addition & 1 deletion src/common/src/createQRScannerAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,4 @@ return {
cordova.exec(doneCallback(callback), null, 'QRScanner', 'getStatus', []);
}
};
}
};
4 changes: 2 additions & 2 deletions tests/library/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
/*global require:false, process:false, __dirname:false*/

var express = require('express');
var app = express();
Expand All @@ -8,5 +8,5 @@ app.use(express.static(__dirname + '/../../', {
}));
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
console.log('To view the test, visit http://localhost:' + app.get('port') + '/tests/library/')
console.log('To view the test, visit http://localhost:' + app.get('port') + '/tests/library/');
});

0 comments on commit 350bb43

Please sign in to comment.