Comparing version 1.0.3 to 1.1.0
48
index.js
@@ -22,6 +22,4 @@ "use strict"; | ||
* @param {String[]} [options.localDependencies] - Local dependencies to be bundled alongisde your | ||
* remote dependencies. Glob strings. Useful for including your bower-installed packages, for | ||
* example. | ||
* remote dependencies. Glob strings. | ||
* @param {String[]} [options.remoteDependencies] - URLs corresponding to remote dependencies. | ||
* @param {String} options.bundledSpecPath - Path to your bundled and processed test suite. | ||
* @param {Object} [options.karmaConfig] | ||
@@ -38,8 +36,22 @@ * @param {Number} [options.karmaConfig.port=9876] - Port on which to run the Karma server. | ||
this._remoteDependencies = options.remoteDependencies || []; | ||
this._bundledSpecPath = options.bundledSpecPath; | ||
this._port = (options.karmaConfig && options.karmaConfig.port) || 9876; | ||
this._bundlePath = options.bundlePath || ''; | ||
this._assertValidOptions(options); | ||
this._assertValidOptions(); | ||
// Check for deprecated `bundledSpecPath` option. | ||
if (options.bundledSpecPath) { | ||
process.emitWarning('`options.bundledSpechPath is deprecated. Please include your bundled ' + | ||
'spec path as part of `options.localDependencies`.', | ||
'DeprecationWarning' | ||
); | ||
if (typeof options.bundledSpecPath === 'string') { | ||
this._localDependencies.push(options.bundledSpecPath); | ||
} else { | ||
throw new Error('Attempted to use deprecated `options.bundledSpecPath` option but it was ' + | ||
'not a string'); | ||
} | ||
} | ||
this._erikPath = path.join(options.bundlePath, '.erik'); | ||
@@ -70,6 +82,2 @@ | ||
} | ||
if (typeof this._bundledSpecPath !== 'string') { | ||
throw new Error('`options.bundledSpecPath` is of an invalid type.'); | ||
} | ||
@@ -87,3 +95,2 @@ if (typeof this._port !== 'number') { | ||
this._registerFetchRemoteDeps(); | ||
this._registerBundleDeps(); | ||
this._registerRunSpec(); | ||
@@ -117,13 +124,2 @@ this._registerErik(); | ||
_registerBundleDeps() { | ||
this._gulp.task('erik-bundle-deps', () => { | ||
return this._gulp.src([ | ||
`${this._erikPath}/remote-deps.js`, | ||
...this._localDependencies | ||
]) | ||
.pipe(concat('bundled-deps.js')) | ||
.pipe(this._gulp.dest(this._erikPath)); | ||
}); | ||
} | ||
_registerRunSpec() { | ||
@@ -144,4 +140,4 @@ this._gulp.task('erik-run-spec', (done) => { | ||
files: [ | ||
`${this._erikPath}/bundled-deps.js`, | ||
this._bundledSpecPath, | ||
`${this._erikPath}/remote-deps.js`, | ||
...this._localDependencies | ||
], | ||
@@ -172,8 +168,8 @@ | ||
const tasks = this._taskDependencies.concat([ | ||
const tasks = [ | ||
...this._taskDependencies, | ||
'erik-fetch-remote-deps', | ||
'erik-bundle-deps', | ||
'erik-run-spec', | ||
done | ||
]); | ||
]; | ||
@@ -180,0 +176,0 @@ // Run everything serially. |
{ | ||
"name": "erik", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Start running your client `Jasmine` tests headlessly with `PhantomJS` and `gulp` today.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -71,8 +71,10 @@ # Erik | ||
/** | ||
* Local dependencies to be bundled alongside your remote dependencies. Glob strings. Useful for | ||
* including your bower-installed packages, for example. | ||
* Local dependencies to be bundled alongside your remote dependencies. Glob strings. | ||
*/ | ||
localDependencies: [ | ||
'public/build-lib.js', | ||
'public/lib/ext/**/*' | ||
'public/lib/ext/**/*', | ||
// Include your specs here. Make sure that they are bundled as an IIFE. | ||
'spec/client/tests.js', | ||
], | ||
@@ -90,7 +92,2 @@ | ||
/** | ||
* Path to your bundled test suite. This should be an IIFE. | ||
*/ | ||
bundledSpecPath: 'spec/client/tests.js', | ||
/** | ||
* This configuration is not passed directly into Karma but rather is processed by Erik. Only | ||
@@ -131,2 +128,3 @@ * `port` is supported at this time. | ||
* 1.1.0 Re-run specs on any local dependency changes. Wrap `options.bundledSpecPath` into `options.localDependencies`, deprecating `options.bundledSpecPath`. | ||
* 1.0.3 Don't specify exact dependency versions. | ||
@@ -133,0 +131,0 @@ * 1.0.2 Add event-based watch example. |
12523
147
135