Skip to content

464 implement frontend javascript testing#533

Open
sbland wants to merge 10 commits intomainfrom
464-implement-frontend-javascript-testing
Open

464 implement frontend javascript testing#533
sbland wants to merge 10 commits intomainfrom
464-implement-frontend-javascript-testing

Conversation

@sbland
Copy link
Contributor

@sbland sbland commented Oct 29, 2025

Description

Some tidying up of the frontend node code related to #529

Fixes #464

Type of change

  • Documentation (non-breaking change that adds or improves the documentation)
  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Technical work (non-breaking, change which is work as part of a new feature)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass (eg. python -m pytest)
  • The documentation builds and looks OK (eg. mkdocs serve)
  • Pre-commit hooks run successfully (eg. pre-commit run --all-files)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

@sbland
Copy link
Contributor Author

sbland commented Oct 29, 2025

Fixes #464

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sbland
Copy link
Contributor Author

sbland commented Oct 29, 2025

@AdrianDAlessandro I moved the node documentation to a separate README.md inside the node directory. This seems to have broken the mkdocs build. I tried looking through the code and docs but I can't see how to add this file.

@sbland sbland self-assigned this Oct 29, 2025
@sbland sbland requested a review from davehorsfall October 29, 2025 11:39
```bash
npm run styles:expanded
```
See [node/README.md](https://github.com/direct-framework/direct-webapp/blob/main/node/README.md) for details on working with the NPM-based frontend asset pipeline.
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [linkspector] reported by reviewdog 🐶
Cannot reach https://github.com/direct-framework/direct-webapp/blob/main/node/README.md Status: 404

@sbland sbland force-pushed the 464-implement-frontend-javascript-testing branch from f62472c to 053c4be Compare November 27, 2025 19:41
@sbland
Copy link
Contributor Author

sbland commented Nov 27, 2025

@AdrianDAlessandro FYI I've rebased this onto the main branch.

Copy link
Collaborator

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

I'll be happy to review and merge this if you can rebase it onto main. Would be good to merge this before looking at moving the node configs into a sub-directory

@sbland sbland force-pushed the 464-implement-frontend-javascript-testing branch from 053c4be to f7a61a7 Compare March 2, 2026 16:39
@sbland
Copy link
Contributor Author

sbland commented Mar 2, 2026

@AdrianDAlessandro this is rebased back onto main and should be ready to merge

Copy link
Collaborator

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

Overall, this looks really good. I've run the tests and see that they pass. I haven't individually reviewed the tests because I am not likely to understand them. My only concern is that they might be too prescriptive. So if we make changes to the radial plots, it might cause many failures and make it difficult to update them all.

I've made some other comments, but they might be out of my naivety of best practice with node/npm/vitest, so please take it all with a grain of salt.

Comment on lines +56 to +59
```bash
npm run styles:expanded
```

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think these lines are not necessary

Suggested change
```bash
npm run styles:expanded
```

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was copied from master README.md so happy to remove if no longer needed.

Comment on lines +17 to +19
"test": "vitest",
"test-ui": "vitest --ui",
"test-ci": "vitest --run"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Having the default test version be the interactive one is slightly confusing. I think maybe we should have the --run option be the default one and then have something like test-interactive be the one that persists and waits for file changes.

Also, the test-ui one failed for me because '@vitest/ui' is not installed. Not sure if we want to include it by default or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think perhaps this is just a node default. I'm happy to change but I normally use the watch mode by default and have --run just for the CI.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense. Fine with me

To build all styles, scripts, and vendor files, run:

```bash
npm run build
Copy link
Collaborator

Choose a reason for hiding this comment

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

I got some linting failures and a few file changes when I ran this.

Linting error:

$ npm run build                                

> direct-webapp@0.1.0 build
> npm-run-all --silent -p styles:expanded styles:minified scripts:expanded scripts:minified vendor --silent

Vendor Info Bundling vendor scripts... 
StylesStyles  InfoInfo  Linting SCSS...Linting SCSS... 
 
Scripts Info Linting JavaScript... 
Scripts Info Linting JavaScript... 
Scripts Error! 
Scripts Error! /Users/adalessa/Projects/DIRECT/direct-webapp/node/src/js/dataviz/radial-plot-dataprocessing.js
Scripts Error!   92:11  error  Delete `··`  prettier/prettier
Scripts Error!   93:1   error  Delete `··`  prettier/prettier
Scripts Error! 
Scripts Error! ✖ 2 problems (2 errors, 0 warnings)
Scripts Error!   2 errors and 0 warnings potentially fixable with the `--fix` option.
Scripts Error! 
Scripts ScriptsError! Linting errors found
 Error! 
Scripts Error! /Users/adalessa/Projects/DIRECT/direct-webapp/node/src/js/dataviz/radial-plot-dataprocessing.js
Scripts Error!   92:11  error  Delete `··`  prettier/prettier
Scripts Error!   93:1   error  Delete `··`  prettier/prettier
Scripts Error! 
Scripts Error! ✖ 2 problems (2 errors, 0 warnings)
Scripts Error!   2 errors and 0 warnings potentially fixable with the `--fix` option.
Scripts Error! 
Scripts Error! Linting errors found
Vendor Success Bundled vendor scripts successfully 
Vendor Info Bundling vendor styles... 
Vendor Success Bundled vendor styles successfully 
Styles Success Lint SCSS 
Styles Info Building compressed CSS... 
Styles Success Lint SCSS 
Styles Info Building expanded CSS... 
Styles Success Compile SCSS to CSS (compressed):  
Styles Success Compile SCSS to CSS (expanded):  
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
Styles Success Added vendor prefixes (Autoprefixer) 
Styles Success Added vendor prefixes (Autoprefixer) 

Many of the changes were of this nature:

[data-bs-theme=dark] body.bg-secondary {
-  background-color: rgb(25.11, 28.02, 31.9) !important;
+   background-color: #191c20 !important;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there is an issue with how it was set up first so I'll compare against a fresh install and see what is going on.

@sbland
Copy link
Contributor Author

sbland commented Mar 9, 2026

Overall, this looks really good. I've run the tests and see that they pass. I haven't individually reviewed the tests because I am not likely to understand them. My only concern is that they might be too prescriptive. So if we make changes to the radial plots, it might cause many failures and make it difficult to update them all.

I've made some other comments, but they might be out of my naivety of best practice with node/npm/vitest, so please take it all with a grain of salt.

Thanks @AdrianDAlessandro I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋 Backlog

Development

Successfully merging this pull request may close these issues.

Implement Frontend javascript Testing

2 participants