Testing improvements (#4863)

* Adds supports-color so spec reporter dont output colors when not supported

* Adds babelrc so breakpoints dont jump around in specs

* Rename test to avoid duplicated name

* Removes unused methods

* Better naming for it_exclude
This commit is contained in:
Florent Vilmart
2018-07-01 00:00:37 -04:00
parent 7319aabf7a
commit 96bc74433b
7 changed files with 2285 additions and 2275 deletions

14
spec/.babelrc Normal file
View File

@@ -0,0 +1,14 @@
{
"plugins": [
"transform-object-rest-spread"
],
"presets": [
["env", {
"targets": {
"node": "8"
}
}]
],
"sourceMaps": "inline",
"retainLines": true
}

View File

@@ -70,7 +70,7 @@ describe("AdaptableController", ()=>{
done();
});
it("should accept an object adapter", (done) => {
it("should accept an prototype based object adapter", (done) => {
function AGoodAdapter() {}
AGoodAdapter.prototype.createFile = function() { };
AGoodAdapter.prototype.deleteFile = function() { };

View File

@@ -1,11 +1,11 @@
"use strict"
// Sets up a Parse API server for testing.
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
const supportsColor = require('supports-color');
jasmine.DEFAULT_TIMEOUT_INTERVAL = process.env.PARSE_SERVER_TEST_TIMEOUT || 5000;
jasmine.getEnv().clearReporters();
jasmine.getEnv().addReporter(new SpecReporter());
jasmine.getEnv().addReporter(new SpecReporter({ colors: { enabled: supportsColor.stdout }}));
global.on_db = (db, callback, elseCallback) => {
if (process.env.PARSE_SERVER_TEST_DB == db) {
@@ -412,11 +412,11 @@ global.jfail = function(err) {
global.it_exclude_dbs = excluded => {
if (excluded.indexOf(process.env.PARSE_SERVER_TEST_DB) >= 0) {
return (name, suite) => {
return xit(`[${excluded}] ${name}`, suite);
return xit(`[not on ${excluded.join(',')}] ${name}`, suite);
};
} else {
return (name, suite) => {
return it(`[${excluded}] ${name}`, suite);
return it(`[not on ${excluded.join(',')}] ${name}`, suite);
};
}
}