2015-03-24 11:32:12 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var eslint = require('eslint');
|
|
|
|
var should = require('should');
|
|
|
|
|
|
|
|
var cli = new eslint.CLIEngine();
|
|
|
|
var formatter = cli.getFormatter();
|
|
|
|
|
|
|
|
var report;
|
|
|
|
|
2015-03-24 11:52:43 +01:00
|
|
|
describe('code style guide', function() {
|
2015-03-24 11:32:12 +01:00
|
|
|
it('index.js should follow our lint style guide', function(done) {
|
|
|
|
report = cli.executeOnFiles(['index.js']);
|
|
|
|
if (report.errorCount > 0 || report.warningCount > 0) {
|
|
|
|
console.log(formatter(report.results));
|
|
|
|
}
|
|
|
|
|
|
|
|
should(report.errorCount).equal(0);
|
|
|
|
should(report.warningCount).equal(0);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('test/main.js should follow our lint style guide', function(done) {
|
|
|
|
report = cli.executeOnFiles(['test/main.js']);
|
|
|
|
if (report.errorCount > 0 || report.warningCount > 0) {
|
|
|
|
console.log(formatter(report.results));
|
|
|
|
}
|
|
|
|
|
|
|
|
should(report.errorCount).equal(0);
|
|
|
|
should(report.warningCount).equal(0);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('test/lint.js should follow our lint style guide', function(done) {
|
|
|
|
cli = new eslint.CLIEngine({
|
|
|
|
'rules': {
|
2015-03-27 00:15:59 +01:00
|
|
|
'no-console': 0
|
2015-03-24 11:32:12 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
report = cli.executeOnFiles(['test/lint.js']);
|
|
|
|
if (report.errorCount > 0 || report.warningCount > 0) {
|
|
|
|
console.log(formatter(report.results));
|
|
|
|
}
|
|
|
|
|
|
|
|
should(report.errorCount).equal(0);
|
|
|
|
should(report.warningCount).equal(0);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|