Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 54 additions & 50 deletions test/common/markdown/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,60 @@
"use strict";
var gulp = require("gulp");
var concat = require("gulp-concat");
var through2 = require("through2");
var markdownlint = require("markdownlint");
function RunTest() {
"use strict";
var gulp = require("gulp");
var concat = require("gulp-concat");
Copy link
Member

Choose a reason for hiding this comment

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

Can you move these requires to the root instead of them being in the function?

var through2 = require("through2");
var markdownlint = require("markdownlint");

gulp.task("test-mdsyntax", function task() {
var paths = [];
var rootpath;
gulp.task("test-mdsyntax", function task() {
var paths = [];
var rootpath;

// assign --repoRoot <rootpath> into rootpath
var j = process.argv.indexOf("--rootpath");
if (j > -1) {
rootpath = process.argv[j + 1];
}
// assign --repoRoot <rootpath> into rootpath
var j = process.argv.indexOf("--rootpath");
if (j > -1) {
rootpath = process.argv[j + 1];
}

if(rootpath == null)
{
throw "--rootpath <repoRoot> must be specified before all other parameters"
}
if(rootpath == null)
{
throw "--rootpath <repoRoot> must be specified before all other parameters"
}

// parse --filter into paths. --rootpath must be specified first.
var j = process.argv.indexOf("--filter");
if (j > -1) {
var filters = process.argv[j + 1].split(",");
filters.forEach(function (filter) {
paths.push(rootpath + "/" + filter);
}, this);
}
// parse --filter into paths. --rootpath must be specified first.
var j = process.argv.indexOf("--filter");
if (j > -1) {
var filters = process.argv[j + 1].split(",");
filters.forEach(function (filter) {
paths.push(rootpath + "/" + filter);
}, this);
}

if(paths.length == 0)
{
throw "--filter <filter relative to repoRoot> must be specified"
}
if(paths.length == 0)
{
throw "--filter <filter relative to repoRoot> must be specified"
}

var rootJsonFile = rootpath + "/.markdownlint.json"
var fs = require('fs');
fs.appendFileSync('markdownissues.txt', '--EMPTY--\r\n');
gulp.src(paths, { "read": false })
.pipe(through2.obj(function obj(file, enc, next) {
markdownlint(
{
"files": [file.path],
"config": require(rootJsonFile)
},
function callback(err, result) {
var resultString = (result || "").toString();
if (resultString) {
file.contents = new Buffer(resultString);
}
next(err, file);
});
}))
.pipe(concat("markdownissues.txt", { newLine: "\r\n" }))
.pipe(gulp.dest("."));
});
var rootJsonFile = rootpath + "/.markdownlint.json"
var fs = require('fs');
Copy link
Member

Choose a reason for hiding this comment

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

Nearly missed this guy. Same comment to pull it out to root.

fs.appendFileSync('markdownissues.txt', '--EMPTY--\r\n');
gulp.src(paths, { "read": false })
.pipe(through2.obj(function obj(file, enc, next) {
markdownlint(
{
"files": [file.path],
"config": require(rootJsonFile)
},
function callback(err, result) {
var resultString = (result || "").toString();
if (resultString) {
file.contents = new Buffer(resultString);
}
next(err, file);
});
}))
.pipe(concat("markdownissues.txt", { newLine: "\r\n" }))
.pipe(gulp.dest("."));
});
}

RunTest();
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ Describe "CmsMessage cmdlets and Get-PfxCertificate basic tests" -Tags "CI" {
}

It "Verify Get-PfxCertificate right password" {
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Test secret.")]
$pass = ConvertTo-SecureString "password" -AsPlainText -Force
$cert = Get-PfxCertificate $protectedCertLocation -Password $pass
$cert.Subject | Should Be "CN=localhost"
}

It "Verify Get-PfxCertificate wrong password" {
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Test secret.")]
$pass = ConvertTo-SecureString "wrongpass" -AsPlainText -Force
$e = { Get-PfxCertificate $protectedCertLocation -Password $pass -ErrorAction Stop } | ShouldBeErrorId "GetPfxCertificateUnknownCryptoError,Microsoft.PowerShell.Commands.GetPfxCertificateCommand"
}
Expand Down