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: refactor uses of __dirname now that API is using esnext #3507

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Aug 12, 2024

Should fix failing e2e regression tests on main 🀞 https://opensystemslab.slack.com/archives/C04EEBR1E0P/p1723443286868999

Regression tests passing against this branch βœ… https://github.com/theopensystemslab/planx-new/actions/runs/10358321445

Two part bug:

  1. __dirname is not defined error was being thrown when trying to generate zip folders for submissions (hence Uniform-related e2e failure) - we can now access this by using fileURLToPath as outlined in this post
  2. BUT that solution throws the following error on pnpm test : The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext' - which is a bit strange because these options do indeed match our API's tsconfig
    • So then I spent some time working through various suggestions outlined in this thread & ended up using the final solution to add an extra dev dependency ts-jest-mock-import-meta

Manual testing notes:

Copy link

github-actions bot commented Aug 12, 2024

Removed vultr server and associated DNS entries

import { fileURLToPath } from "url";
import { $api } from "../../../client/index.js";
import type { Passport as IPassport } from "../../../types.js";
import { getFileFromS3 } from "../../file/service/getFile.js";
Copy link
Member Author

Choose a reason for hiding this comment

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

this is mostly noise from running "organise imports" in this file, only one new import here which is fileURLToPath

Copy link
Contributor

@RODO94 RODO94 left a comment

Choose a reason for hiding this comment

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

Ran through the manual testing listed and it works as expected.

It all looks good to me

@jessicamcinchak jessicamcinchak merged commit a9bbf93 into main Aug 13, 2024
17 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/esm-dirname-bug branch August 13, 2024 09:56
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.

2 participants