-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #602 from desktop/rm-rf-rimraf
Remove rimraf dependency in favor of Node native rm
- Loading branch information
Showing
4 changed files
with
24 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { rm } = require('fs/promises') | ||
const { join } = require('path') | ||
|
||
rm(join(__dirname, '..', 'build'), { recursive: true, force: true }).catch( | ||
console.error | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,23 @@ | ||
import { spawn } from 'child_process' | ||
import { glob } from 'glob' | ||
import { dirname, resolve } from 'path' | ||
import { fileURLToPath } from 'url' | ||
import { join } from 'path' | ||
import { readdir } from 'fs/promises' | ||
|
||
if (process.argv.some(arg => ['-h', '--help'].includes(arg))) { | ||
console.log(`Usage: ${process.argv0} [kind]`) | ||
console.log( | ||
' kind: The kind of tests to run (e.g. "fast", "slow", "external", "all")' | ||
) | ||
process.exit(0) | ||
function reporter(r) { | ||
return ['--test-reporter', r, '--test-reporter-destination', 'stdout'] | ||
} | ||
|
||
;(async function (kind) { | ||
const wildcard = kind && kind !== 'all' ? `${kind}/**` : '**' | ||
const files = await glob(`test/${wildcard}/*-test.ts`) | ||
const reporterDestinationArgs = ['--test-reporter-destination', 'stdout'] | ||
const specTestReporterArgs = [ | ||
'--test-reporter', | ||
'spec', | ||
...reporterDestinationArgs, | ||
] | ||
const files = await readdir('test', { recursive: true }).then(x => | ||
x.filter(f => f.endsWith('-test.ts')).map(f => join('test', f)) | ||
) | ||
|
||
const testReporterArgs = process.env.GITHUB_ACTIONS | ||
? [ | ||
'--test-reporter', | ||
'node-test-github-reporter', | ||
...reporterDestinationArgs, | ||
...specTestReporterArgs, | ||
] | ||
: specTestReporterArgs | ||
process.env.LOCAL_GIT_DIRECTORY = 'git' | ||
|
||
spawn('node', ['--import', 'tsx', ...testReporterArgs, '--test', ...files], { | ||
stdio: 'inherit', | ||
env: { | ||
...process.env, | ||
LOCAL_GIT_DIRECTORY: resolve( | ||
dirname(fileURLToPath(import.meta.url)), | ||
'../git/' | ||
), | ||
}, | ||
}).on('exit', process.exit) | ||
})(process.argv[2]) | ||
const args = [ | ||
...['--import', 'tsx'], | ||
'--test', | ||
...reporter('spec'), | ||
...(process.env.GITHUB_ACTIONS ? reporter('node-test-github-reporter') : []), | ||
...files, | ||
] | ||
|
||
spawn('node', args, { stdio: 'inherit' }).on('exit', process.exit) |
Oops, something went wrong.