Skip to content
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

Fix warnings in frontend tests #3625

Closed
wants to merge 3 commits into from

Conversation

BacLuc
Copy link
Contributor

@BacLuc BacLuc commented Jul 15, 2023

Invitation.vue: do not use optional chaining in template

The transformation jest uses cannot collect coverage for optional chaining (?.).
Failed to collect coverage from /home/runner/work/ecamp3/ecamp3/frontend/src/views/camp/Invitation.vue
ERROR: Unexpected token (1:1001)
STACK: SyntaxError: Unexpected token (1:1001)
    at Parser.pp$4.raise (/home/runner/work/ecamp3/ecamp3/frontend/node_modules/vue-template-es2015-compiler/buble.js:2757:13)
    at Parser.pp.unexpected (/home/runner/work/ecamp3/ecamp3/frontend/node_modules/vue-template-es2015-compiler/buble.js:647:8)
    at Parser.pp$3.parseExprAtom (/home/runner/work/ecamp3/ecamp3/frontend/node_modules/vue-template-es2015-compiler/buble.js:2196:10)

frontend: transform package url-template in jest tests

Else jest complains:
Jest encountered an unexpected token
...
/home/runner/work/ecamp3/ecamp3/frontend/node_modules/url-template/lib/url-template.js:97
      export function parseTemplate(template) {
      ^^^^^^

Admin.vue: register CampConditionalFields component

Else jest complains that the component is not registered.
Also fix Admin.spec.js, was broken in 020ffab.

The transformation jest uses cannot collect coverage for optional chaining (?.).
Failed to collect coverage from /home/runner/work/ecamp3/ecamp3/frontend/src/views/camp/Invitation.vue
ERROR: Unexpected token (1:1001)
STACK: SyntaxError: Unexpected token (1:1001)
    at Parser.pp$4.raise (/home/runner/work/ecamp3/ecamp3/frontend/node_modules/vue-template-es2015-compiler/buble.js:2757:13)
    at Parser.pp.unexpected (/home/runner/work/ecamp3/ecamp3/frontend/node_modules/vue-template-es2015-compiler/buble.js:647:8)
    at Parser.pp$3.parseExprAtom (/home/runner/work/ecamp3/ecamp3/frontend/node_modules/vue-template-es2015-compiler/buble.js:2196:10)
Else jest complains:
Jest encountered an unexpected token
...
 /home/runner/work/ecamp3/ecamp3/frontend/node_modules/url-template/lib/url-template.js:97
      export function parseTemplate(template) {
      ^^^^^^
Else jest complains that the component is not registered.
Also fix Admin.spec.js, was broken in 020ffab.
@BacLuc BacLuc requested review from manuelmeister and usu July 15, 2023 16:04
@usu
Copy link
Member

usu commented Jul 15, 2023

Seems the problem with optional chaining was fixed with jest 29:
vuejs/vue-jest#200 (comment)

So maybe it would still be worth to try merging #3566

What do you think?

@BacLuc
Copy link
Contributor Author

BacLuc commented Jul 15, 2023

Seems the problem with optional chaining was fixed with jest 29: vuejs/vue-jest#200 (comment)

So maybe it would still be worth to try merging #3566

What do you think?

Until now we had only 2 places were this optional chaining was used.
And it can still be used, just in computed properties.
Here it was even not needed, because the nullable parts were anyway checked by v-if before
When we anyway have to switch to vue3 in hopefully less than a year, i would say we save us the problems with additional hacks, and
use the new features when we have a dependency tree where we receive updates.
(See the blocked vue dependencies in #1864 )

Another way with which we can get away from the jest problems is switching to vitest (#3268 )

@BacLuc BacLuc marked this pull request as draft August 15, 2023 12:38
@BacLuc
Copy link
Contributor Author

BacLuc commented Aug 15, 2023

converted it to draft, because this work may be unnecessary with #3268

@BacLuc
Copy link
Contributor Author

BacLuc commented Sep 17, 2023

not needed anymore with #3268

@BacLuc BacLuc closed this Sep 17, 2023
@BacLuc BacLuc deleted the fix-warnings-fe-tests branch December 23, 2023 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants