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

[amqp-common] Browser tests are failing #2678

Closed
ramya0820 opened this issue May 2, 2019 · 5 comments
Closed

[amqp-common] Browser tests are failing #2678

ramya0820 opened this issue May 2, 2019 · 5 comments
Assignees
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. EngSys This issue is impacting the engineering system.

Comments

@ramya0820
Copy link
Member

On running npm run test:browser, encountering following error:

Chrome 73.0.3683 (Windows 10.0.0) ERROR
  Uncaught TypeError: undefined is not a function
  at test-browser/index.js:26153:22

  TypeError: undefined is not a function
      at test-browser/index.js:26153:22
      at test-browser/index.js:3:5
      at test-browser/index.js:4:2

Source of error is due to browser tests not getting rolled up correctly where several instances of undefined() are being generated in the final file.

Older versions of the repository are generating a different rolled up file with about 3000 less number of lines.
The goal of this issue is to investigate repository history and roll up scripts to determine fix.

@ramya0820 ramya0820 added Azure.Core Client This issue points to a problem in the data-plane of the library. labels May 2, 2019
@ramya0820 ramya0820 self-assigned this May 2, 2019
@ramya0820
Copy link
Member Author

@bterlson and I looked into this offline.

The rollup and tests work as expected when node_modules are generated manually using npm install.
On using rush update, the node_modules get symlinked to one in outer common ditrectory.

And all of the mappings exposed by cjs module in rollup script fail to work as expected and we see the following errors in the output:

dist-esm\test\requestResponse.spec.js
equal is not exported by ..\..\..\common\temp\node_modules\.registry.npmjs.org\assert\1.4.1\node_modules\assert\assert.js
118:                 timeoutInSeconds: 5
119:             });
120:             assert.equal(response.correlation_id, messageId);
                        ^
121:         });
122:     });
dist-esm\test\retry.spec.js
should is not exported by ..\..\..\common\temp\node_modules\.registry.npmjs.org\chai\4.2.0\node_modules\chai\index.js
 6: import debugModule from "debug";
 7: const debug = debugModule("azure:amqp-common:retry-spec");
 8: const should = chai.should();
                        ^
 9: import * as dotenv from "dotenv";
10: dotenv.config();
dist-esm\test\tokenProvider.spec.js
should is not exported by ..\..\..\common\temp\node_modules\.registry.npmjs.org\chai\4.2.0\node_modules\chai\index.js
3: import * as tslib_1 from "tslib";
4: import * as chai from "chai";
5: chai.should();

Following is the usage of these references in rollup script for reference:

     cjs({
        namedExports: {
          chai: ["should"],
          assert: ["equal", "deepEqual", "notEqual"]
        }
      })

Overall, the issue is consistently replicated when we use rush update in lieu of npm install to generate the node_modules.

@bsiegel @AlexGhiondea
@ramya-rao-a @HarshaNalluru

@ramya0820 ramya0820 added the EngSys This issue is impacting the engineering system. label May 3, 2019
@ramya0820 ramya0820 removed their assignment May 3, 2019
@bsiegel
Copy link
Member

bsiegel commented May 3, 2019

Can you try replacing browser: true with mainFields: ['module', 'browser'] in the nodeResolve plugin section of your browser rollup config (L124 of rollup.base.config.js)?

@ramya0820
Copy link
Member Author

Can you try replacing browser: true with mainFields: ['module', 'browser'] in the nodeResolve plugin section of your browser rollup config (L124 of rollup.base.config.js)?

This fixed it, or atleast got the same outcome as npm install, thanks!

@bsiegel
Copy link
Member

bsiegel commented May 3, 2019

For future reference, this is due to rollup/rollup-plugin-node-resolve#94 which causes problems when you try to rollup and your node_modules contains symlinks. I will document this somewhere since it's likely to be a stumbling block.

@bsiegel bsiegel self-assigned this May 3, 2019
@bsiegel
Copy link
Member

bsiegel commented May 3, 2019

I am adding a section to the README to cover this situation. Sorry about the confusion!

@bsiegel bsiegel closed this as completed May 3, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. EngSys This issue is impacting the engineering system.
Projects
None yet
Development

No branches or pull requests

2 participants