Skip to content

Commit

Permalink
Merge pull request #736 from stealjs/issue/727-extra-space
Browse files Browse the repository at this point in the history
Issue/727 extra space
  • Loading branch information
matthewp committed Jun 12, 2017
2 parents 97471da + bcff2a3 commit 68c010d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/build/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function(original, options) {
}

removeTags.forEach(function(tag) {
result = result.replace(new RegExp('(\\s?)\/\/!' + tag + '-start((.|\n)*?)\/\/!' + tag + '-end', 'gim'), '');
result = result.replace(new RegExp('(\\s?)\/\/!(\\s?)' + tag + '-start((.|\n)*?)\/\/!(\\s?)' + tag + '-end', 'gim'), '');
});

return result;
Expand Down
15 changes: 15 additions & 0 deletions test/clean_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var assert = require("assert");
var clean = require("../lib/build/clean");

describe("build/clean", function() {
var source = "123\n//!steal-remove-start\n456\n//!steal-remove-end\n789";
var source2 = "123\n//! steal-remove-start\n456\n//! steal-remove-end\n789";

it("removes blocks surrounded with steal-remove-start and -end", function() {
assert.equal(clean(source, {}), "123\n789");
});

it("allows an extra space before steal-remove-start for standard linting", function() {
assert.equal(clean(source2, {}), "123\n789");
});
});
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if (semver.lt(process.version, "8.0.0")) {

// Unit tests
require("./clean_address_test");
require("./clean_test");
require("../lib/bundle/bundle_test");
require("./cli/cmd_build_test");
require("./cli/cmd_bundle_test");
Expand Down

0 comments on commit 68c010d

Please sign in to comment.