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

Babili on server.js #411

Merged
merged 2 commits into from
Mar 21, 2017
Merged

Babili on server.js #411

merged 2 commits into from
Mar 21, 2017

Conversation

matteofigus
Copy link
Member

This doesn't include (yet) the sourcemaps for server.js.

/cc @nickbalestra

Nick Balestra and others added 2 commits January 20, 2017 17:16
@@ -43,6 +44,7 @@ module.exports = function webpackConfigGenerator(params){
]
},
plugins: [
new BabiliPlugin(),
Copy link
Member Author

Choose a reason for hiding this comment

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

simple integration atm

'const sayHello = (name) => {' +
' if(name!=="John Doe") infiniteLoops();' +
' return `Hello ${name}`;' +
'};' +
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to trick babili and its treeshaking as the previous test was just removing the infiniteLoops() function as it had no calls (and therefore not making the infinite loops replacements).

expect(compiledContent).to.contain('var __ITER = 1000000000;do { if(__ITER <=0){ throw new Error' +
'("Loop exceeded maximum allowed iterations"); } \n' +
' z = 342;\n __ITER--; } while (true);');
expect(compiledContent.match(/Loop exceeded maximum allowed iterations/g).length).to.equal(3);
Copy link
Member Author

Choose a reason for hiding this comment

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

Here it became complicated to test the exact replacement as it gets minified after that. In any case, I test that there are 3 replacements containing that string, which is the number of loops I expect. Good enough, I guess 🤣

Copy link
Contributor

@nickbalestra nickbalestra left a comment

Choose a reason for hiding this comment

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

LGTM

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