Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dev-deps): jest 27 #278

Merged
merged 2 commits into from
Nov 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@tsconfig/node12": "^1.0.9",
"@types/babel__code-frame": "^7.0.2",
"@types/eslint": "^7.2.2",
"@types/jest": "^26.0.15",
"@types/jest": "^27.0.2",
"@types/node": "^15.0.0",
"@types/object-hash": "^2.1.0",
"@types/react": "^16.9.53",
Expand All @@ -67,13 +67,13 @@
"eslint-remote-tester-repositories": "^0.0.2",
"husky": "^7.0.2",
"ink-testing-library": "^2.1.0",
"jest": "^26.6.1",
"jest": "^27.3.1",
"lint-staged": "^11.1.2",
"node-pty": "^0.10.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"strip-ansi": "^6.0.0",
"ts-jest": "^26.4.4",
"ts-jest": "^27.0.7",
"tsc-alias": "^1.3.9",
"typescript": "^4.4.3"
},
Expand Down
9 changes: 7 additions & 2 deletions test/unit/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ const mockConfig = jest.fn().mockReturnValue(DEFAULT_CONFIGURATION);
jest.mock('../../eslint-remote-tester.config.js', () => mockConfig());

function getConfig(): Config {
jest.resetModules();
return require('../../lib/config/config').default;
let config: Config;

jest.isolateModules(() => {
config = require('../../lib/config/config').default;
});

return config!;
}

describe('config', () => {
Expand Down
1 change: 0 additions & 1 deletion test/unit/file-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ function createComparisonResults(): void {
function getCacheLocation() {
let location = '';

jest.resetModuleRegistry();
jest.isolateModules(() => {
location =
require('../../lib/file-client/file-constants').CACHE_LOCATION;
Expand Down
27 changes: 22 additions & 5 deletions test/unit/progress-logger.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
import ActualProgressLogger from '@progress-logger';
import ProgressLogger from '@progress-logger';
import { LogMessage } from '@progress-logger/types';
import { mockConfigValue, restoreMockConfig } from '__mocks__/@config';
import { getLastCallArguments } from '../utils';

jest.unmock('@progress-logger');

let ProgressLogger: typeof ActualProgressLogger;
// TODO: Use once isolateModules works with jest@27
// let ProgressLogger: typeof ActualProgressLogger;

beforeEach(() => {
restoreMockConfig();

jest.isolateModules(() => {
ProgressLogger = require('../../lib/progress-logger').default;
});
// TODO: Use once isolateModules works with jest@27
// jest.isolateModules(() => {
// ProgressLogger = require('../../lib/progress-logger').default;
// });
});

afterEach(() => {
// TODO Remove once isolateModules works with jest@27
(ProgressLogger as any).messages = [];
(ProgressLogger as any).tasks = [];
(ProgressLogger as any).scannedRepositories = 0;
(ProgressLogger as any).errorCount = 0;
(ProgressLogger as any).listeners = {
exit: [],
message: [],
task: [],
ciKeepAlive: [],
timeout: [],
};
});

test('listeners are notified about new messages', () => {
Expand Down
1 change: 0 additions & 1 deletion test/unit/repository-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ beforeEach(() => {
}

// Initialize client
jest.resetModuleRegistry();
jest.isolateModules(() => {
require('../../lib/file-client/repository-client');
});
Expand Down
Loading