Skip to content

Commit 9ffd368

Browse files
authored
chore: upgrade to typescript 3.9 (#10031)
1 parent 0e0eeed commit 9ffd368

66 files changed

Lines changed: 198 additions & 197 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
'error',
2727
{argsIgnorePattern: '^_'},
2828
],
29+
'@typescript-eslint/prefer-ts-expect-error': 'error',
2930
// Since we do `export =`. Remove for Jest 25
3031
'import/default': 'off',
3132
'import/order': 'error',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"strip-ansi": "^6.0.0",
7474
"tempy": "^0.5.0",
7575
"throat": "^5.0.0",
76-
"typescript": "^3.8.2",
76+
"typescript": "^3.9.2",
7777
"which": "^2.0.1"
7878
},
7979
"scripts": {

packages/babel-plugin-jest-hoist/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ FUNCTIONS.mock = args => {
113113

114114
const ids: Set<NodePath<Identifier>> = new Set();
115115
const parentScope = moduleFactory.parentPath.scope;
116-
// @ts-ignore: ReferencedIdentifier is not known on visitors
116+
// @ts-expect-error: ReferencedIdentifier is not known on visitors
117117
moduleFactory.traverse(IDVisitor, {ids});
118118
for (const id of ids) {
119119
const {name} = id.node;

packages/jest-circus/src/__tests__/circusItTestError.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ describe('test/it error throwing', () => {
2929
});
3030
it(`it throws error with missing callback function`, () => {
3131
expect(() => {
32-
// @ts-ignore: Easy, we're testing runtime errors here
32+
// @ts-expect-error: Easy, we're testing runtime errors here
3333
circusIt('test2');
3434
}).toThrowError(
3535
'Missing second argument. It must be a callback function. Perhaps you want to use `test.todo` for a test placeholder.',
3636
);
3737
});
3838
it(`it throws an error when first argument isn't a string`, () => {
3939
expect(() => {
40-
// @ts-ignore: Easy, we're testing runtime errors here
40+
// @ts-expect-error: Easy, we're testing runtime errors here
4141
circusIt(() => {});
4242
}).toThrowError('Invalid first argument, () => {}. It must be a string.');
4343
});
4444
it('it throws an error when callback function is not a function', () => {
4545
expect(() => {
46-
// @ts-ignore: Easy, we're testing runtime errors here
46+
// @ts-expect-error: Easy, we're testing runtime errors here
4747
circusIt('test4', 'test4b');
4848
}).toThrowError(
4949
'Invalid second argument, test4b. It must be a callback function.',
@@ -56,21 +56,21 @@ describe('test/it error throwing', () => {
5656
});
5757
it(`test throws error with missing callback function`, () => {
5858
expect(() => {
59-
// @ts-ignore: Easy, we're testing runtime errors here
59+
// @ts-expect-error: Easy, we're testing runtime errors here
6060
circusTest('test6');
6161
}).toThrowError(
6262
'Missing second argument. It must be a callback function. Perhaps you want to use `test.todo` for a test placeholder.',
6363
);
6464
});
6565
it(`test throws an error when first argument isn't a string`, () => {
6666
expect(() => {
67-
// @ts-ignore: Easy, we're testing runtime errors here
67+
// @ts-expect-error: Easy, we're testing runtime errors here
6868
circusTest(() => {});
6969
}).toThrowError('Invalid first argument, () => {}. It must be a string.');
7070
});
7171
it('test throws an error when callback function is not a function', () => {
7272
expect(() => {
73-
// @ts-ignore: Easy, we're testing runtime errors here
73+
// @ts-expect-error: Easy, we're testing runtime errors here
7474
circusTest('test8', 'test8b');
7575
}).toThrowError(
7676
'Invalid second argument, test8b. It must be a callback function.',

packages/jest-circus/src/__tests__/circusItTodoTestError.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ aliasCircusIt();
2222
describe('test/it.todo error throwing', () => {
2323
it('todo throws error when given no arguments', () => {
2424
expect(() => {
25-
// @ts-ignore: Testing runtime errors here
25+
// @ts-expect-error: Testing runtime errors here
2626
circusIt.todo();
2727
}).toThrowError('Todo must be called with only a description.');
2828
});
@@ -33,7 +33,7 @@ describe('test/it.todo error throwing', () => {
3333
});
3434
it('todo throws error when given none string description', () => {
3535
expect(() => {
36-
// @ts-ignore: Testing runtime errors here
36+
// @ts-expect-error: Testing runtime errors here
3737
circusIt.todo(() => {});
3838
}).toThrowError('Todo must be called with only a description.');
3939
});

packages/jest-cli/src/__tests__/cli/args.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ describe('check', () => {
101101

102102
describe('buildArgv', () => {
103103
it('should return only camelcased args ', () => {
104-
// @ts-ignore
104+
// @ts-expect-error
105105
const mockProcessArgv = jest
106106
.spyOn(process.argv, 'slice')
107107
.mockImplementation(() => ['--clear-mocks']);
108-
// @ts-ignore
108+
// @ts-expect-error
109109
const actual = buildArgv(null);
110110
expect(actual).not.toHaveProperty('clear-mocks');
111111
expect(actual).toHaveProperty('clearMocks', true);

packages/jest-cli/src/init/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default async (
108108

109109
let promptAborted: boolean = false;
110110

111-
// @ts-ignore: Return type cannot be object - faulty typings
111+
// @ts-expect-error: Return type cannot be object - faulty typings
112112
const results: PromptsResults = await prompts(questions, {
113113
onCancel: () => {
114114
promptAborted = true;

packages/jest-config/src/__tests__/getMaxWorkers.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ describe('getMaxWorkers', () => {
3939
describe('% based', () => {
4040
it('50% = 2 workers', () => {
4141
const argv = {maxWorkers: '50%'};
42-
// @ts-ignore: need to fix the typing
42+
// @ts-expect-error: need to fix the typing
4343
expect(getMaxWorkers(argv)).toBe(2);
4444
});
4545

4646
it('< 0 workers should become 1', () => {
4747
const argv = {maxWorkers: '1%'};
48-
// @ts-ignore: need to fix the typing
48+
// @ts-expect-error: need to fix the typing
4949
expect(getMaxWorkers(argv)).toBe(1);
5050
});
5151

5252
it("0% shouldn't break", () => {
5353
const argv = {maxWorkers: '0%'};
54-
// @ts-ignore: need to fix the typing
54+
// @ts-expect-error: need to fix the typing
5555
expect(getMaxWorkers(argv)).toBe(1);
5656
});
5757
});

packages/jest-config/src/__tests__/readConfig.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {readConfig} from '../index';
1010
test('readConfig() throws when an object is passed without a file path', async () => {
1111
await expect(
1212
readConfig(
13-
// @ts-ignore
13+
// @ts-expect-error
1414
null /* argv */,
1515
{} /* packageRootOrConfig */,
1616
false /* skipArgvConfigOption */,

packages/jest-config/src/__tests__/readConfigs.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jest.mock('../readConfigFileAndSetRootDir', () => jest.fn(() => mockResult));
1919

2020
test('readConfigs() throws when called without project paths', async () => {
2121
await expect(
22-
// @ts-ignore
22+
// @ts-expect-error
2323
readConfigs(null /* argv */, [] /* projectPaths */),
2424
).rejects.toThrowError('jest: No configuration found for any project.');
2525
});
@@ -29,7 +29,7 @@ test('readConfigs() loads async config file', async () => {
2929
rootDir: './',
3030
}));
3131
await expect(
32-
// @ts-ignore
32+
// @ts-expect-error
3333
readConfigs(
3434
<Config.Argv>{} /* argv */,
3535
['./some-jest-config-file.js'] /* projectPaths */,
@@ -43,7 +43,7 @@ test('readConfigs() reject if async was rejected', async () => {
4343
throw new Error('Some error');
4444
});
4545
await expect(
46-
// @ts-ignore
46+
// @ts-expect-error
4747
readConfigs(
4848
<Config.Argv>{} /* argv */,
4949
['./some-jest-config-file.js'] /* projectPaths */,

0 commit comments

Comments
 (0)