-
Notifications
You must be signed in to change notification settings - Fork 12
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
update node version (v18, v20, v22) #833
Conversation
17ffdaf
to
0676931
Compare
@josephjclark
Work in progress! |
Thank you for the update @doc-han ! Appreciate it If anything in the core code is seriously breaking please let me know as soon as possible |
Currently, the only thing not working is In node 20. This is because. with custom adaptor paths. even tho we mock the adaptor path. the runtime doesn't use Been on it for a while now. |
I see. So we either need to change how the runtime imports modules (not keen on that!) or we need to find a better way to mock modules on the file system? Or we need to work out a different way to test. We could use the actual file system to load modules, although the mock is very convenient 🤔 Di you have a link for the mock-fs and node 20 issue? Does this fix itself it node 22? |
Hey @doc-han I think this is going to get complicated, can we divide-and-conquer a bit?
This will make code review much easier and help me understand what's going on. I can help tidy up the issues on Monday, just so long as I have a clear list of the problems |
// ava.config.js
...
workerThreads: false,
... Our current headachewhen kit/packages/cli/test/commands.test.ts Lines 60 to 72 in 4376f7b
we later want to import from this mocked filesystem. kit/packages/runtime/src/modules/linker.ts Line 151 in 4376f7b
Works in v18 but not in v20 |
Hence, our only failing tests are in |
Yeah we can do that. |
Ok cool: so let's make this PR solely about #542, and any other node 20 issues we'll handle in different PRs |
d67f97b
to
48285ba
Compare
@josephjclark Resolves our test issues and as you can see. tests are passing on v18 & v20. hurray 🎉 (bed-time) |
Are we saying there's no fix to this? We straight up can't use ava + typescript + workers in node 20+? That would be a huge disappointment - are more people talking about this somewhere? I'd much prefer to use worker threads, they're way less intensive. Running the tests with child processes makes my whole system burn up. I know, I've tried it! |
We currently don't have a problem with that. SWC seems to work fine. That issue was happening with other loaders like |
will get you references. |
Ok @doc-han , thanks. So long as swc is loading that's cool, I'm happy to lean into that. No need for references, happy to take you at your word :) Thanks |
48285ba
to
89ffe57
Compare
2bca944
to
9c16cdf
Compare
Starting to see some strange fails on particular node versions. Investigating - not sure how concerned to be yet. Also seeing some strange log output in CI whici I need to get to the bottom of. Also, I think unit tests have been running wrongly? I think forever? They should be running inside a docker container to use the global openfn command - but they're not, they're running from a local build. This is probably something that needs to be looked at separately |
The |
I've caught a couple of things:
I've fixed the runtime, fixed some tests, and skipped some low-value ones |
Or at least fail better
Still some flaky tests in docgen which I'll have to keep skipping. But otherwise this is ready go. I'll test the build on the staging server. I'm feeling pretty confident about this but the last two hours have got me a little worried. So I'l retest with a cool head tomorrow. |
Thank you so much for this @doc-han 🙏 |
Short Description
This PR ensures that Openfn/kit tooling works on several node versions. (v18, v20 & v22)
Fixes
#542
#617
Implementation Details
1. chore: move from ts-node to swc-loader (f857884)
Removes
ts-node
from the codebase and adds@swc-node/register
as the new loader for running ava tests.2. ci: update CI to run tests for v18, v20 & v22 (33f777d)
Updates the CI to run
unit_tests
andintegration_tests
under the node versions 18,20, 22.3. fix: several tests & mocks (1222c9c)
This commit fixes several mocks that seem to function in v18 but not in other node versions. Some of them have to do with functionalities that don't exist across versions and so on.
package.json
from import with assert to usefs
cannot read properties of undefined
to considercannot destructure property
workerProcess.kill('SIGTERM')
is async4. fix: resolve mock-fs (fc2e5e1)
readFileSync
withutf-8
was broken by an optimization in node. An update to[email protected]
resolved that. (readFileSync with 'utf-8' option broken by node v20.5.0 tschaub/mock-fs#377)mock-fs
. No good issue around that. Using the real filesystem resolved that. (Can't require files with mocked filesystem tschaub/mock-fs#130)5. test: collection tests & flaky test (4cfd339)
"allow a job to complete after receiving a sigterm"
. This is because it's flaky and.kill('SIGTERM')
is async.QA Notes
List any considerations/cases/advice for testing/QA here.
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy