Skip to content

Commit

Permalink
build: pass posix option to build in windows (#4409)
Browse files Browse the repository at this point in the history
Closes: #4407
  • Loading branch information
michael-siek committed Apr 15, 2024
1 parent 2940f6e commit 75b0c11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
15 changes: 12 additions & 3 deletions build/rule-generator/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ const validateGetRuleName = async input => {
throw new Error(`RULE name conflicts with an existing rule's filename.`);
}
// 3) ensure no rule id overlaps
const ruleSpecs = await glob(`${directories.rules}/**/*.json`);
const ruleSpecs = await glob(`${directories.rules}/**/*.json`, {
posix: true,
absolute: true
});
const axeRulesIds = ruleSpecs.reduce((out, specPath) => {
const spec = require(specPath);
out.push(spec.id);
Expand Down Expand Up @@ -62,7 +65,10 @@ const validateGetCheckName = async input => {
);
}
// 2) ensure no check filename overlaps
const checkSpecs = await glob(`${directories.checks}/**/*.json`);
const checkSpecs = await glob(`${directories.checks}/**/*.json`, {
posix: true,
absolute: true
});
// cannot use `fs.existsSync` here, as we do not know which category of checks to look under
const axeChecksFileNames = checkSpecs.map(
f => f.replace('.json', '').split('/').reverse()[0]
Expand All @@ -71,7 +77,10 @@ const validateGetCheckName = async input => {
throw new Error('CHECK name conflicts with an existing filename.');
}
// 3) ensure no check id overlaps
const ruleSpecs = await glob(`${directories.rules}/**/*.json`);
const ruleSpecs = await glob(`${directories.rules}/**/*.json`, {
posix: true,
absolute: true
});
const axe = require(directories.axePath);
const axeChecksIds = ruleSpecs.reduce((out, specPath) => {
const spec = require(specPath);
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/metadata-function-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function (grunt) {
'// This file is automatically generated using build/tasks/metadata-function-map.js\n';

src.forEach(globPath => {
glob.sync(globPath).forEach(filePath => {
glob.sync(globPath, { posix: true }).forEach(filePath => {
const relativePath = path.relative(
path.dirname(file.dest),
filePath
Expand Down
3 changes: 2 additions & 1 deletion test/aria-practices/apg.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ describe('aria-practices', function () {
// Use path.resolve rather than require.resolve because APG package.json main file does not exist
const apgPath = path.resolve(__dirname, '../../node_modules/aria-practices/');
const filePaths = globSync(
`${apgPath}/content/patterns/*/**/examples/*.html`
`${apgPath}/content/patterns/*/**/examples/*.html`,
{ posix: true }
);
const testFiles = filePaths.map(
fileName => fileName.split('/aria-practices/content/patterns/')[1]
Expand Down

0 comments on commit 75b0c11

Please sign in to comment.