Make requirejs crash loudly during tests

If requirejs hit a source file it didn't like, it would crash. However, preloaded tests would continue and getting a passing grade on travis-ci (exit code 0).
This commit is contained in:
Kieran Sedgwick 2014-05-22 20:19:24 -04:00
parent 0bbaf5ff93
commit 2d5b01719a
3 changed files with 10 additions and 40 deletions

View File

@ -1,9 +1,15 @@
// If there's something broken in filer or a test,
// requirejs can blow up, and mocha sees it as tests
// not getting added (i.e., it just exists with only
// 1 test run). Display an error so it's clear what happened.
// 1 test run). Display an error and crash loudly
// so it's clear what happened.
process.on('uncaughtException', function(err) {
console.error('Error in require.js trying to build test suite, filer:\n', err.stack);
describe('requirejs errors: ', function() {
it('requirejs has crashed building the test suite...', function(done) {
console.error(err.stack);
require('assert').ok(false);
});
});
});
var requirejs = require('requirejs');

33
tests/spec/providers/providers.memory.spec.js Normal file → Executable file
View File

@ -12,39 +12,6 @@ define(["Filer"], function(Filer) {
expect(memoryProvider.getReadWriteContext).to.be.a('function');
});
describe("Memory provider DBs are sharable", function() {
it("should share a single memory db when name is the same", function(done) {
var provider1;
var provider2;
var provider3;
var name1 = 'memory-db';
var name2 = 'memory-db2';
provider1 = new Filer.FileSystem.providers.Memory(name1);
provider1.open(function(error, firstAccess) {
expect(error).not.to.exist;
expect(firstAccess).to.be.true;
provider2 = new Filer.FileSystem.providers.Memory(name1);
provider2.open(function(error, firstAccess) {
expect(error).not.to.exist;
expect(firstAccess).to.be.false;
expect(provider1.db).to.equal(provider2.db);
provider3 = new Filer.FileSystem.providers.Memory(name2);
provider3.open(function(error, firstAccess) {
expect(error).not.to.exist;
expect(firstAccess).to.be.true;
expect(provider3.db).not.to.equal(provider2.db);
done();
});
});
});
});
});
});
describe("open an Memory provider", function() {
it("should open a new Memory database", function(done) {
var provider = new Filer.FileSystem.providers.Memory();

View File

@ -42,7 +42,6 @@ define([
// Filer.FileSystem.providers.*
"spec/providers/providers.spec",
"spec/providers/providers.memory.spec",
"spec/providers/providers.indexeddb.spec",
"spec/providers/providers.websql.spec",
@ -68,11 +67,9 @@ define([
"spec/node-js/simple/test-fs-watch",
"spec/node-js/simple/test-fs-watch-recursive",
// Nodejs compatibility
"spec/node-js/simple/nodejs.spec",
// Regressions, Bugs
"bugs/issue105",
"bugs/issue106"
"bugs/issue106" ,
"spec/providers/providers.memory.spec"
]);