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 unit test failures on gh-actions #315

Merged
merged 10 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion frontend/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier-plugin-css-order"
],
"importOrder": ["^vue", "^[a-zA-Z]", "^@[a-zA-Z]", "^@/", "^./", "^../"],
"order": "smacss",
"cssDeclarationSorterOrder": "smacss",
"jsdocCapitalizeDescription": false,
"overrides": [
{
Expand Down
66 changes: 33 additions & 33 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,62 +14,62 @@
"test:e2e": "playwright test"
},
"dependencies": {
"@floating-ui/dom": "^1.4.5",
"@fortawesome/fontawesome-svg-core": "^6.4.0",
"@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/free-regular-svg-icons": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@floating-ui/dom": "^1.5.2",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/vue-fontawesome": "^3.0.3",
"@sentry/browser": "^7.60.0",
"@sentry/vue": "^7.60.0",
"@vueuse/core": "^10.2.1",
"apexcharts": "^3.41.0",
"@sentry/browser": "^7.68.0",
"@sentry/vue": "^7.68.0",
"@vueuse/core": "^10.4.1",
"apexcharts": "^3.42.0",
"body-scroll-lock": "^4.0.0-beta.0",
"lodash": "^4.17.21",
"micromark": "^4.0.0",
"normalize.css": "^8.0.1",
"phenogrid": "^1.5.5",
"tippy.js": "^6.3.7",
"ua-parser-js": "^1.0.2",
"ua-parser-js": "^1.0.36",
"vue": "^3.3.4",
"vue-gtag": "^2.0.1",
"vue-hotjar": "^1.4.0",
"vue-router": "^4.1.2",
"vue-tippy": "^6.2.0",
"vue-router": "^4.2.4",
"vue-tippy": "^6.3.1",
"vue3-apexcharts": "^1.4.4",
"wicg-inert": "^3.1.2"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.0",
"@playwright/test": "^1.36.1",
"@rushstack/eslint-patch": "^1.3.2",
"@tsconfig/node18": "^18.2.0",
"@playwright/test": "^1.37.1",
"@rushstack/eslint-patch": "^1.3.3",
"@tsconfig/node18": "^18.2.1",
"@types/body-scroll-lock": "^3.1.0",
"@types/jsdom": "^21.1.1",
"@types/lodash": "^4.14.195",
"@types/node": "18",
"@types/ua-parser-js": "^0.7.36",
"@vitejs/plugin-vue": "^4.2.3",
"@types/jsdom": "^21.1.2",
"@types/lodash": "^4.14.198",
"@types/node": "20",
"@types/ua-parser-js": "^0.7.37",
"@vitejs/plugin-vue": "^4.3.4",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/test-utils": "2.4.1",
"@vue/tsconfig": "^0.4.0",
"axe-playwright": "^1.2.3",
"eslint": "^8.45.0",
"eslint-plugin-vue": "^9.15.1",
"eslint-plugin-vuejs-accessibility": "^2.1.0",
"eslint": "^8.49.0",
"eslint-plugin-vue": "^9.17.0",
"eslint-plugin-vuejs-accessibility": "^2.2.0",
"jsdom": "^22.1.0",
"msw": "^1.2.3",
"postcss": "^8.4.27",
"prettier": "^3.0.0",
"prettier-plugin-css-order": "^1.3.1",
"prettier-plugin-jsdoc": "^1.0.1",
"sass": "^1.64.1",
"typescript": "^5.1.6",
"vite": "^4.4.7",
"msw": "^1.3.0",
"postcss": "^8.4.29",
"prettier": "^3.0.3",
"prettier-plugin-css-order": "^2.0.0",
"prettier-plugin-jsdoc": "^1.0.2",
"sass": "^1.66.1",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite-svg-loader": "jpkleemans/vite-svg-loader#v4.1.0",
"vitest": "^0.33.0",
"vue-tsc": "^1.8.6"
"vitest": "^0.34.4",
"vue-tsc": "^1.8.10"
},
"msw": {
"workerDirectory": "public"
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */

/**
* Mock Service Worker (1.2.3).
* Mock Service Worker (1.3.0).
* @see https://github.com/mswjs/msw
* - Please do NOT modify this file.
* - Please do NOT serve this file on production.
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ export const request = async <Response>(
params,
options,
parsed,
response: response.clone(),
response,
});

/** throw error after details have been logged */
if (error || parsed === undefined) throw Error(error);

/** add response to cache */
if (request.method === "GET") cache.set(id, response.clone());
if (request.method === "GET") cache.set(id, response);

return parsed;
};
8 changes: 5 additions & 3 deletions frontend/unit/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ afterAll(() => server.close());
/** util function to wait for api calls to mock */
export const apiCall = async (): Promise<void> => {
/**
* why two "flushPromises" calls? see:
* wait for mocks to finish. why two "flushPromises" calls? see:
* https://github.com/vuejs/test-utils/issues/137
*/
await sleep();
await sleep();
/** extra buffer time to make extra sure mocks finish */
await sleep(10);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps a comment here about why it's 10 seconds, in addition to the two non-parameterized calls above, would be nice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, the 10ms is arbitrary and I really don't know why the error is happening. I can't replicate it locally.

I'll add a generic comment to this effect, also leave this PR open a little longer (maybe til next week) to keep investigating.

};

/** mount wrapper with standard options */
export const mount = (
component: Component,
options: ComponentMountingOptions<unknown> = {},
vModel: { [key: PropertyKey]: unknown } = {},
vModel: { [key: PropertyKey]: unknown } = {}
) => {
/** standard globals */
options.global = { components, plugins, stubs: { teleport: true } };
Expand Down Expand Up @@ -79,7 +81,7 @@ export const mount = (
*/
export const emitted = <Event = unknown>(
wrapper: VueWrapper,
event = "update:modelValue",
event = "update:modelValue"
): Array<Event> => {
try {
return wrapper.emitted()[event].pop() as Array<Event>;
Expand Down
Loading