Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a739682
feat: [UEPR-57] migrate to react v18
MiroslavDionisiev Mar 13, 2025
dce8c99
feat: [UEPR-57] update tests to use react testing library and remove …
MiroslavDionisiev Apr 22, 2025
d0d00ed
Merge remote-tracking branch 'origin/develop' into react-18-update
MiroslavDionisiev Apr 23, 2025
45de5f5
fix: [UEPR-57] fix failing spec after change of banner text
MiroslavDionisiev Apr 23, 2025
5ca5c20
fix: [UEPR-57] add generate locals to ci-cd workflow
MiroslavDionisiev Apr 23, 2025
a383ed8
fix: [UEPR-57] change import of act
MiroslavDionisiev Apr 23, 2025
01dd173
fix: [UEPR-57] change import of act and change the node env we run te…
MiroslavDionisiev Apr 23, 2025
6dc8bcc
chore: [UEPR-57] run tests in development mode
MiroslavDionisiev Apr 23, 2025
8ce58e4
Merge remote-tracking branch 'upstream/develop' into react-18-update
KManolov3 Aug 25, 2025
c65391b
Merge remote-tracking branch 'upstream/develop' into react-18-update
KManolov3 Aug 25, 2025
1112aa4
feat: extract NODE_ENV=development to package.json
KManolov3 Aug 25, 2025
575c827
fix: update tests according to PR comments
KManolov3 Aug 25, 2025
8413829
fix: address comments
KManolov3 Aug 26, 2025
dc9d677
fix: pass ref to containers where useOnClickOutside is used
KManolov3 Aug 26, 2025
9c86bac
chore: upgrade to newest gui prerelease version
KManolov3 Aug 26, 2025
26d646e
Merge remote-tracking branch 'upstream/develop' into react-18-update
KManolov3 Aug 26, 2025
e0d67eb
fix: add cross-env library
KManolov3 Aug 27, 2025
59c64bd
fix: set NODE_ENV on jest commands themselves
KManolov3 Aug 27, 2025
6625f1e
Merge remote-tracking branch 'upstream/develop' into HEAD
KManolov3 Sep 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ jobs:
GTM_ENV_AUTH: ${{ secrets.GTM_ENV_AUTH }}
- name: unit tests
run: |
JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run test:unit:jest:unit -- --reporters=jest-junit
npm run test:generate-translations
# run unit tests in development mode to address error "act(...) is not supported in production builds of React"
NODE_ENV=development JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run test:unit:jest:unit -- --reporters=jest-junit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If test:unit:jest:unit doesn't work outside of dev mode, would it make sense to move the NODE_ENV=development part into package.json? Something like:

    "test:unit:jest:unit": "cross-env NODE_ENV=development jest ..."

JEST_JUNIT_OUTPUT_NAME=localization-jest-results.xml npm run test:unit:jest:localization -- --reporters=jest-junit
npm run test:unit:tap -- --output-file ./test/results/unit-raw.tap
npm run test:unit:convertReportToXunit
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ENV

# Test
/test/results/*
/test/generated/generated-locales.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Props for remembering to add this line!

/.nyc_output
/coverage
/bin/lib/localized-urls.json
Expand Down
48 changes: 48 additions & 0 deletions bin/generate-translations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const routes = require('../src/routes.json');
const path = require('path');
const fs = require('fs');
const merge = require('lodash.merge');

const globalTemplateFile = path.resolve(__dirname, '../src/l10n.json');
const generatedLocales = {
en: JSON.parse(fs.readFileSync(globalTemplateFile, 'utf8'))
};
const defaultLocales = {};
const views = [];

for (const route in routes) {
if (typeof routes[route].redirect !== 'undefined') {
continue;
}

views.push(routes[route].name);
try {
const subdir = routes[route].view.split('/');
subdir.pop();
const l10n = path.resolve(
__dirname,
`../src/views/${subdir.join('/')}/l10n.json`
);
const viewIds = JSON.parse(fs.readFileSync(l10n, 'utf8'));
defaultLocales[routes[route].name] = viewIds;
} catch (err) {
if (err.code !== 'ENOENT') {
throw err;
}
}
}

views
.map(view => defaultLocales[view])
.reduce((acc, curr) => merge(acc, curr), generatedLocales.en);

const dirPath = './test/generated';
const filePath = './test/generated/generated-locales.js';
const variableName = 'generatedLocales';
const variableValue = JSON.stringify(generatedLocales, null, 2);
const content = `const ${variableName} = ${variableValue};
export {${variableName}};
`;

fs.mkdirSync(dirPath, {recursive: true});
fs.writeFileSync(filePath, content, 'utf8');
Loading
Loading