Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
m5r committed Jul 9, 2024
1 parent 626bcc5 commit c065b78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions test/e2e/cht-conf-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { exec } = require('child_process');
const fs = require('fs');
const fse = require('fs-extra');

const log = require('../../src/lib/log');
const { getProjectUrl } = require('./cht-docker-utils');

const getProjectDirectory = (projectName) => path.resolve(__dirname, `../../build/${projectName}`);
Expand All @@ -16,11 +17,8 @@ const runChtConf = (projectName, command) => new Promise((resolve, reject) => {
return resolve(stdout);
}

// TODO: these should use the logger, should be trace/error logs
console.error('error', error);
console.error('stdout', stdout);
console.error('stderr', stderr);
reject(new Error(stdout.toString()));
log.error(stderr);
reject(new Error(stdout.toString('utf8')));
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cht-docker-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));

const getProjectConfig = async (projectName) => {
try {
const configFile = await fs.promises.readFile(path.resolve(dockerHelperDirectory, `${projectName}.env`));
const configFile = await fs.promises.readFile(path.resolve(dockerHelperDirectory, `${projectName}.env`), 'utf8');
return Object.fromEntries(
configFile.toString()
.split('\n')
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/edit-app-settings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ describe('edit-app-settings', () => {
const url = await getProjectUrl();
const initialSettings = await request.get({ url: `${url}/api/v1/settings`, json: true });

// TODO: remove next line when we upgrade eslint and its `parserOptions.ecmaVersion` setting to parse syntax supported by node 18+
// eslint-disable-next-line no-undef
const baseSettings = structuredClone(initialSettings); // TODO: upgrade eslint to accept syntax supported by node 18+
const baseSettings = structuredClone(initialSettings);
baseSettings.languages = baseSettings.languages.map(language => {
if (language.locale === 'en') {
language.enabled = false;
Expand All @@ -40,7 +41,7 @@ describe('edit-app-settings', () => {

await runChtConf(projectName, 'compile-app-settings');
const compiledSettings = JSON.parse(
await fs.promises.readFile(path.join(projectDirectory, 'app_settings.json'))
await fs.promises.readFile(path.join(projectDirectory, 'app_settings.json'), 'utf8')
);
expect(compiledSettings.languages.find(language => language.locale === 'en')).to.deep.equal({
locale: 'en',
Expand Down

0 comments on commit c065b78

Please sign in to comment.