Skip to content

Commit

Permalink
chore: fixes an issue on windows (#3865)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasholzer committed Dec 20, 2021
1 parent a48643f commit 69d2e6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/affected-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
// @ts-check
const { existsSync, statSync } = require('fs')
const { join } = require('path')
const process = require('process')

const { grey } = require('chalk')
Expand All @@ -13,7 +14,9 @@ const { DependencyGraph, fileVisitor, visitorPlugins } = require('./project-grap

const getChangedFiles = async (compareTarget = 'origin/main') => {
const { stdout } = await execa('git', ['diff', '--name-only', 'HEAD', compareTarget])
return stdout.split('\n')
// git is using posix paths so adjust them to the operating system by
// using nodes join function
return stdout.split('\n').map((filePath) => join(filePath))
}

/**
Expand All @@ -23,7 +26,9 @@ const getChangedFiles = async (compareTarget = 'origin/main') => {
* @returns {string[]}
*/
const getAffectedFiles = (changedFiles) => {
const testFiles = sync(ava.files)
// glob is using only posix file paths on windows we need the `\`
// by using join the paths are adjusted to the operating system
const testFiles = sync(ava.files).map((filePath) => join(filePath))

// in this case all files are affected
if (changedFiles.includes('npm-shrinkwrap.json') || changedFiles.includes('package.json')) {
Expand Down

1 comment on commit 69d2e6f

@github-actions
Copy link

Choose a reason for hiding this comment

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

📊 Benchmark results

Package size: 358 MB

Please sign in to comment.