Skip to content

Test plotly.min.js in Require.js environment #914

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

Merged
merged 3 commits into from
Sep 7, 2016
Merged

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Sep 7, 2016

This PR is unfortunately necessary to make sure that plotly.min.js can be loaded inside a Jupyter notebook by https://github.com/plotly/plotly.py

See:

for more info.

In brief, this PR:

  • add a jasmine test making sure that plotly.min.js loads correctly via Require.js
  • add a UBER hacky step to the bundle step, where minified bundles pass through a .replace to fix the aforementioned issue.

@etpinard etpinard added this to the v1.17.0 milestone Sep 7, 2016
@@ -52,6 +53,16 @@ function makeTestImageFolders() {
makeOne(constants.pathToTestImagesDiff, 'test image diff folder');
}

// Make script file that define plotly in a RequireJS context
function makeRequireJSFixture() {
var bundle = fs.readFileSync(constants.pathToPlotlyDistMin, 'utf-8'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important I chose to test Require.js import with the dist/plotly.min.js bundle only.

That means that Require.js will only be tested on npm version commits (when the dist/ is updated).

Main reason for this shotcut: minifying the full plotly.js bundle take about 1 minute on CI.

@bpostlethwaite
Copy link
Member

Yes this is pretty unfortunate but at least you found a way to test it!
💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants