From b0891ac0719b0f4f2694def085361160153e4d63 Mon Sep 17 00:00:00 2001 From: Guillaume Rouchon Date: Tue, 23 Apr 2024 08:07:44 +0200 Subject: [PATCH] v6: Fix default include dot paths (#32) --- CHANGELOG.md | 1 + README.md | 6 ++ tasks/ReplaceTokensV6/CHANGELOG.md | 1 + tasks/ReplaceTokensV6/README.md | 6 ++ tasks/ReplaceTokensV6/index.ts | 10 ++-- tasks/ReplaceTokensV6/task.json | 8 +++ tasks/ReplaceTokensV6/tests/L0.ts | 83 +++++++++++++++++---------- tasks/ReplaceTokensV6/tests/L0_Run.ts | 1 + 8 files changed, 83 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd1546d..709edcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 5.0.7 Task 6.0.6 - Fix default case sensitivity in sources and additional variables matching ([#29](https://github.com/qetza/replacetokens-task/issues/29)). +- Fix default directories and files starting with a dot in sources and additional variables matching ([#29](https://github.com/qetza/replacetokens-task/issues/29)). ## 5.0.6 Task 6.0.5 diff --git a/README.md b/README.md index dedf249..7b42841 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,11 @@ The task was completely rewritten to use the npm package [@qetza/replacetokens]( # Optional. Default: ignore ifNoFilesFound: '' + # Include directories and files starting with a dot ('.') in glob matching results for sources and additionalVariables. + # + # Optional. Default: true + includeDotPaths: '' + # The log level. # # Accepted values: @@ -332,6 +337,7 @@ The following **anonymous** data is send: - _escape_ - _escapeChar_ - _ifNoFilesFound_ + - _includeDotPaths_ - _logLevel_ - _missingVarAction_ - _missingVarDefault_ diff --git a/tasks/ReplaceTokensV6/CHANGELOG.md b/tasks/ReplaceTokensV6/CHANGELOG.md index 46be810..318f73c 100644 --- a/tasks/ReplaceTokensV6/CHANGELOG.md +++ b/tasks/ReplaceTokensV6/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## 6.0.6 - Fix default case sensitivity in sources and additional variables matching ([#29](https://github.com/qetza/replacetokens-task/issues/29)). +- Fix default directories and files starting with a dot in sources and additional variables matching ([#29](https://github.com/qetza/replacetokens-task/issues/29)). ## 6.0.5 - Fix normalized variable names not supported as token name ([#15](https://github.com/qetza/replacetokens-task/issues/15)) ([#20](https://github.com/qetza/replacetokens-task/issues/20)). diff --git a/tasks/ReplaceTokensV6/README.md b/tasks/ReplaceTokensV6/README.md index b0e4e38..251ee01 100644 --- a/tasks/ReplaceTokensV6/README.md +++ b/tasks/ReplaceTokensV6/README.md @@ -148,6 +148,11 @@ The task was completely rewritten to use the npm package [@qetza/replacetokens]( # Optional. Default: ignore ifNoFilesFound: '' + # Include directories and files starting with a dot ('.') in glob matching results for sources and additionalVariables. + # + # Optional. Default: true + includeDotPaths: '' + # The log level. # # Accepted values: @@ -332,6 +337,7 @@ The following **anonymous** data is send: - _escape_ - _escapeChar_ - _ifNoFilesFound_ + - _includeDotPaths_ - _logLevel_ - _missingVarAction_ - _missingVarDefault_ diff --git a/tasks/ReplaceTokensV6/index.ts b/tasks/ReplaceTokensV6/index.ts index 1508d5f..c5e631b 100644 --- a/tasks/ReplaceTokensV6/index.ts +++ b/tasks/ReplaceTokensV6/index.ts @@ -64,7 +64,8 @@ async function run() { recursive: tl.getBoolInput('enableRecursion'), root: tl.getPathInput('rootDirectory', false, true), sources: { - caseInsensitive: tl.getBoolInput('caseInsensitivePaths') + caseInsensitive: tl.getBoolInput('caseInsensitivePaths'), + dot: tl.getBoolInput('includeDotPaths') }, token: { pattern: @@ -115,7 +116,7 @@ async function run() { // load additional variables const separator = tl.getInput('variableSeparator') || rt.Defaults.Separator; - const additionalVariables = await getAdditionalVariables(options.root, separator, options.sources.caseInsensitive); + const additionalVariables = await getAdditionalVariables(options.root, separator, options.sources.caseInsensitive, options.sources.dot); // set telemetry attributes telemetryEvent.setAttributes({ @@ -127,6 +128,7 @@ async function run() { escape: options.escape.type, 'escape-char': options.escape.escapeChar, 'if-no-files-found': ifNoFilesFound, + 'include-dot-paths': options.sources.dot, 'log-level': logLevelStr, 'missing-var-action': options.missing.action, 'missing-var-default': options.missing.default, @@ -221,7 +223,7 @@ var getChoiceInput = function (name: string, choices: string[], alias?: string): var variableFilesCount = 0; var variablesEnvCount = 0; var inlineVariablesCount = 0; -var getAdditionalVariables = async function (root?: string, separator?: string, caseInsensitive?: boolean): Promise<{ [key: string]: string }> { +var getAdditionalVariables = async function (root?: string, separator?: string, caseInsensitive?: boolean, dot?: boolean): Promise<{ [key: string]: string }> { const input = tl.getInput('additionalVariables') || ''; if (!input) return {}; @@ -240,7 +242,7 @@ var getAdditionalVariables = async function (root?: string, separator?: string, return getAdditionalVariablesFromYaml(input); } })(), - { caseInsensitive: caseInsensitive, normalizeWin32: true, root: root, separator: separator } + { caseInsensitive: caseInsensitive, dot: dot, normalizeWin32: true, root: root, separator: separator } ); }; diff --git a/tasks/ReplaceTokensV6/task.json b/tasks/ReplaceTokensV6/task.json index c846481..04caf21 100644 --- a/tasks/ReplaceTokensV6/task.json +++ b/tasks/ReplaceTokensV6/task.json @@ -79,6 +79,14 @@ "label": "Case insensitive paths", "helpMarkDown": "Enable case-insensitive file path matching in glob patterns (sources and additionalVariables). Default: true" }, + { + "name": "includeDotPaths", + "type": "boolean", + "required": false, + "defaultValue": true, + "label": "Include dot paths", + "helpMarkDown": "Include directories and files starting with a dot ('.') in glob matching results (sources and additionalVariables). Default: true" + }, { "name": "encoding", "type": "pickList", diff --git a/tasks/ReplaceTokensV6/tests/L0.ts b/tasks/ReplaceTokensV6/tests/L0.ts index 2287d5a..d768310 100644 --- a/tasks/ReplaceTokensV6/tests/L0.ts +++ b/tasks/ReplaceTokensV6/tests/L0.ts @@ -15,6 +15,7 @@ describe('ReplaceTokens v6 L0 suite', function () { fs.mkdirSync(tmp, { recursive: true }); process.env['__caseInsensitivePaths__'] = 'true'; + process.env['__includeDotPaths__'] = 'true'; }); afterEach(() => { @@ -27,6 +28,7 @@ describe('ReplaceTokens v6 L0 suite', function () { delete process.env['__escape__']; delete process.env['__escapeChar__']; delete process.env['__ifNoFilesFound__']; + delete process.env['__includeDotPaths__']; delete process.env['__logLevel__']; delete process.env['__missingVarAction__']; delete process.env['__missingVarDefault__']; @@ -204,7 +206,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.stdout.should.not.contain('loadVariables_variables'); tr.stdout.should.include('sources: ["**/*.json","**/*.xml","**/*.yml"]'); tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -231,7 +233,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.stdout.should.include('telemetry sent'); tr.stdout.should.match( - /\[\{"eventType":"TokensReplaced","application":"replacetokens-task","version":"6.0.0","account":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","pipeline":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82","host":"cloud","os":"Windows","sources":3,"add-bom":false,"case-insenstive-paths":true,"encoding":"auto","escape":"auto","if-no-files-found":"ignore","log-level":"info","missing-var-action":"none","missing-var-default":"","missing-var-log":"warn","recusrive":false,"separator":".","token-pattern":"default","transforms":false,"transforms-prefix":"\(","transforms-suffix":"\)","variable-files":0,"variable-envs":0,"inline-variables":0,"output-defaults":1,"output-files":2,"output-replaced":3,"output-tokens":4,"output-transforms":5,"result":"success","duration":\d+(?:\.\d+)?}]/ + /\[\{"eventType":"TokensReplaced","application":"replacetokens-task","version":"6.0.0","account":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","pipeline":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82","host":"cloud","os":"Windows","sources":3,"add-bom":false,"case-insenstive-paths":true,"encoding":"auto","escape":"auto","if-no-files-found":"ignore","include-dot-paths":true,"log-level":"info","missing-var-action":"none","missing-var-default":"","missing-var-log":"warn","recusrive":false,"separator":".","token-pattern":"default","transforms":false,"transforms-prefix":"\(","transforms-suffix":"\)","variable-files":0,"variable-envs":0,"inline-variables":0,"output-defaults":1,"output-files":2,"output-replaced":3,"output-tokens":4,"output-transforms":5,"result":"success","duration":\d+(?:\.\d+)?}]/ ); }, tr); } finally { @@ -314,7 +316,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":true,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":true,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -335,7 +337,7 @@ describe('ReplaceTokens v6 L0 suite', function () { runValidations(() => { tr.stdout.should.include('loadVariables_variables: ["@**/_data/vars.(json|jsonc|yml|yaml)"]'); tr.stdout.should.include( - `loadVariables_options: {"caseInsensitive":true,"normalizeWin32":true,"root":"${process.env['__root__'].replace(/\\/g, '\\\\')}","separator":"."}` + `loadVariables_options: {"caseInsensitive":true,"dot":true,"normalizeWin32":true,"root":"${process.env['__root__'].replace(/\\/g, '\\\\')}","separator":"."}` ); }, tr); }); @@ -355,7 +357,7 @@ describe('ReplaceTokens v6 L0 suite', function () { // assert runValidations(() => { tr.stdout.should.include('loadVariables_variables: ["$__VARS__"]'); - tr.stdout.should.include(`loadVariables_options: {"caseInsensitive":true,"normalizeWin32":true,"separator":"."}`); + tr.stdout.should.include(`loadVariables_options: {"caseInsensitive":true,"dot":true,"normalizeWin32":true,"separator":"."}`); }, tr); }); @@ -376,7 +378,7 @@ describe('ReplaceTokens v6 L0 suite', function () { // assert runValidations(() => { tr.stdout.should.include('loadVariables_variables: ["{\\"var1\\":\\"value1\\",\\"var2\\":\\"value2\\"}"]'); - tr.stdout.should.include(`loadVariables_options: {"caseInsensitive":true,"normalizeWin32":true,"separator":"."}`); + tr.stdout.should.include(`loadVariables_options: {"caseInsensitive":true,"dot":true,"normalizeWin32":true,"separator":"."}`); }, tr); }); @@ -403,7 +405,7 @@ describe('ReplaceTokens v6 L0 suite', function () { runValidations(() => { tr.stdout.should.include('loadVariables_variables: ["@**/_data/vars.*;!**/*.xml","$__VARS__","{\\"var2\\":\\"inline\\",\\"var_yml2\\":\\"inline\\"}"]'); tr.stdout.should.include( - `loadVariables_options: {"caseInsensitive":true,"normalizeWin32":true,"root":"${process.env['__root__'].replace(/\\/g, '\\\\')}","separator":"."}` + `loadVariables_options: {"caseInsensitive":true,"dot":true,"normalizeWin32":true,"root":"${process.env['__root__'].replace(/\\/g, '\\\\')}","separator":"."}` ); }, tr); }); @@ -424,9 +426,9 @@ describe('ReplaceTokens v6 L0 suite', function () { runValidations(() => { tr.succeeded.should.be.true; - tr.stdout.should.include('loadVariables_options: {"caseInsensitive":false,"normalizeWin32":true,"separator":"."}'); + tr.stdout.should.include('loadVariables_options: {"caseInsensitive":false,"dot":true,"normalizeWin32":true,"separator":"."}'); tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":false},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":false,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -447,7 +449,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"chars":"abcd","type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"chars":"abcd","type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -468,7 +470,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"abcd","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"abcd","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -489,7 +491,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"json"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"json"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -552,6 +554,29 @@ describe('ReplaceTokens v6 L0 suite', function () { }, tr); }); + it('includeDotPaths', async () => { + // arrange + const tp = path.join(__dirname, 'L0_Run.js'); + const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); + + process.env['__sources__'] = '**/*.json'; + process.env['__additionalVariables__'] = 'var1: value1'; + process.env['__includeDotPaths__'] = 'false'; + + // act + await tr.runAsync(); + + // assert + runValidations(() => { + tr.succeeded.should.be.true; + + tr.stdout.should.include('loadVariables_options: {"caseInsensitive":true,"dot":false,"normalizeWin32":true,"separator":"."}'); + tr.stdout.should.include( + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":false},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + ); + }, tr); + }); + it('logLevel: debug', async () => { // arrange const tp = path.join(__dirname, 'L0_LogLevel.js'); @@ -664,7 +689,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"keep","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"keep","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -685,7 +710,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"abcd","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"abcd","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -706,7 +731,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"off"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"off"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -727,7 +752,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":true,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":true,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -748,7 +773,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - `options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"root":"${__dirname.replace(/\\/g, '\\\\')}","sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}` + `options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"root":"${__dirname.replace(/\\/g, '\\\\')}","sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}` ); }, tr); }); @@ -769,7 +794,7 @@ describe('ReplaceTokens v6 L0 suite', function () { runValidations(() => { tr.succeeded.should.be.true; - tr.stdout.should.include('loadVariables_options: {"caseInsensitive":true,"normalizeWin32":true,"separator":":"}'); + tr.stdout.should.include('loadVariables_options: {"caseInsensitive":true,"dot":true,"normalizeWin32":true,"separator":":"}'); }, tr); }); @@ -789,7 +814,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); tr.stdout.should.not.include('telemetry sent'); tr.stdout.should.not.include('##vso[task.debug]telemetry: ['); @@ -812,7 +837,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); tr.stdout.should.not.include('telemetry sent'); tr.stdout.should.not.include('##vso[task.debug]telemetry: ['); @@ -835,7 +860,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); tr.stdout.should.not.include('telemetry sent'); tr.stdout.should.not.include('##vso[task.debug]telemetry: ['); @@ -858,7 +883,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); tr.stdout.should.not.include('telemetry sent'); tr.stdout.should.not.include('##vso[task.debug]telemetry: ['); @@ -881,7 +906,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); tr.stdout.should.not.include('telemetry sent'); tr.stdout.should.not.include('##vso[task.debug]telemetry: ['); @@ -904,7 +929,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"azpipelines"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"azpipelines"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -925,7 +950,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default","prefix":"[["},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default","prefix":"[["},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -946,7 +971,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default","suffix":"]]"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default","suffix":"]]"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -967,7 +992,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":true,"prefix":"(","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":true,"prefix":"(","suffix":")"}}' ); }, tr); }); @@ -988,7 +1013,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"[","suffix":")"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"[","suffix":")"}}' ); }, tr); }); @@ -1009,7 +1034,7 @@ describe('ReplaceTokens v6 L0 suite', function () { tr.succeeded.should.be.true; tr.stdout.should.include( - 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":"]"}}' + 'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"sources":{"caseInsensitive":true,"dot":true},"token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":"]"}}' ); }, tr); }); diff --git a/tasks/ReplaceTokensV6/tests/L0_Run.ts b/tasks/ReplaceTokensV6/tests/L0_Run.ts index f34a99c..97076dd 100644 --- a/tasks/ReplaceTokensV6/tests/L0_Run.ts +++ b/tasks/ReplaceTokensV6/tests/L0_Run.ts @@ -14,6 +14,7 @@ if (process.env['__encoding__']) tmr.setInput('encoding', process.env['__encodin if (process.env['__escape__']) tmr.setInput('escapeType', process.env['__escape__']); if (process.env['__escapeChar__']) tmr.setInput('escapeChar', process.env['__escapeChar__']); if (process.env['__ifNoFilesFound__']) tmr.setInput('actionOnNoFiles', process.env['__ifNoFilesFound__']); +if (process.env['__includeDotPaths__']) tmr.setInput('includeDotPaths', process.env['__includeDotPaths__']); if (process.env['__logLevel__']) tmr.setInput('verbosity', process.env['__logLevel__']); if (process.env['__missingVarAction__']) tmr.setInput('missingVarAction', process.env['__missingVarAction__']); if (process.env['__missingVarDefault__']) tmr.setInput('defaultValue', process.env['__missingVarDefault__']);