Suppress Test Logs (#6256)
* Suppress Test Logs This will reduce some of the noise in the tests logs. * replace deprecated buffer * remove deprecation warnings * fix geopoint * Fix GraphQL * postgres warnings
This commit is contained in:
@@ -18,6 +18,7 @@ branches:
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.npm"
|
||||
- ".eslintcache"
|
||||
stage: test
|
||||
env:
|
||||
global:
|
||||
|
||||
@@ -145,6 +145,7 @@ describe('AdapterLoader', () => {
|
||||
});
|
||||
|
||||
it('should load S3Adapter from direct passing', done => {
|
||||
spyOn(console, 'warn').and.callFake(() => {});
|
||||
const s3Adapter = new S3Adapter('key', 'secret', 'bucket');
|
||||
expect(() => {
|
||||
const adapter = loadAdapter(s3Adapter, FilesAdapter);
|
||||
|
||||
@@ -106,6 +106,7 @@ describe('commander additions', () => {
|
||||
});
|
||||
|
||||
it('should not override config.json', done => {
|
||||
spyOn(console, 'log').and.callFake(() => {});
|
||||
commander.loadDefinitions(testDefinitions);
|
||||
commander.parse(
|
||||
[
|
||||
@@ -160,6 +161,7 @@ describe('commander additions', () => {
|
||||
});
|
||||
|
||||
it('should load config from apps', done => {
|
||||
spyOn(console, 'log').and.callFake(() => {});
|
||||
commander.loadDefinitions(testDefinitions);
|
||||
commander.parse([
|
||||
'node',
|
||||
|
||||
@@ -31,7 +31,6 @@ describe('Email Verification Token Expiration: ', () => {
|
||||
// wait for 1 second - simulate user behavior to some extent
|
||||
setTimeout(() => {
|
||||
expect(sendEmailOptions).not.toBeUndefined();
|
||||
console.log(sendEmailOptions.link);
|
||||
|
||||
request({
|
||||
url: sendEmailOptions.link,
|
||||
|
||||
@@ -13,7 +13,7 @@ function newServer(port, dn, provokeSearchError = false) {
|
||||
server.search('o=example', function(req, res, next) {
|
||||
if (provokeSearchError) {
|
||||
res.end(ldapjs.LDAP_SIZE_LIMIT_EXCEEDED);
|
||||
return next(new ldapjs.NoSuchObjectError('fake error'));
|
||||
return next();
|
||||
}
|
||||
const obj = {
|
||||
dn: req.dn.toString(),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2073,7 +2073,6 @@ describe('Parse.Object testing', () => {
|
||||
|
||||
// Fetch object from server
|
||||
object = await object.fetch();
|
||||
console.log(object.id, object.get('jsonData'));
|
||||
equal(object.get('jsonData'), { c: 'd' });
|
||||
|
||||
done();
|
||||
|
||||
@@ -36,6 +36,7 @@ describe('Server Url Checks', () => {
|
||||
});
|
||||
|
||||
it('mark bad server url', done => {
|
||||
spyOn(console, 'warn').and.callFake(() => {});
|
||||
Parse.serverURL = 'notavalidurl';
|
||||
ParseServer.verifyServerUrl(function(result) {
|
||||
if (result) {
|
||||
|
||||
@@ -2,6 +2,7 @@ const PostgresStorageAdapter = require('../lib/Adapters/Storage/Postgres/Postgre
|
||||
.default;
|
||||
const databaseURI =
|
||||
'postgres://localhost:5432/parse_server_postgres_adapter_test_database';
|
||||
const Config = require('../lib/Config');
|
||||
|
||||
const getColumns = (client, className) => {
|
||||
return client.map(
|
||||
@@ -16,8 +17,10 @@ const dropTable = (client, className) => {
|
||||
};
|
||||
|
||||
describe_only_db('postgres')('PostgresStorageAdapter', () => {
|
||||
const adapter = new PostgresStorageAdapter({ uri: databaseURI });
|
||||
let adapter;
|
||||
beforeEach(() => {
|
||||
const config = Config.get('test');
|
||||
adapter = config.database.adapter;
|
||||
return adapter.deleteAllClasses();
|
||||
});
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ describe('test validate_receipt endpoint', () => {
|
||||
if (typeof body != 'object') {
|
||||
fail('Body is not an object');
|
||||
} else {
|
||||
console.log(body);
|
||||
expect(body.__type).toEqual('File');
|
||||
const url = body.url;
|
||||
const otherResponse = await request({
|
||||
|
||||
@@ -18,6 +18,7 @@ if (global._babelPolyfill) {
|
||||
console.error('We should not use polyfilled tests');
|
||||
process.exit(1);
|
||||
}
|
||||
process.noDeprecation = true;
|
||||
|
||||
const cache = require('../lib/cache').default;
|
||||
const ParseServer = require('../lib/index').ParseServer;
|
||||
@@ -243,7 +244,10 @@ afterEach(function(done) {
|
||||
});
|
||||
})
|
||||
.then(() => Parse.User.logOut())
|
||||
.then(() => {}, () => {}) // swallow errors
|
||||
.then(
|
||||
() => {},
|
||||
() => {}
|
||||
) // swallow errors
|
||||
.then(() => {
|
||||
// Connection close events are not immediate on node 10+... wait a bit
|
||||
return new Promise(resolve => {
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('server', () => {
|
||||
});
|
||||
|
||||
it('show warning if any reserved characters in appId', done => {
|
||||
spyOn(console, 'warn').and.callThrough();
|
||||
spyOn(console, 'warn').and.callFake(() => {});
|
||||
reconfigureServer({ appId: 'test!-^' }).then(() => {
|
||||
expect(console.warn).toHaveBeenCalled();
|
||||
return done();
|
||||
@@ -40,7 +40,7 @@ describe('server', () => {
|
||||
url: 'http://localhost:8378/1/classes/TestObject',
|
||||
headers: {
|
||||
Authorization:
|
||||
'Basic ' + new Buffer('test:' + 'test').toString('base64'),
|
||||
'Basic ' + Buffer.from('test:' + 'test').toString('base64'),
|
||||
},
|
||||
}).then(response => {
|
||||
expect(response.status).toEqual(200);
|
||||
@@ -56,7 +56,7 @@ describe('server', () => {
|
||||
headers: {
|
||||
Authorization:
|
||||
'Basic ' +
|
||||
new Buffer('test:javascript-key=' + 'test').toString('base64'),
|
||||
Buffer.from('test:javascript-key=' + 'test').toString('base64'),
|
||||
},
|
||||
}).then(response => {
|
||||
expect(response.status).toEqual(200);
|
||||
|
||||
@@ -77,8 +77,7 @@ function getAppleCertificate(publicKeyUrl) {
|
||||
}
|
||||
|
||||
function convertTimestampToBigEndian(timestamp) {
|
||||
const buffer = new Buffer(8);
|
||||
buffer.fill(0);
|
||||
const buffer = Buffer.alloc(8);
|
||||
|
||||
const high = ~~(timestamp / 0xffffffff);
|
||||
const low = timestamp % (0xffffffff + 0x1);
|
||||
|
||||
@@ -13,6 +13,8 @@ export function createClient(uri, databaseOptions) {
|
||||
}
|
||||
|
||||
const initOptions = dbOptions.initOptions || {};
|
||||
initOptions.noWarnings = process && process.env.TESTING;
|
||||
|
||||
const pgp = require('pg-promise')(initOptions);
|
||||
const client = pgp(dbOptions);
|
||||
|
||||
|
||||
@@ -343,7 +343,9 @@ export function handleParseErrors(err, req, res, next) {
|
||||
} else if (err.status && err.message) {
|
||||
res.status(err.status);
|
||||
res.json({ error: err.message });
|
||||
next(err);
|
||||
if (!(process && process.env.TESTING)) {
|
||||
next(err);
|
||||
}
|
||||
} else {
|
||||
log.error('Uncaught internal server error.', err, err.stack);
|
||||
res.status(500);
|
||||
@@ -351,7 +353,9 @@ export function handleParseErrors(err, req, res, next) {
|
||||
code: Parse.Error.INTERNAL_SERVER_ERROR,
|
||||
message: 'Internal server error.',
|
||||
});
|
||||
next(err);
|
||||
if (!(process && process.env.TESTING)) {
|
||||
next(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user