-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add frontend testing, require node 12 #15315
Conversation
- Add basic frontend unit testing infrastructure using jest in ESM mode - Rename 'make test' to 'make test-backend' - Introduce 'make test-frontend' and 'make test' that runs both - Bump Node.js requirement to v12. v10 will be EOL in less than a month. - Convert all build-related JS files to ESM. I opted to run frontend tests run as part of the compliance pipeline because they complete fast and are not platform-specific like the golang tests.
Labeling as breaking because of the bump to the minimum Node.js version. |
do we actually need to up the required version of node for this change? |
bump of node version in docs is needed too |
Yes, bump is kind of required unless we want to opt to configure jest in CJS (legacy) mode as the ESM mode requires a feature only present in Node 12.16.0 or above. With node 10 going EOL in around 20 days, I think it's was okay to include the version bump here, which allows us to have the whole codebase in ESM. Starting in April, many node modules will move to ESM, so doing it now saves us from being forced to do it later.
I think I handled this with the change in |
node eof ref: https://nodejs.org/en/about/releases/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will probably need to wire this into drone
Drone is already done: https://drone.gitea.io/go-gitea/gitea/38171/1/9 It's executed as part of the compliance pipeline because it's not platform dependant like the go tests are. Maybe we should move it to the actual test pipelines later for consistency. |
So unfortunately this has broken dropzone - possibly others. See https://try.gitea.io/fnetx/everything/issues/1
Fixing the dropzone.js to read: export default async function createDropzone(el, opts) {
const [{default: Dropzone}] = await Promise.all([
import(/* webpackChunkName: "dropzone" */'dropzone'),
import(/* webpackChunkName: "dropzone" */'dropzone/dist/dropzone.css'),
]);
Dropzone.Dropzone.autoDiscover = false;
return new Dropzone.Dropzone(el, opts);
} makes this one stop - but I suspect there are other potential issues. |
go-gitea#15315 appears to have caused a change in the way Dropzone is imported - and it now produces a module rather than the constructor. This PR rather hackily just adds another Dropzone call to the result. Signed-off-by: Andrew Thornton <[email protected]>
* Fix Dropzone following #15315 #15315 appears to have caused a change in the way Dropzone is imported - and it now produces a module rather than the constructor. This PR rather hackily just adds another Dropzone call to the result. Signed-off-by: Andrew Thornton <[email protected]> * use destructured export Co-authored-by: silverwind <[email protected]> Co-authored-by: 6543 <[email protected]>
I opted to run frontend tests run as part of the compliance pipeline because they complete fast and are not platform-specific like the golang tests.
make test
seems to never be triggered in drone, so this rename only affects users.The minimum required node version for compiling the frontend has increased to v12.