fixed jasmine custom matcher for toExist
diff --git a/package.json b/package.json
index a053596..e068374 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,7 @@
"scripts": {
"test": "npm run jshint && npm run jasmine",
"jshint": "jshint index.js spec/create.spec.js",
- "jasmine": "node node_modules/jasmine-node/bin/jasmine-node --color spec"
+ "jasmine": "jasmine spec/create.spec.js"
},
"contributors": [
{
diff --git a/spec/create.spec.js b/spec/create.spec.js
index d6e719c..e75a380 100644
--- a/spec/create.spec.js
+++ b/spec/create.spec.js
@@ -71,7 +71,7 @@
}
};
-describe('cordova create checks for valid-identifier', function(done) {
+describe('cordova create checks for valid-identifier', function() {
it('should reject reserved words from start of id', function(done) {
create('projectPath', 'int.bob', 'appName')
.fail(function(err) {
diff --git a/spec/helpers.js b/spec/helpers.js
index 4cc1e2c..a5f5d54 100644
--- a/spec/helpers.js
+++ b/spec/helpers.js
@@ -148,16 +148,24 @@
// Add the toExist matcher.
beforeEach(function () {
- this.addMatchers({
+ jasmine.addMatchers({
'toExist': function () {
- var notText = this.isNot ? ' not' : '';
- var self = this;
+ return {
+ compare: function (testPath) {
- this.message = function () {
- return 'Expected file ' + self.actual + notText + ' to exist.';
- };
+ var result = {};
+ result.pass = fs.existsSync(testPath);
- return fs.existsSync(this.actual);
+ if(result.pass) {
+ result.message = 'Expected file ' + testPath + ' to exist.';
+ } else {
+ result.message = 'Expected file ' + testPath + ' to not exist.';
+ }
+
+ return result
+
+ }
+ }
}
});
});
diff --git a/spec/support/jasmine.json b/spec/support/jasmine.json
new file mode 100644
index 0000000..3ea3166
--- /dev/null
+++ b/spec/support/jasmine.json
@@ -0,0 +1,11 @@
+{
+ "spec_dir": "spec",
+ "spec_files": [
+ "**/*[sS]pec.js"
+ ],
+ "helpers": [
+ "helpers/**/*.js"
+ ],
+ "stopSpecOnExpectationFailure": false,
+ "random": false
+}