Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Lint errors in examples and eslint path #144

Merged
merged 2 commits into from
Jul 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/fixtures/file.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
exports.ok = true;
exports.ok = true;
142 changes: 71 additions & 71 deletions example/karma-complex.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,104 +12,104 @@ var configSettings = {
};

module.exports = function(config) {
config.set({
config.set({

// base path, that will be used to resolve files and exclude
basePath: '',
// base path, that will be used to resolve files and exclude
basePath: '',


// frameworks to use
frameworks: ['mocha'],
// frameworks to use
frameworks: ['mocha'],


// list of files / patterns to load in the browser
files: [
'test/index.js',
'test/separate.js',
],
// list of files / patterns to load in the browser
files: [
'test/index.js',
'test/separate.js',
],


// list of preprocessors
preprocessors: {
'test/*': ['webpack']
},
// list of preprocessors
preprocessors: {
'test/*': ['webpack']
},


webpack: Object.keys(configSettings).map(function(name) {
var config = {
name: name,
resolve: {
extensions: ["", ".js", ".coffee"]
},
module: {
loaders: [
{ test: /\.coffee$/, loader: "coffee-loader" }
]
}
};
Object.keys(configSettings[name]).forEach(function(key) {
config[key] = configSettings[name][key]
});
return config;
}),
webpack: Object.keys(configSettings).map(function(name) {
var config = {
name: name,
resolve: {
extensions: ["", ".js", ".coffee"]
},
module: {
loaders: [
{ test: /\.coffee$/, loader: "coffee-loader" }
]
}
};
Object.keys(configSettings[name]).forEach(function(key) {
config[key] = configSettings[name][key]
});
return config;
}),


webpackMiddleware: {
stats: {
colors: true
}
},
webpackMiddleware: {
stats: {
colors: true
}
},


// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['spec'],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['spec'],


// web server port
port: 9876,
// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,
// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: ['Chrome'],
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: ['Chrome'],


// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,


// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true,


// List plugins explicitly, since autoloading karma-webpack
// won't work here
plugins: [
require("karma-mocha"),
require("karma-spec-reporter"),
require("karma-chrome-launcher"),
require("../")
]
});
// List plugins explicitly, since autoloading karma-webpack
// won't work here
plugins: [
require("karma-mocha"),
require("karma-spec-reporter"),
require("karma-chrome-launcher"),
require("../")
]
});
};
124 changes: 62 additions & 62 deletions example/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,96 +12,96 @@ var configSettings = {
};

module.exports = function(config) {
config.set({
config.set({

// base path, that will be used to resolve files and exclude
basePath: '',
// base path, that will be used to resolve files and exclude
basePath: '',


// frameworks to use
frameworks: ['mocha'],
// frameworks to use
frameworks: ['mocha'],


// list of files / patterns to load in the browser
files: [
'test/index.js'
],
// list of files / patterns to load in the browser
files: [
'test/index.js'
],


// list of preprocessors
preprocessors: {
'test/*': ['webpack']
},
// list of preprocessors
preprocessors: {
'test/*': ['webpack']
},


webpack: {
resolve: {
extensions: ["", ".js", ".coffee"]
webpack: {
resolve: {
extensions: ["", ".js", ".coffee"]
},
module: {
loaders: [
{ test: /\.coffee$/, loader: "coffee-loader" }
]
}
},
module: {
loaders: [
{ test: /\.coffee$/, loader: "coffee-loader" }
]
}
},


webpackMiddleware: {
stats: {
colors: true
}
},
webpackMiddleware: {
stats: {
colors: true
}
},


// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['spec'],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['spec'],


// web server port
port: 9876,
// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,
// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: ['Chrome'],
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: ['Chrome'],


// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,


// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,


// List plugins explicitly, since autoloading karma-webpack
// won't work here
plugins: [
require("karma-mocha"),
require("karma-spec-reporter"),
require("karma-chrome-launcher"),
require("../")
]
});
// List plugins explicitly, since autoloading karma-webpack
// won't work here
plugins: [
require("karma-mocha"),
require("karma-spec-reporter"),
require("karma-chrome-launcher"),
require("../")
]
});
};
2 changes: 1 addition & 1 deletion example/test/aTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ describe("a-test", function() {
});
if(!test) throw new Error("Chunk should be async");
});
});
});
2 changes: 1 addition & 1 deletion example/test/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
var testsContext = require.context(".", true, /Test$/);
testsContext.keys().forEach(testsContext);
testsContext.keys().forEach(testsContext);
2 changes: 1 addition & 1 deletion example/test/separate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ describe("separate-test", function() {
it("should run the test", function() {
var ok = 1;
});
});
});
5 changes: 3 additions & 2 deletions mocha-env-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ var loaderUtils = require("loader-utils");
module.exports = function(content, map) {
this.cacheable();

var sourceNode;
var id = this.options.name;
if(!id) this.callback(null, content, map);

if(map) {
var sourceNode = SourceNode.fromSourceWithMap(content, map);
sourceNode = SourceNode.fromSourceWithMap(content, map);
} else {
var fileName = loaderUtils.getRemainingRequest(this);
var sourceNode = new SourceNode(null, null, null);
sourceNode = new SourceNode(null, null, null);
content.split("\n").forEach(function(line, idx) {
sourceNode.add(new SourceNode(idx + 1, 0, fileName, line + "\n"));
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"scripts": {
"pretest": "npm run lint && npm run beautify-lint",
"lint": "eslint lib",
"lint": "eslint example index.js mocha-env-loader.js",
"beautify-lint": "beautify-lint *.js"
},
"license": "MIT",
Expand Down