diff --git a/js/src/css/index.js b/js/src/css/index.js index 84a036c33..70e16071f 100644 --- a/js/src/css/index.js +++ b/js/src/css/index.js @@ -37,4 +37,6 @@ function css_beautify(source_text, options) { } module.exports = css_beautify; -module.exports.defaultOptions = new Options(); +module.exports.defaultOptions = function() { + return new Options(); +}; diff --git a/js/src/html/index.js b/js/src/html/index.js index ec82c514b..9bd9aba36 100644 --- a/js/src/html/index.js +++ b/js/src/html/index.js @@ -37,4 +37,6 @@ function style_html(html_source, options, js_beautify, css_beautify) { } module.exports = style_html; -module.exports.defaultOptions = new Options(); +module.exports.defaultOptions = function() { + return new Options(); +}; diff --git a/js/src/javascript/index.js b/js/src/javascript/index.js index 9358fcab7..ec74608a4 100644 --- a/js/src/javascript/index.js +++ b/js/src/javascript/index.js @@ -37,4 +37,6 @@ function js_beautify(js_source_text, options) { } module.exports = js_beautify; -module.exports.defaultOptions = new Options(); +module.exports.defaultOptions = function() { + return new Options(); +}; diff --git a/js/test/node-beautify-tests.js b/js/test/node-beautify-tests.js index b0bfa3433..3ebae5ddd 100755 --- a/js/test/node-beautify-tests.js +++ b/js/test/node-beautify-tests.js @@ -19,14 +19,17 @@ function test_legacy_names() { results.expect(typeof beautify.html, 'function'); console.log('Ensure defaultOptions are defined'); - results.expect(typeof beautify.js.defaultOptions, 'object'); - results.expect(typeof beautify.css.defaultOptions, 'object'); - results.expect(typeof beautify.html.defaultOptions, 'object'); + results.expect(typeof beautify.js.defaultOptions, 'function'); + results.expect(typeof beautify.css.defaultOptions, 'function'); + results.expect(typeof beautify.html.defaultOptions, 'function'); console.log('Ensure that legacy import names equal the new ones'); results.expect(beautify.js, beautify.js_beautify); results.expect(beautify.css, beautify.css_beautify); results.expect(beautify.html, beautify.html_beautify); + results.expect(beautify.js.defaultOptions, beautify.js_beautify.defaultOptions); + results.expect(beautify.css.defaultOptions, beautify.css_beautify.defaultOptions); + results.expect(beautify.html.defaultOptions, beautify.html_beautify.defaultOptions); console.log(results.results_raw()); return results.get_exitcode();