Skip to content

Commit c01b4b5

Browse files
committed
normal ci
1 parent e04fa60 commit c01b4b5

File tree

2 files changed

+15
-60
lines changed

2 files changed

+15
-60
lines changed

.github/workflows/ci.yml

-41
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,6 @@ name: CI
33
on: [push, pull_request]
44

55
jobs:
6-
eperm:
7-
runs-on: windows-latest
8-
defaults:
9-
run:
10-
shell: bash
11-
12-
steps:
13-
- name: Checkout Repository
14-
uses: actions/checkout@v4
15-
16-
- name: Use Nodejs 22.x
17-
uses: actions/setup-node@v4
18-
with:
19-
node-version: 22.x
20-
21-
- name: Install dependencies
22-
run: npm install
23-
24-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
25-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
26-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
27-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
28-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
29-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
30-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
31-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
32-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
33-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
34-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
35-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
36-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
37-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
38-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
39-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
40-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
41-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
42-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
43-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
44-
- run: npm test -- -t0 test/integration/eperm.ts --disable-coverage --grep=. --grep=async
45-
466
build:
477
strategy:
488
matrix:
@@ -81,4 +41,3 @@ jobs:
8141
RIMRAF_TEST_START_CHAR: a
8242
RIMRAF_TEST_END_CHAR: f
8343
RIMRAF_TEST_DEPTH: 5
84-
RIMRAF_TEST_SKIP_EPERM_INTEGRATION: 1

test/integration/eperm.ts

+15-19
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,19 @@ import { windows, windowsSync } from '../../src/index.js'
66
import { randomBytes } from 'crypto'
77
import assert from 'assert'
88

9-
const arrSame = (arr1: string[], arr2: string[]) =>
10-
[...arr1].sort().join(',') === [...arr2].sort().join(',')
11-
129
const setup = (t: Test) => {
1310
const [iterations, depth, fileCount, fileKb] =
1411
process.env.CI && process.platform === 'win32' ?
15-
[20_000, 15, 7, 100]
12+
[1000, 15, 7, 100]
1613
: [200, 8, 3, 10]
1714

18-
t.plan(11)
15+
t.plan(10)
1916
const dir = t.testdir()
2017
const readdir = () => readdirSync(dir)
2118

2219
const letters = (length: number) =>
2320
Array.from({ length }).map((_, i) => (10 + i).toString(36))
24-
const files = letters(fileCount).map(f => `__file_${f}`)
21+
const files = letters(fileCount).map(f => `_file_${f}`)
2522
const dirs = join(...letters(depth))
2623
.split(sep)
2724
.reduce<string[]>((acc, d) => acc.concat(join(acc.at(-1) ?? '', d)), [])
@@ -30,6 +27,8 @@ const setup = (t: Test) => {
3027
.map(d => join(dir, d))
3128

3229
let iteration = 0
30+
let previous = Date.now()
31+
const start = Date.now()
3332

3433
return function* () {
3534
while (iteration !== iterations) {
@@ -73,19 +72,19 @@ const setup = (t: Test) => {
7372
.map(m => join(dir, m))
7473

7574
assert(
76-
arrSame(matches, entries),
75+
[...matches].sort().join() === [...entries].sort().join(),
7776
new RunError(`glob result does not match expected`, {
7877
found: matches,
7978
wanted: entries,
8079
}),
8180
)
8281

8382
iteration += 1
84-
yield [
83+
yield {
8584
matches,
86-
(error: unknown, path: string) =>
85+
error: (error: unknown, path: string) =>
8786
new RunError('rimraf error', { path, error }),
88-
(result: [string, boolean][]) => {
87+
assertResult: (result: [string, boolean][]) => {
8988
assert(
9089
result.length === dirs.length * (files.length + 1),
9190
new RunError(`result is missing entries`, {
@@ -101,13 +100,14 @@ const setup = (t: Test) => {
101100
)
102101
assertContents()
103102
if (iteration % (iterations / 10) === 0) {
104-
t.ok(true, `${iteration}`)
103+
const now = Date.now()
104+
t.ok(true, `${iteration} (${now - previous}ms / ${now - start}ms)`)
105+
previous = now
105106
}
106107
},
107-
] as const
108+
}
108109
}
109110

110-
t.equal(iteration, iterations, `ran all ${iteration} iterations`)
111111
t.end()
112112
}
113113
}
@@ -117,12 +117,8 @@ const setup = (t: Test) => {
117117
// errors consistently in Windows CI environments.
118118
// https://github.com/sindresorhus/del/blob/chore/update-deps/test.js#L116
119119
t.test('windows does not throw EPERM', t => {
120-
if (process.env.RIMRAF_TEST_SKIP_EPERM_INTEGRATION) {
121-
return t.end()
122-
}
123-
124120
t.test('sync', t => {
125-
for (const [matches, error, assertResult] of setup(t)()) {
121+
for (const { matches, error, assertResult } of setup(t)()) {
126122
assertResult(
127123
matches.map(path => {
128124
try {
@@ -136,7 +132,7 @@ t.test('windows does not throw EPERM', t => {
136132
})
137133

138134
t.test('async', async t => {
139-
for (const [matches, error, assertResult] of setup(t)()) {
135+
for (const { matches, error, assertResult } of setup(t)()) {
140136
assertResult(
141137
await Promise.all(
142138
matches.map(async path => {

0 commit comments

Comments
 (0)