Remove whitespace-celaning that seems unnecessary.

This commit is contained in:
exoego 2018-12-06 21:36:00 +09:00
parent dd4a49d7f5
commit 1a9cdf356b
2 changed files with 11 additions and 1 deletions

View File

@ -268,7 +268,7 @@ class Variables {
return match.replace(
this.variableSyntax,
(context, contents) => contents.trim()
).replace(/\s/g, '');
);
}
/**
* @typedef {Object} MatchResult

View File

@ -634,6 +634,16 @@ describe('Variables', () => {
return serverless.variables.populateObject(service.custom)
.should.become(expected);
});
it('should preserve whitespace in literal fallback', () => {
service.custom = {
val0: '${self:custom.val, "rate(3 hours)"}',
};
const expected = {
val0: 'rate(3 hours)',
};
return serverless.variables.populateObject(service.custom)
.should.become(expected);
});
it('should handle deep variables regardless of custom variableSyntax', () => {
service.provider.variableSyntax = '\\${{([ ~:a-zA-Z0-9._\\\'",\\-\\/\\(\\)]+?)}}';
serverless.variables.loadVariableSyntax();