(v0.5.3) Bumped gulp-shenanigans to 0.5.20

This commit is contained in:
Josh Goldberg
2016-11-30 00:05:09 -05:00
parent e673829099
commit bedecfc166
16 changed files with 248 additions and 847 deletions
+5 -3
View File
@@ -1,8 +1,10 @@
docs/**
lib/**
src/**/*.css
src/**/*.d.ts
src/**/*.js*
~src/main.js
test/**/*.js
test/index.html
test/utils/**
!test/utils/mocks.ts
test/**/*.d.ts
node_modules/
npm-debug.log
+1
View File
@@ -5,6 +5,7 @@
Hookups for extensible triggered mod events.
## Build Process
ModAttachr uses [Gulp](http://gulpjs.com/) to automate building, which requires [Node.js](http://node.js.org).
+2 -2
View File
@@ -15,9 +15,9 @@
},
"license": "MIT",
"dependencies": {
"itemsholdr": "^0.5.2"
"itemsholdr": "^0.5.3"
},
"devDependencies": {
"gulp-shenanigans": "^0.5.15"
"gulp-shenanigans": "^0.5.20"
}
}
+2 -2
View File
@@ -1,10 +1,10 @@
{
"dependencies": {
"ItemsHoldr": "^0.5.2"
"ItemsHoldr": "^0.5.3"
},
"package": {
"description": "Hookups for extensible triggered mod events.",
"name": "ModAttachr",
"version": "0.5.1"
"version": "0.5.2"
}
}
+3 -3
View File
@@ -1,4 +1,4 @@
/// <reference path="../typings/ItemsHoldr.d.ts" />
import { IItemsHoldr } from "itemsholdr/lib/IItemsHoldr";
/**
* General schema for a mod, including its name, events with callbacks,
@@ -69,7 +69,7 @@ export interface IModAttachrSettings {
/**
* A ItemsHoldr to store mod status locally.
*/
ItemsHoldr?: ItemsHoldr.IItemsHoldr;
ItemsHoldr?: IItemsHoldr;
/**
* Whether there should be a ItemsHoldr created if one isn't given.
@@ -110,7 +110,7 @@ export interface IModAttachr {
/**
* @returns The ItemsHoldr if storeLocally is true (by default, undefined).
*/
getItemsHolder(): ItemsHoldr.IItemsHoldr;
getItemsHolder(): IItemsHoldr | undefined;
/**
* @returns The default scope used to apply mods from, if not this ModAttachr.
+5 -4
View File
@@ -1,4 +1,5 @@
/// <reference path="../typings/ItemsHoldr.d.ts" />
import { IItemsHoldr } from "itemsholdr/lib/IItemsHoldr";
import { ItemsHoldr } from "itemsholdr/lib/ItemsHoldr";
import {
ICallbackRegister, IEventCallback, IEventsRegister, IMod, IModAttachr, IModAttachrSettings, IMods
@@ -21,7 +22,7 @@ export class ModAttachr implements IModAttachr {
/**
* A ItemsHoldr object that may be used to store mod status.
*/
private ItemsHolder: ItemsHoldr.IItemsHoldr;
private ItemsHolder?: IItemsHoldr;
/**
* A default scope to apply mod events from, if not this ModAttachr.
@@ -48,7 +49,7 @@ export class ModAttachr implements IModAttachr {
this.ItemsHolder = settings.ItemsHoldr;
} else if (settings.storeLocally) {
// If one isn't provided by storeLocally is still true, make one
this.ItemsHolder = new ItemsHoldr.ItemsHoldr();
this.ItemsHolder = new ItemsHoldr();
}
if (settings.mods) {
@@ -88,7 +89,7 @@ export class ModAttachr implements IModAttachr {
/**
* @returns The ItemsHoldr if storeLocally is true (by default, undefined).
*/
public getItemsHolder(): ItemsHoldr.IItemsHoldr {
public getItemsHolder(): IItemsHoldr | undefined {
return this.ItemsHolder;
}
+1 -8
View File
@@ -1,10 +1,3 @@
/// <reference path="../../node_modules/@types/chai/index.d.ts" />
/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
/// <reference path="../utils/MochaLoader.ts" />
import { mochaLoader } from "../main";
import { mocks } from "../utils/mocks";
mochaLoader.it("_", (): void => {
chai.expect(() => mocks.mockModAttachr()).to.not.throw();
});
mochaLoader.it("_", (): void => { });
+40
View File
@@ -0,0 +1,40 @@
<!-- This file was auto-generated by gulp-shenanigans -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>ModAttachr Tests</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<!-- Dependencies: Begin -->
<script type="text/javascript">
window.testDependencies = [
"ItemsHoldr"
];
</Script>
<!-- Dependencies: End -->
<!-- Externals: Begin -->
<!-- Externals: End -->
<!-- Tests: Begin -->
<script type="text/javascript">
window.testPaths = [
"main",
"ModAttachr/_",
"utils/fakes",
"utils/MochaLoader"
];
</script>
<!-- Tests: End -->
<script src="../node_modules/chai/chai.js" type="text/javascript"></script>
<script src="../node_modules/mocha/mocha.js" type="text/javascript"></script>
<script data-main="main.js" src="../node_modules/requirejs/require.js" type="text/javascript"></script>
</body>
</html>
+30 -10
View File
@@ -2,11 +2,27 @@
import { MochaLoader } from "./utils/MochaLoader";
declare var require: any;
declare var testPaths: any;
declare var requirejs: any;
declare var testDependencies: string[];
declare var testPaths: string[];
export const mochaLoader: MochaLoader = new MochaLoader(mocha);
/**
* Informs RequireJS of the file location for a test dependency.
*
* @param testDependencies Modules depended upon for tests.
*/
function redirectTestDependencies(dependencies: string[]): void {
for (const dependency of dependencies) {
requirejs.config({
paths: {
[dependency.toLowerCase() + "/lib"]: `../node_modules/${dependency.toLowerCase()}/src`
}
});
}
}
/**
* Recursively loads test paths under mocha loader.
*
@@ -23,17 +39,21 @@ function loadTestPaths(loadingPaths: string[], i: number, onComplete: () => void
}
mochaLoader.setTestPath(loadingPaths[i]);
require(
requirejs(
[loadingPaths[i]],
(): void => {
loadTestPaths(loadingPaths, i + 1, onComplete);
});
}
loadTestPaths(
testPaths,
0,
(): void => {
mochaLoader.describeTests();
mochaLoader.run();
});
((): void => {
redirectTestDependencies(testDependencies);
loadTestPaths(
testPaths,
0,
(): void => {
mochaLoader.describeTests();
mochaLoader.run();
});
})();
+13 -7
View File
@@ -1,13 +1,19 @@
{
"compilerOptions": {
"declaration": false,
"declaration": true,
"module": "amd",
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "..",
"rootDir": "..",
"strictNullChecks": true,
"target": "es3"
},
"files": [
"main.ts",
"utils/mocks.ts",
"utils/MochaLoader.ts",
"ModAttachr/_.ts"
"include": [
"./**/*.ts"
]
}
}
+124
View File
@@ -0,0 +1,124 @@
/* This file was auto-generated by gulp-shenanigans */
/// <reference path="../../node_modules/@types/chai/index.d.ts" />
/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
/**
* Grouping of mocha describe() tests.
*/
interface ITestHierarchy {
/**
* Hierarchical children within this describe() group.
*/
children: {
[i: string]: ITestHierarchy;
};
/**
* Tests run in this describe().
*/
tests: {
[i: string]: (done: Function) => void;
};
}
/**
* Combines mocha tests into their describe() groups.
*/
export class MochaLoader {
/**
* The underlying mocha instance.
*/
private mocha: Mocha;
/**
* Root grouping of test hierarchies.
*/
private testHierarchy: ITestHierarchy = {
children: {},
tests: {}
};
/**
* Mocha describe() path for the next test to be added.
*/
private currentTestPath: string[];
/**
* Initializes a new instance of the MochaLoader class.
*
* @param mocha The underlying mocha instance.
*/
public constructor(mocha: Mocha) {
this.mocha = mocha;
this.mocha.setup("bdd");
}
/**
* Sets the current test path.
*
* @param rawPath A new current test path.
*/
public setTestPath(rawPath: string): void {
this.currentTestPath = rawPath.split("/");
}
/**
* Adds a new test under the current test path.
*
* @param testName The name of the test.
* @param test A new test.
*/
public it(testName: string, test: (done: Function) => void): void {
if (!this.currentTestPath) {
throw new Error(`No test path defined before adding test '${testName}'.`);
}
let testHierarchy: ITestHierarchy = this.testHierarchy;
for (const part of this.currentTestPath) {
if (!testHierarchy.children[part]) {
testHierarchy = testHierarchy.children[part] = {
children: {},
tests: {}
};
} else {
testHierarchy = testHierarchy.children[part];
}
}
testHierarchy.tests[testName] = test;
}
/**
* Finalizes the tests' describe() hierarchy.
*/
public describeTests(): void {
this.describeTestHierarchy(this.testHierarchy);
}
/**
* Runs tests using mocha.
*/
public run(): void {
this.mocha.run();
}
/**
* Recursively describes a test hierarchy and its children hierarchies.
*
* @param testHierarchy A test hierarchy to describe.
*/
private describeTestHierarchy(testHierarchy: ITestHierarchy): void {
for (const testName in testHierarchy.tests) {
if (testName in testHierarchy.tests) {
it(testName, testHierarchy.tests[testName]);
}
}
for (const childName in testHierarchy.children) {
if (childName in testHierarchy.children) {
describe(childName, (): void => this.describeTestHierarchy(testHierarchy.children[childName]));
}
}
}
}
+10
View File
@@ -0,0 +1,10 @@
import { IModAttachr, IModAttachrSettings } from "../../src/IModAttachr";
import { ModAttachr } from "../../src/ModAttachr";
/**
* @param settings Settings for the ModAttachr.
* @returns An ModAttachr instance.
*/
export function mockModAttachr(settings?: IModAttachrSettings): IModAttachr {
return new ModAttachr(settings);
}
-12
View File
@@ -1,12 +0,0 @@
import { IModAttachr, IModAttachrSettings } from "../../src/IModAttachr";
import { ModAttachr } from "../../src/ModAttachr";
export const mocks = {
/**
* @param settings Settings for the ModAttachr.
* @returns An ModAttachr instance.
*/
mockModAttachr: (settings?: IModAttachrSettings): IModAttachr => {
return new ModAttachr(settings);
}
};
+12 -8
View File
@@ -1,13 +1,17 @@
{
"compilerOptions": {
"module": "amd",
"target": "es3",
"noImplicitAny": true,
"declaration": true,
"outDir": "dist"
"module": "amd",
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"target": "es3"
},
"files": [
"src/IModAttachr.ts",
"src/ModAttachr.ts"
"include": [
"./src/**/*.ts"
]
}
}
-11
View File
@@ -15,7 +15,6 @@
"interface-name": [true, "always-prefix"],
"jsdoc-format": true,
"label-position": true,
"label-undefined": true,
"max-line-length": [true, 140],
"member-access": true,
"member-ordering": [
@@ -38,9 +37,7 @@
"trace"
],
"no-construct": true,
"no-constructor-vars": true,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
@@ -50,14 +47,11 @@
"no-string-literal": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unreachable": true,
"no-unsafe-finally": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-unused-new": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"no-var-requires": true,
"one-line": [
true,
"check-catch",
@@ -92,11 +86,6 @@
}
],
"use-isnan": true,
"use-strict": [
true,
"check-module",
"check-function"
],
"whitespace": [
true,
"check-branch",
-777
View File
File diff suppressed because it is too large Load Diff