-
-
Notifications
You must be signed in to change notification settings - Fork 431
Convert tests from CommonJS to ES Module syntax #2076
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
base: main
Are you sure you want to change the base?
Convert tests from CommonJS to ES Module syntax #2076
Conversation
- Necessary to support import pkg from '../package.json' - https://www.typescriptlang.org/tsconfig/#allowSyntheticDefaultImports
The tests are now failing with the same error as #2004.
This is expected behavior because the original import { join } from 'path-browserify' I'll fix this by correcting the import statements to destructure the import path from 'path-browserify'
const { join } = path This is only temporary until #2035 is completed, which switches this library to use the newly created |
…nal `path-browserify` only has default export in CommonJS
Next to be solved, this use of
From the message, it may be possible to work around it by importing A similar error elsewhere.
Not sure what it means. In a REPL, Weirdly I'm not seeing these errors when I run the tests locally. It may depend on Node.js version. |
I can't merge when there are failing tests. If you want to work on this when a PR may break things, I can create a branch for you that you will merge stuff into. When the code will be ready, we will merge that branch as one thing. Let me know if this will work. |
Sure, understood. I'm still working through the errors, I'll see if they can be completely solved in this PR by itself while still using the original |
@eliot-akira we should consider not forking it We Should maybe drop the browserify path implementations in favor of URL as even NodeJS Promise fileSystem methods do support URL and so... see: |
#2169 looks great, much simpler to rely on native If that PR lands, the change could be pulled into this one and hopefully it will make the ESM conversion easier. |
@eliot-akira do not forget we can always Polyfill backward later eg supply URL but i vote for node 18 anyway as smallest target even for tests and we need to get them passing with node 18 anyway. But Readme States that this then needs version bumb to v2 as it is breaking compatibility matrix but that needs to get done anyway even out of security view this needs to get tested on newst chrome and then we later supply backward compat. |
I don't think that we need to bump major version after dropping the old Node. We only need to update everywhere that we don't support them anymore. |
@jcubic good point in real world we would just do 1.xx+1 as we do not real break the existing API and only do additions. But we should also update the readme with that update as it states clear as soon as version matrix of support is broken we release major 1+1.xxxx |
This pull request converts the tests from CommonJS to ES Module syntax.
It's part of a set of changes that created a fork of
path-browserify
with modernized codebase and tree-shakeable exports (ESM); upgrade TypeScript in the build setup and supported browser matrix; update Jest config and convert everything including tests to ES Module so the new fork can be tested together.path-browserify
converted to ES Module with individually exported methods #2035After this PR is refined and merged, #2035 should fast-forward/merge from main branch to complete its final step. When all is done,
isomorphic-git
should be usable from JavaScript runtimes such as Deno and Bun.@jcubic