Skip to content

Commit 1bd49e4

Browse files
committed
Add governance testing based on JSCS and consolidate test suite to makefile. Resolves GH-57
1 parent 623dce5 commit 1bd49e4

File tree

5 files changed

+57
-14
lines changed

5 files changed

+57
-14
lines changed

Diff for: .jscsrc

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"requireCurlyBraces": [
3+
"for",
4+
"while",
5+
"do",
6+
"try",
7+
"catch"
8+
],
9+
"requireSpaceAfterKeywords": [
10+
"default"
11+
],
12+
"requireSpacesInFunctionExpression": {
13+
"beforeOpeningCurlyBrace": true
14+
},
15+
"disallowSpacesInFunctionExpression": {
16+
"beforeOpeningRoundBrace": true
17+
},
18+
"disallowEmptyBlocks": true,
19+
"disallowSpaceAfterObjectKeys": true,
20+
"requireCommaBeforeLineBreak": true,
21+
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
22+
"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"],
23+
"validateIndentation": 4,
24+
"disallowMixedSpacesAndTabs": true,
25+
"disallowTrailingWhitespace": true,
26+
"safeContextKeyword": "self"
27+
}

Diff for: makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
JSCS_PATH = ./node_modules/.bin/jscs
2+
KARMA_PATH = ./node_modules/.bin/karma
3+
KARMA_CONFIG = ./test/fixtures/karma.conf.js
4+
5+
# Performs code governance (lint + style) test
6+
lint:
7+
@$(JSCS_PATH) ./js/*
8+
@$(JSCS_PATH) ./test/unit/*
9+
10+
# Performs unit tests
11+
unit:
12+
@$(KARMA_PATH) start $(KARMA_CONFIG) $*
13+
14+
# Run all test targets
15+
test:
16+
@make lint
17+
@make unit
18+
19+
# Ignore directory structure
20+
.PHONY: lint unit test

Diff for: package.json

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
"name": "scratch-html5",
33
"description": "HTML 5 based Scratch project player",
44
"repository": "https://github.com/LLK/scratch-html5",
5+
"scripts": {
6+
"test": "make test"
7+
},
8+
"dependencies": {},
59
"devDependencies": {
6-
"karma" : "~0.10",
7-
"jasmine-jquery" : "1.3.3",
8-
"karma-html2js-preprocessor" : "~0.1.0",
9-
"underscore" : "~1.6.0"
10+
"jasmine-jquery": "~1.3.3",
11+
"jscs": "~1.3.0",
12+
"karma": "~0.10",
13+
"karma-html2js-preprocessor": "~0.1.0",
14+
"underscore": "~1.6.0"
1015
}
1116
}

Diff for: scripts/test.sh

-9
This file was deleted.

Diff for: config/karma.conf.js renamed to test/fixtures/karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = function(config){
22
config.set({
3-
basePath : '../',
3+
basePath : '../../',
44

55
files : [
66
'test/artifacts/**/*.js',

0 commit comments

Comments
 (0)