Skip to content

Commit 41b8c3d

Browse files
author
Roland Groza
committed
feat: update dependencies
1 parent c4d729b commit 41b8c3d

File tree

8 files changed

+1341
-2171
lines changed

8 files changed

+1341
-2171
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
node_version: [10, 12, 14]
15+
node_version: [12, 14, 16]
1616

1717
steps:
1818
- uses: actions/checkout@v2

jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module.exports = {
2+
testEnvironment: "jsdom",
23
globals: {
34
'ts-jest': {
4-
tsConfig: './tsconfig.spec.json',
5+
tsconfig: './tsconfig.spec.json',
56
diagnostics: true
67
}
78
},

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,27 @@
4646
"test": "jest --watch"
4747
},
4848
"dependencies": {
49-
"tslib": "^2.0.3"
49+
"tslib": "^2.4.0"
5050
},
5151
"devDependencies": {
52-
"@babel/core": "^7.12.3",
53-
"@rollup/plugin-commonjs": "^15.1.0",
54-
"@rollup/plugin-node-resolve": "^9.0.0",
55-
"@types/jest": "^26.0.15",
56-
"@types/node": "^14.14.2",
57-
"babel-jest": "^26.6.0",
58-
"camelcase": "^6.1.0",
59-
"jest": "^26.6.0",
60-
"jest-environment-jsdom": "^26.6.0",
52+
"@babel/core": "^7.17.10",
53+
"@rollup/plugin-commonjs": "^22.0.0",
54+
"@rollup/plugin-node-resolve": "^13.2.1",
55+
"@types/jest": "^27.4.1",
56+
"@types/node": "^17.0.30",
57+
"babel-jest": "^28.0.3",
58+
"camelcase": "^6.3.0",
59+
"jest": "^28.0.3",
60+
"jest-environment-jsdom": "^28.0.2",
6161
"npm-run-all": "^4.1.5",
62-
"rollup": "^2.32.1",
62+
"rollup": "^2.70.2",
6363
"rollup-plugin-sourcemaps": "^0.6.3",
6464
"rollup-plugin-terser": "^7.0.2",
65-
"ts-jest": "^26.4.1",
65+
"ts-jest": "next",
6666
"tslint": "^6.1.3",
67-
"typescript": "^4.0.3"
67+
"typescript": "^4.6.4"
6868
},
6969
"engines": {
70-
"node": ">= 10"
70+
"node": ">= 12"
7171
}
7272
}

src/file-selector.spec.ts

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ it('filters thumbnail cache files', async () => {
209209
expect(items).toHaveLength(0);
210210
});
211211

212-
it('should throw if reading dir entries fails', async done => {
212+
it('should throw if reading dir entries fails', done => {
213213
const mockFiles = sortFiles([
214214
createFile('ping.json', {ping: true}),
215215
createFile('pong.json', {pong: true})
@@ -222,15 +222,12 @@ it('should throw if reading dir entries fails', async done => {
222222
], 1, 1))
223223
]);
224224

225-
try {
226-
await fromEvent(evt);
227-
done.fail('Getting the files should have failed');
228-
} catch (err) {
229-
done();
230-
}
225+
fromEvent(evt)
226+
.then(() => done.fail('Getting the files should have failed'))
227+
.catch(() => done());
231228
});
232229

233-
it('should throw if reading file entry fails', async done => {
230+
it('should throw if reading file entry fails', done => {
234231
const mockFiles = sortFiles([
235232
createFile('ping.json', {ping: true}),
236233
createFile('pong.json', {pong: true})
@@ -243,24 +240,18 @@ it('should throw if reading file entry fails', async done => {
243240
], 1, 1))
244241
]);
245242

246-
try {
247-
await fromEvent(evt);
248-
done.fail('Getting the files should have failed');
249-
} catch (err) {
250-
done();
251-
}
243+
fromEvent(evt)
244+
.then(() => done.fail('Getting the files should have failed'))
245+
.catch(() => done());
252246
});
253247

254-
it('should throw if DataTransferItem is not a File', async done => {
248+
it('should throw if DataTransferItem is not a File', done => {
255249
const item = dataTransferItem(null, 'file');
256250
const evt = dragEvtFromFilesAndItems([], [item]);
257251

258-
try {
259-
await fromEvent(evt);
260-
done.fail('Getting the files should have failed');
261-
} catch (err) {
262-
done();
263-
}
252+
fromEvent(evt)
253+
.then(() => done.fail('Getting the files should have failed'))
254+
.catch(() => done());
264255
});
265256

266257

@@ -402,7 +393,7 @@ function inputEvtFromFiles(...files: File[]): Event {
402393
if (p === 'target') {
403394
return input;
404395
}
405-
return t[p];
396+
return (t as any)[p];
406397
}
407398
});
408399
}

src/file.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ describe('toFile()', () => {
5656
});
5757

5858
it('uses the File {webkitRelativePath} as {path} if it exists', () => {
59+
const name = 'test.json';
5960
const path = 'test/test.json';
6061
const file = new File([], name);
6162
Object.defineProperty(file, 'webkitRelativePath', {
@@ -116,7 +117,7 @@ describe('toFile()', () => {
116117
expect(d).toEqual(data);
117118
done();
118119
} catch (e) {
119-
done.fail(e);
120+
done.fail(e as Error);
120121
}
121122
};
122123

src/file.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const COMMON_MIME_TYPES = new Map([
8888
export function toFileWithPath(file: FileWithPath, path?: string): FileWithPath {
8989
const f = withMimeType(file);
9090
if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
91-
const {webkitRelativePath} = file as FileWithWebkitPath;
91+
const {webkitRelativePath} = file;
9292
Object.defineProperty(f, 'path', {
9393
value: typeof path === 'string'
9494
? path
@@ -107,19 +107,10 @@ export function toFileWithPath(file: FileWithPath, path?: string): FileWithPath
107107
return f;
108108
}
109109

110-
interface DOMFile extends Blob {
111-
readonly lastModified: number;
112-
readonly name: string;
113-
}
114-
115-
export interface FileWithPath extends DOMFile {
110+
export interface FileWithPath extends File {
116111
readonly path?: string;
117112
}
118113

119-
interface FileWithWebkitPath extends File {
120-
readonly webkitRelativePath?: string;
121-
}
122-
123114
function withMimeType(file: FileWithPath) {
124115
const {name} = file;
125116
const hasExtension = name && name.lastIndexOf('.') !== -1;

tsconfig.spec.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"module": "commonjs",
55
"target": "es5",
6-
"suppressImplicitAnyIndexErrors": true
6+
"suppressImplicitAnyIndexErrors": true,
7+
"esModuleInterop": true
78
},
89
"include": [
910
"src/**/*.ts"

0 commit comments

Comments
 (0)