-
Notifications
You must be signed in to change notification settings - Fork 19
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
chore: Change testing to use cjs. #636
Conversation
@@ -1,5 +1,4 @@ | |||
import { jest } from '@jest/globals'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put the TextEncoder and a crypto fix into a setup script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted to JSON to remove the decision of ESM/CJS.
@@ -30,14 +30,12 @@ | |||
"build": "tsc --noEmit && rollup -c rollup.config.js", | |||
"lint": "eslint . --ext .ts,.tsx", | |||
"prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../.prettierignore", | |||
"test": "NODE_OPTIONS=--experimental-vm-modules npx jest --runInBand", | |||
"test": "npx jest --runInBand", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer require experimental options.
One of the many benefits is that I can get the debugger to work for this package now.
@@ -62,6 +60,7 @@ | |||
"prettier": "^3.0.0", | |||
"rimraf": "^5.0.5", | |||
"rollup": "^3.23.0", | |||
"rollup-plugin-visualizer": "^5.12.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been a dev dependency to begin with.
"coverage": "yarn test --coverage", | ||
"check": "yarn prettier && yarn lint && yarn build && yarn test" | ||
}, | ||
"dependencies": { | ||
"@launchdarkly/js-client-sdk-common": "1.10.0", | ||
"escape-string-regexp": "^5.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package is ESM only, just vendoring it removes that as a factor in the builds.
packages/sdk/browser/setup-jest.js
Outdated
|
||
Object.assign(window, { TextDecoder, TextEncoder }); | ||
|
||
Object.defineProperty(global.self, "crypto", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to resolve the "digest of undefined" issue.
e87f59e
to
55828db
Compare
55828db
to
0349691
Compare
BEGIN_COMMIT_OVERRIDE
chore: Change browser packages testing to use CJS.
feat: Vendor escapeStringRegexp to simplify builds.
END_COMMIT_OVERRIDE
SDK-816