Refactor node and browser tests#3017
Conversation
ramya-rao-a
left a comment
There was a problem hiding this comment.
Left a few more comments to the contents of the environmentVariables.ts file. What do you think of renaming this file to testEnvVariables.ts ?
Usage wise, things are good. Therefore, the changes made to streamingReceiverSessions.ts can be ported over to the other test files in the same PR.
|
In latest commit:
Please take a look @bterlson @ramya-rao-a @AlexGhiondea @sadasant |
|
/azp run azure-sdk-for-js - all-tests - servicebus |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@ramya0820 talked with @ramya-rao-a as well as elements of our cosmos team (@southpolesteve) and it seems like bundling + nested package.json is not a good approach. Steve suggests possibly using a script. However, we want to do something simpler in this PR - revert the change importing from package.json, and doing the "proper" browserification, something like: package.json aadUtils.browser.ts export async function recreateQueue(): Promise<void> {}
export async function recreateSubscription(): Promise<void> {}
export async function recreateTopic(): Promise<void> {}
export const loginWithServicePrincipalSecret = 0;aadUtils.ts Let me know if you have questions about this approach! |
@bterlson I had made changes as suggested (since the main difference seems to be in the paths used in the browser field). However, it still fails with error - Also, the findings seem to be inline with conversation we had earlier about use of 'browser' field having an issue and that there may be a bug in rollup-plugin-node-resolve? You mentioned that you would like to test with webpack/parcel/pika to see whether other bundlers hit this issue? |
|
I checked Webpack, and it wasn't affected but I think by chance. I came to the conclusion that it's just too risky to have a package.json outside the package root. It's like a honeypot for tools to get broken by! I'll look at the stream errors later today. It's a little suspicious that this wasn't an issue when externalizing ms-rest-js since stream is used elsewhere IIRC. Bundlers use the browser field if the field is present and the user has indicated they are building for the browser (which I think is default with webpack). |
Oh but we have just one package.json file and that is at the root 'service-bus' folder right? About externalizing ms-rest-js, I believe this is in reference to amqp-common. Got it, overall it's unclear as to how the rollup tool would use the browser field from package.json as that seems to maybe affect for when package is used by say dependencies. Will look into rollup internals and see if anything useful hits up. You mentioned manually changing the .js file to map to .browser version had worked? Did you mean it worked by resolving the buffer issues noted in #3119 ? Or is that unrelated, and you had verified using npm only ? @bterlson |
Discussed offline with @ramya-rao-a, bits were clarified about updating Turns out rollup json plugin was still needed per error: And on restoring it's use, the file mapping still seems to pull in the aadUtils meant for node. |
We troubleshooted this offline. What was missing was removing of the stale |
- Update constants.ts file - Add in .browser version of aadUtils.ts in test - Update rollup config for browser
Yes, @bterlson could you take a look at updated changes? Also, the npm vs rush issue still exists and seems independent of these changes. @KarishmaGhiya |
|
@ramya0820 One last change: Please remove the @bterlson has logged #3224 as a follow up item to the removal of package.json import. Please pick that up as your next item so that we avoid falling into the case of shipping a new update but forgetting to update the constants file |
|
Great! Since all the other issues are fixed, I will now safely investigate into the issue you are running into with the rush workflow @ramya0820 |
Oops, just seeing this comment - Will update the
|
@ramya0820 Below is from the email that you started for the build failures in this PR where @bterlson talks about how the presence of Based on the above, we concluded that removing the json imports that was placed to get the package name and version should resolve the problem with the mapping
Like @bterlson mentioned in #3017 (comment) the browser field is used by bundlers. In our case, the rollup tool. The mappings in the browser field is used by the |
|
Got it, thanks @ramya-rao-a! |
For more context refer to #2859
This PR is part 1 of refactoring node and browser tests.
Moved out environment variables, making them browser friendly and updated
streamingReceiverSessions.tsfile to use the new utils file.If this looks fine, then coming up next (in maybe same or different PRs) are: