mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
skip building test harness in docker image (#551)
A small test harness bundle was recently added that is breaking the docker image build. It could be added to the docker image, but that would introduce a bunch of extraneous test file dependencies. So this tweaks the build to simply skip the test bundle if its primary source file is not found. Also added some other test fixes along the way: * make a custom widget test more reliable * update a localization test now that `pt` exists * store more log info in artifact on error
This commit is contained in:
43
test/fixtures/sites/config/page.js
vendored
43
test/fixtures/sites/config/page.js
vendored
@@ -4,28 +4,30 @@
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const ready = urlParams.get('ready') ? JSON.parse(urlParams.get('ready')) : undefined;
|
||||
|
||||
if (ready && ready.onEditOptions) {
|
||||
ready.onEditOptions = () => {
|
||||
document.getElementById('configure').innerHTML = 'called';
|
||||
};
|
||||
function setup() {
|
||||
if (ready && ready.onEditOptions) {
|
||||
ready.onEditOptions = () => {
|
||||
document.getElementById('configure').innerHTML = 'called';
|
||||
};
|
||||
}
|
||||
|
||||
grist.ready(ready);
|
||||
|
||||
grist.onOptions(data => {
|
||||
document.getElementById('onOptions').innerHTML = JSON.stringify(data);
|
||||
});
|
||||
|
||||
grist.onRecord((data, mappings) => {
|
||||
document.getElementById('onRecord').innerHTML = JSON.stringify(data);
|
||||
document.getElementById('onRecordMappings').innerHTML = JSON.stringify(mappings);
|
||||
});
|
||||
|
||||
grist.onRecords((data, mappings) => {
|
||||
document.getElementById('onRecords').innerHTML = JSON.stringify(data);
|
||||
document.getElementById('onRecordsMappings').innerHTML = JSON.stringify(mappings);
|
||||
});
|
||||
}
|
||||
|
||||
grist.ready(ready);
|
||||
|
||||
grist.onOptions(data => {
|
||||
document.getElementById('onOptions').innerHTML = JSON.stringify(data);
|
||||
});
|
||||
|
||||
grist.onRecord((data, mappings) => {
|
||||
document.getElementById('onRecord').innerHTML = JSON.stringify(data);
|
||||
document.getElementById('onRecordMappings').innerHTML = JSON.stringify(mappings);
|
||||
});
|
||||
|
||||
grist.onRecords((data, mappings) => {
|
||||
document.getElementById('onRecords').innerHTML = JSON.stringify(data);
|
||||
document.getElementById('onRecordsMappings').innerHTML = JSON.stringify(mappings);
|
||||
});
|
||||
|
||||
async function run(handler) {
|
||||
try {
|
||||
document.getElementById('output').innerText = 'waiting...';
|
||||
@@ -66,6 +68,7 @@ async function configure() {
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
setup();
|
||||
document.getElementById('ready').innerText = 'ready';
|
||||
document.getElementById('access').innerHTML = urlParams.get('access');
|
||||
document.getElementById('readonly').innerHTML = urlParams.get('readonly');
|
||||
|
||||
@@ -116,8 +116,7 @@ describe("Localization", function() {
|
||||
// But only uz code is preloaded.
|
||||
notPresent(uzResponse, "uz-UZ");
|
||||
|
||||
// For Portuguese we have only en.
|
||||
notPresent(ptResponse, "pt", "pt-PR", "uz", "en-US");
|
||||
notPresent(ptResponse, "pt-PR", "uz", "en-US");
|
||||
});
|
||||
|
||||
it("loads correct languages from file system", async function() {
|
||||
|
||||
@@ -65,14 +65,14 @@ export class TestServerMerged extends EventEmitter implements IMochaServer {
|
||||
await this.stop();
|
||||
}
|
||||
this._starts++;
|
||||
const workerIdText = process.env.MOCHA_WORKER_ID || '0';
|
||||
if (reset) {
|
||||
if (process.env.TESTDIR) {
|
||||
this.testDir = process.env.TESTDIR;
|
||||
this.testDir = path.join(process.env.TESTDIR, workerIdText);
|
||||
} else {
|
||||
const workerId = process.env.MOCHA_WORKER_ID || '0';
|
||||
// Create a testDir of the form grist_test_{USER}_{SERVER_NAME}_{WORKER_ID}, removing any previous one.
|
||||
const username = process.env.USER || "nobody";
|
||||
this.testDir = path.join(tmpdir(), `grist_test_${username}_${this._name}_${workerId}`);
|
||||
this.testDir = path.join(tmpdir(), `grist_test_${username}_${this._name}_${workerIdText}`);
|
||||
await fse.remove(this.testDir);
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export class TestServerMerged extends EventEmitter implements IMochaServer {
|
||||
// logging. Server code uses a global logger, so it's hard to separate out (especially so if
|
||||
// we ever run different servers for different tests).
|
||||
const serverLog = process.env.VERBOSE ? 'inherit' : nodeLogFd;
|
||||
const workerId = parseInt(process.env.MOCHA_WORKER_ID || '0', 10);
|
||||
const workerId = parseInt(workerIdText, 10);
|
||||
const corePort = String(8295 + workerId * 2);
|
||||
const untrustedPort = String(8295 + workerId * 2 + 1);
|
||||
const env: Record<string, string> = {
|
||||
|
||||
Reference in New Issue
Block a user