Skip to content

Commit 4e3f8c7

Browse files
Dev update.
1 parent 6cccf22 commit 4e3f8c7

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

tests/dispose.test.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,12 @@ describe('dispose', () => {
8686
it('should dispose array of objects', () => {
8787
const objects = [new MockDisposable(), new MockDisposable()]
8888
dispose.these(objects)
89-
expect(objects[0].isDisposed).toBe(true)
90-
expect(objects[1].isDisposed).toBe(true)
89+
const firstObject = objects[0];
90+
const secondObject = objects[1];
91+
expect(firstObject).toBeDefined();
92+
expect(secondObject).toBeDefined();
93+
expect(firstObject?.isDisposed).toBe(true)
94+
expect(secondObject?.isDisposed).toBe(true)
9195
})
9296

9397
it('should handle empty array', () => {
@@ -111,8 +115,12 @@ describe('dispose', () => {
111115
it('should dispose array without copying', () => {
112116
const objects = [new MockDisposable(), new MockDisposable()]
113117
dispose.these.unsafe(objects)
114-
expect(objects[0].isDisposed).toBe(true)
115-
expect(objects[1].isDisposed).toBe(true)
118+
const firstObject = objects[0];
119+
const secondObject = objects[1];
120+
expect(firstObject).toBeDefined();
121+
expect(secondObject).toBeDefined();
122+
expect(firstObject?.isDisposed).toBe(true)
123+
expect(secondObject?.isDisposed).toBe(true)
116124
})
117125
})
118126

@@ -135,9 +143,11 @@ describe('dispose', () => {
135143
const objects = [new MockDisposable(), new MockDisposable()]
136144
dispose.these.deferred(objects)
137145

138-
expect(objects[0].isDisposed).toBe(false)
146+
const firstObject = objects[0];
147+
expect(firstObject).toBeDefined();
148+
expect(firstObject?.isDisposed).toBe(false)
139149
await new Promise(resolve => setTimeout(resolve, 0))
140-
expect(objects[0].isDisposed).toBe(true)
150+
expect(firstObject?.isDisposed).toBe(true)
141151
})
142152

143153
it('should schedule disposal with delay', async () => {
@@ -156,7 +166,9 @@ describe('dispose', () => {
156166
dispose.these.deferred.unsafe(objects, 5)
157167

158168
await new Promise(resolve => setTimeout(resolve, 10))
159-
expect(objects[0].isDisposed).toBe(true)
169+
const firstObject = objects[0];
170+
expect(firstObject).toBeDefined();
171+
expect(firstObject?.isDisposed).toBe(true)
160172
})
161173
})
162174
})

tests/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": true,
5+
"skipLibCheck": true,
6+
"types": ["vitest/globals", "node"]
7+
},
8+
"include": [
9+
"**/*.ts",
10+
"**/*.js"
11+
],
12+
"exclude": []
13+
}

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default defineConfig({
66
environment: 'node',
77
coverage: {
88
enabled: true,
9-
reporter: ['text', 'html'],
9+
reporter: ['text'],
1010
include: ['src/**/*.ts'],
1111
exclude: ['src/**/*.d.ts', 'src/index.ts'],
1212
thresholds: {

0 commit comments

Comments
 (0)