Add governance testing based on JSCS and consolidate test suite to makefile. Resolves GH-57
This commit is contained in:
parent
623dce5402
commit
1bd49e4e49
5 changed files with 57 additions and 14 deletions
27
.jscsrc
Normal file
27
.jscsrc
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"requireCurlyBraces": [
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireSpaceAfterKeywords": [
|
||||
"default"
|
||||
],
|
||||
"requireSpacesInFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"disallowSpacesInFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||
"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"],
|
||||
"validateIndentation": 4,
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"safeContextKeyword": "self"
|
||||
}
|
20
makefile
Normal file
20
makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
JSCS_PATH = ./node_modules/.bin/jscs
|
||||
KARMA_PATH = ./node_modules/.bin/karma
|
||||
KARMA_CONFIG = ./test/fixtures/karma.conf.js
|
||||
|
||||
# Performs code governance (lint + style) test
|
||||
lint:
|
||||
@$(JSCS_PATH) ./js/*
|
||||
@$(JSCS_PATH) ./test/unit/*
|
||||
|
||||
# Performs unit tests
|
||||
unit:
|
||||
@$(KARMA_PATH) start $(KARMA_CONFIG) $*
|
||||
|
||||
# Run all test targets
|
||||
test:
|
||||
@make lint
|
||||
@make unit
|
||||
|
||||
# Ignore directory structure
|
||||
.PHONY: lint unit test
|
13
package.json
13
package.json
|
@ -2,10 +2,15 @@
|
|||
"name": "scratch-html5",
|
||||
"description": "HTML 5 based Scratch project player",
|
||||
"repository": "https://github.com/LLK/scratch-html5",
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"karma" : "~0.10",
|
||||
"jasmine-jquery" : "1.3.3",
|
||||
"karma-html2js-preprocessor" : "~0.1.0",
|
||||
"underscore" : "~1.6.0"
|
||||
"jasmine-jquery": "~1.3.3",
|
||||
"jscs": "~1.3.0",
|
||||
"karma": "~0.10",
|
||||
"karma-html2js-preprocessor": "~0.1.0",
|
||||
"underscore": "~1.6.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
BASE_DIR=`dirname $0`
|
||||
|
||||
echo ""
|
||||
echo "Starting Karma Server (http://karma-runner.github.io)"
|
||||
echo "-------------------------------------------------------------------"
|
||||
|
||||
$BASE_DIR/../node_modules/karma/bin/karma start $BASE_DIR/../config/karma.conf.js $*
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = function(config){
|
||||
config.set({
|
||||
basePath : '../',
|
||||
basePath : '../../',
|
||||
|
||||
files : [
|
||||
'test/artifacts/**/*.js',
|
Reference in a new issue