mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
Merge pull request #337 from gristlabs/ingoring-expected-server-errors
Ignoring expected server failures in Localization test.
This commit is contained in:
commit
67cea66e28
@ -128,14 +128,14 @@ describe("Localization", function() {
|
|||||||
try {
|
try {
|
||||||
// Wrong path to locales.
|
// Wrong path to locales.
|
||||||
process.env.GRIST_LOCALES_DIR = __filename;
|
process.env.GRIST_LOCALES_DIR = __filename;
|
||||||
await assert.isRejected(server.restart());
|
await assert.isRejected(server.restart(false, true));
|
||||||
// Empty folder.
|
// Empty folder.
|
||||||
const tempDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'grist_test_'));
|
const tempDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'grist_test_'));
|
||||||
process.env.GRIST_LOCALES_DIR = tempDirectory;
|
process.env.GRIST_LOCALES_DIR = tempDirectory;
|
||||||
await assert.isRejected(server.restart());
|
await assert.isRejected(server.restart(false, true));
|
||||||
// Wrong file format.
|
// Wrong file format.
|
||||||
fs.writeFileSync(path.join(tempDirectory, 'dummy.json'), 'invalid json');
|
fs.writeFileSync(path.join(tempDirectory, 'dummy.json'), 'invalid json');
|
||||||
await assert.isRejected(server.restart());
|
await assert.isRejected(server.restart(false, true));
|
||||||
} finally {
|
} finally {
|
||||||
oldEnv.restore();
|
oldEnv.restore();
|
||||||
await server.restart();
|
await server.restart();
|
||||||
|
@ -55,7 +55,7 @@ export class TestServerMerged implements IMochaServer {
|
|||||||
* Restart the server. If reset is set, the database is cleared. If reset is not set,
|
* Restart the server. If reset is set, the database is cleared. If reset is not set,
|
||||||
* the database is preserved, and the temporary directory is unchanged.
|
* the database is preserved, and the temporary directory is unchanged.
|
||||||
*/
|
*/
|
||||||
public async restart(reset: boolean = false) {
|
public async restart(reset: boolean = false, quiet = false) {
|
||||||
if (this.isExternalServer()) { return; }
|
if (this.isExternalServer()) { return; }
|
||||||
if (this._starts > 0) {
|
if (this._starts > 0) {
|
||||||
this.resume();
|
this.resume();
|
||||||
@ -137,7 +137,7 @@ export class TestServerMerged implements IMochaServer {
|
|||||||
}
|
}
|
||||||
this._server = spawn('node', [cmd], {
|
this._server = spawn('node', [cmd], {
|
||||||
env,
|
env,
|
||||||
stdio: ['inherit', serverLog, serverLog],
|
stdio: quiet ? 'ignore' : ['inherit', serverLog, serverLog],
|
||||||
});
|
});
|
||||||
this._exitPromise = exitPromise(this._server);
|
this._exitPromise = exitPromise(this._server);
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ export class TestServerMerged implements IMochaServer {
|
|||||||
|
|
||||||
// Try to be more helpful when server exits by printing out the tail of its log.
|
// Try to be more helpful when server exits by printing out the tail of its log.
|
||||||
this._exitPromise.then((code) => {
|
this._exitPromise.then((code) => {
|
||||||
if (this._server.killed) { return; }
|
if (this._server.killed || quiet) { return; }
|
||||||
log.error("Server died unexpectedly, with code", code);
|
log.error("Server died unexpectedly, with code", code);
|
||||||
const output = execFileSync('tail', ['-30', nodeLogPath]);
|
const output = execFileSync('tail', ['-30', nodeLogPath]);
|
||||||
log.info(`\n===== BEGIN SERVER OUTPUT ====\n${output}\n===== END SERVER OUTPUT =====`);
|
log.info(`\n===== BEGIN SERVER OUTPUT ====\n${output}\n===== END SERVER OUTPUT =====`);
|
||||||
|
Loading…
Reference in New Issue
Block a user