Skip to content
Closed
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
24 changes: 18 additions & 6 deletions eslintrc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ module.exports = {
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/recommended-type-checked', // v8: renamed from recommended-requiring-type-checking
'plugin:security/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module', // Allows for the use of imports
project: './tsconfig.json',
projectService: true, // v8: replaces 'project' option
tsconfigRootDir: __dirname, // v8: required for projectService
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 8,
ecmaVersion: 2020, // v8: updated from 8 to 2020
},
plugins: ['react', '@typescript-eslint', 'security', 'import'],
settings: {
Expand Down Expand Up @@ -64,12 +65,16 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-types': 'off',
// v8: ban-types removed, replaced with more specific rules (all off to maintain current behavior)
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-wrapper-object-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
// v8: no-empty-interface replaced with no-empty-object-type (already off above)
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-var-requires': 'off',
// v8: no-var-requires replaced with no-require-imports
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
Expand All @@ -85,6 +90,8 @@ module.exports = {
'@typescript-eslint/no-implied-eval': 'off',
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/await-thenable': 'off',
// v8: Temporarily disabled due to potential issues during migration
'@typescript-eslint/no-duplicate-enum-values': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'react/no-unescaped-entities': 'off',
Expand All @@ -93,6 +100,11 @@ module.exports = {
'no-prototype-builtins': 'off',
},
overrides: [
{
// Disable type-checked rules for JS files not in tsconfig
files: ['*.js', '*.mjs', '*.cjs'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
},
{
files: ['src/tests/**/*', 'tools/**/*', 'pipeline/**/*', 'deploy/**/*', 'Gruntfile.js'],
rules: {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
"@types/ua-parser-js": "^0.7.39",
"@types/uuid": "^9.0.7",
"@types/webextension-polyfill": "^0.10.7",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^6.18.1",
"@typescript-eslint/eslint-plugin": "^8.46.2",
"@typescript-eslint/parser": "^8.46.2",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"codecov": "^3.8.3",
"commander": "^11.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { AssessmentsProvider } from 'assessments/types/assessments-provider';
import { GettingStarted, RequirementName } from 'common/types/store-data/assessment-result-data';
import { RequirementName } from 'common/types/store-data/assessment-result-data';
import { FeatureFlagStoreData } from 'common/types/store-data/feature-flag-store-data';
import { assessmentTestKeyGenerator } from 'DetailsView/components/left-nav/left-nav-link-builder';
import { VisualizationType } from '../../../common/types/visualization-type';
Expand All @@ -15,7 +15,7 @@ export type GetLeftNavSelectedKeyProps = {
visualizationType: VisualizationType;
assessmentsProvider: AssessmentsProvider;
featureFlagStoreData: FeatureFlagStoreData;
selectedSubview: RequirementName | GettingStarted;
selectedSubview: RequirementName; // GettingStarted is redundant as RequirementName is string
};

export function getOverviewKey(): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class TabStopsChoiceGroup extends React.Component<TabStopsChoiceGroupsPro
}

private renderAddFailureInstance(): JSX.Element | null {
return this.props.status === 'fail' ? (
return this.props.status === ('fail' as any) ? (
<IconButton
data-automation-id={addTabStopsFailureInstanceAutomationId}
iconProps={{ iconName: 'add' }}
Expand Down
2 changes: 1 addition & 1 deletion src/common/enum-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class EnumHelper {
}

if (!foundNumericKey) {
throw new Error(`No 'number' key found on ${enumType}`);
throw new Error(`No 'number' key found on ${JSON.stringify(enumType)}`);
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class AssessmentCardSelectionMessageCreatorWrapper implements CardSelecti
const assessmentStoreState = this.assessmentStore.getState();

if (assessmentStoreState == null) {
throw NO_ASSESSMENT_STORE_DATA_ERROR;
throw new Error(NO_ASSESSMENT_STORE_DATA_ERROR);
}

const selectedTest = assessmentStoreState.assessmentNavState.selectedTestType;
Expand Down
2 changes: 1 addition & 1 deletion src/common/types/store-data/assessment-result-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface TestStepResult {
}

export interface AssessmentNavState {
selectedTestSubview: RequirementName | GettingStarted;
selectedTestSubview: RequirementName; // GettingStarted is redundant as RequirementName is string
selectedTestType: VisualizationType;
expandedTestType?: VisualizationType;
}
Expand Down
3 changes: 1 addition & 2 deletions src/injected/frameCommunicators/axe-frame-messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ export class AxeFrameMessenger implements axe.FrameMessenger {
// This behavior of passing an Error object if the respondee throws an error is missing
// from the axe-core frame-messenger documentation, but it matches the default axe-core
// behavior.
const messageOrError: any | Error =
const messageOrError: any =
payload.type === 'success'
? payload.message
: new Error('An axe-core error occurred in a child frame.');

const keepalive = payload.type === 'success' ? payload.keepalive : false;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class BackchannelWindowMessageTranslator {
);
}

private tryParseJson(rawWindowMessage: unknown): any | null {
private tryParseJson(rawWindowMessage: unknown): any {
if (typeof rawWindowMessage !== 'string') {
return null;
}
Expand Down
7 changes: 6 additions & 1 deletion src/reports/assessment-json-export-json-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ function processFailedDetailsData(
requirement.instances.forEach(instance => {
const currentInstance: AssessmentJsonExportFailureInstance = {};
instance.props.forEach(prop => {
const propValueStr = prop.value?.toString() ?? '';
const propValueStr =
typeof prop.value === 'string' || typeof prop.value === 'number'
? String(prop.value)
: prop.value
? JSON.stringify(prop.value)
: '';
if (prop.key === 'Comment') {
currentInstance.comment = propValueStr;
} else if (prop.key === 'Path') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
import { CardsViewModel } from '../../../common/types/store-data/card-view-model';
import { UserConfigurationStoreData } from '../../../common/types/store-data/user-configuration-store';
import { ExpandPassSectionParameter } from '../../package/accessibilityInsightsReport';
import { IncompleteChecksSectionDeps } from './incomplete-checks-section';

Check failure on line 15 in src/reports/components/report-sections/report-section-factory.tsx

View workflow job for this annotation

GitHub Actions / build

'IncompleteChecksSectionDeps' is declared but its value is never read.

Check failure on line 15 in src/reports/components/report-sections/report-section-factory.tsx

View workflow job for this annotation

GitHub Actions / lints

'IncompleteChecksSectionDeps' is declared but its value is never read.
import { NotApplicableChecksSectionDeps } from './not-applicable-checks-section';
import { PassedChecksSectionDeps } from './passed-checks-section';

Check failure on line 17 in src/reports/components/report-sections/report-section-factory.tsx

View workflow job for this annotation

GitHub Actions / build

'PassedChecksSectionDeps' is declared but its value is never read.

Check failure on line 17 in src/reports/components/report-sections/report-section-factory.tsx

View workflow job for this annotation

GitHub Actions / lints

'PassedChecksSectionDeps' is declared but its value is never read.

export type SectionDeps = NotApplicableChecksSectionDeps &
CommonInstancesSectionDeps &
PassedChecksSectionDeps &
IncompleteChecksSectionDeps;
export type SectionDeps = NotApplicableChecksSectionDeps & CommonInstancesSectionDeps;

export type SectionProps = {
deps: SectionDeps;
Expand Down
2 changes: 1 addition & 1 deletion src/tests/common/typemoq-snapshot-serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const typemoqProxyIdValue = 'BCDF5CE5-F0DF-40B7-8BA0-69DF395033C8';

function readingPropertyThrowsMockException(val: Function): boolean {
try {
val['___any_property'];
void val['___any_property'];
} catch (e: any) {
if (e instanceof MockException) {
return true;
Expand Down
5 changes: 2 additions & 3 deletions src/tests/end-to-end/tests/details-view/overview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@ describe('Details View -> Overview Page', () => {
it.each([true, false])(
'should show correct number of items in export dropdown menu with codepen feature flag = %s',
async codepenFlag => {
codepenFlag
void (codepenFlag
? await backgroundContext.enableFeatureFlag('exportReportOptions')
: await backgroundContext.disableFeatureFlag('exportReportOptions');

: await backgroundContext.disableFeatureFlag('exportReportOptions'));
await overviewPage.openExportDropdown();
const items = (await overviewPage.countMenuItems()).valueOf();
await overviewPage.closeExportDialog();
Expand Down
8 changes: 4 additions & 4 deletions src/tests/end-to-end/tests/popup/hamburger-menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ describe('Popup -> Hamburger menu', () => {
'should have content matching snapshot when quickAssess feature flag is %s',
async quickAssessFeatureFlag => {
const backgroundContext = await browser.background();
quickAssessFeatureFlag === true
void (quickAssessFeatureFlag === true
? await backgroundContext.enableFeatureFlag('quickAssess')
: await backgroundContext.disableFeatureFlag('quickAssess');
: await backgroundContext.disableFeatureFlag('quickAssess'));
const button = await popupPage.getSelectorElement(
popupPageElementIdentifiers.hamburgerMenuButton,
);
Expand All @@ -57,9 +57,9 @@ describe('Popup -> Hamburger menu', () => {
async ({ highContrastMode, quickAssessFeatureFlag }) => {
await browser.setHighContrastMode(highContrastMode);
const backgroundContext = await browser.background();
quickAssessFeatureFlag === true
void (quickAssessFeatureFlag === true
? await backgroundContext.enableFeatureFlag('quickAssess')
: await backgroundContext.disableFeatureFlag('quickAssess');
: await backgroundContext.disableFeatureFlag('quickAssess'));
await popupPage.waitForHighContrastMode(highContrastMode);

const button = await popupPage.getSelectorElement(
Expand Down
8 changes: 4 additions & 4 deletions src/tests/end-to-end/tests/popup/launchpad.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ describe('Popup -> Launch Pad', () => {
'content should match snapshot when quick assess feature flag is %s',
async quickAssessFeatureFlag => {
const backgroundContext = await browser.background();
quickAssessFeatureFlag === true
void (quickAssessFeatureFlag === true
? await backgroundContext.enableFeatureFlag('quickAssess')
: await backgroundContext.disableFeatureFlag('quickAssess');
: await backgroundContext.disableFeatureFlag('quickAssess'));
const element = await formatPageElementForSnapshot(
popupPage,
popupPageElementIdentifiers.launchPad,
Expand All @@ -49,9 +49,9 @@ describe('Popup -> Launch Pad', () => {
'should pass accessibility validation with highContrastMode=%s and quickAssessFeatureFlag=%s',
async ({ highContrastMode, quickAssessFeatureFlag }) => {
const backgroundContext = await browser.background();
quickAssessFeatureFlag === true
void (quickAssessFeatureFlag === true
? await backgroundContext.enableFeatureFlag('quickAssess')
: await backgroundContext.disableFeatureFlag('quickAssess');
: await backgroundContext.disableFeatureFlag('quickAssess'));
await browser.setHighContrastMode(highContrastMode);
await popupPage.waitForHighContrastMode(highContrastMode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe('Target Page window.postMessage behavior', () => {
);
}

function tryJsonParse(maybeJsonString: any): any | null {
function tryJsonParse(maybeJsonString: any): any {
if (typeof maybeJsonString !== 'string') {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tests/unit/mock-helpers/mock-module-helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ export function mockReactComponent<T extends React.ComponentClass<P>, P = any>(
}

function expectMockedComponentPropsToMatchSnapshot(component: any, snapshotName?: string) {
snapshotName !== undefined
void (snapshotName !== undefined
? expect(getMockComponentClassPropsForCall(component as any)).toMatchSnapshot(snapshotName)
: expect(getMockComponentClassPropsForCall(component as any)).toMatchSnapshot();
: expect(getMockComponentClassPropsForCall(component as any)).toMatchSnapshot());
}

function mockReactElement<P = any>(elementName: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('AssessmentInstanceDetailsColumn', () => {
}),
);

props.labelText ? expect(hasLabel).toEqual(true) : expect(hasLabel).toEqual(false);
void (props.labelText ? expect(hasLabel).toEqual(true) : expect(hasLabel).toEqual(false));
expect(!isNull(wrapper.container.querySelector('.ms-TooltipHost'))).toBe(true);
expect(
!isNull(wrapper.container.querySelector(`.${styles.assessmentInstanceTextContent}`)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ describe('DetailsViewCommandBar', () => {
useOriginalReactElements('DetailsView/components/quick-assess-to-assessment-dialog', [
'QuickAssessToAssessmentDialog',
]);
useOriginalReactElements;
void useOriginalReactElements;
const props = getProps(['CommandBar']);
let setRef;
transferToAssessmentButtonFactoryMock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
expectMockedComponentPropsToMatchSnapshots([ActionButton, FlaggedComponent]);
fireEvent.click(renderResult.getByRole('button'));

expect(renderResult.container.querySelector('.failureInstancePanel')).not.toBeNull;
expect(renderResult.container.querySelector('.failureInstancePanel')).not.toBeNull();

Check failure on line 184 in src/tests/unit/tests/DetailsView/components/failure-instance-panel-control.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests (1/2)

FailureInstancePanelControlTest › openFailureInstancePanel

expect(received).not.toBeNull() Received: null at Object.toBeNull (src/tests/unit/tests/DetailsView/components/failure-instance-panel-control.test.tsx:184:83)
const failureDescription = renderResult.getByLabelText('Comment') as HTMLInputElement;
expect(failureDescription.value).toEqual(props.failureInstance.failureDescription);
const pathField = renderResult.getByLabelText('CSS Selector') as HTMLInputElement;
Expand Down Expand Up @@ -212,7 +212,7 @@
const textField = renderResult.getByRole('textbox') as HTMLInputElement;
fireEvent.change(textField, { target: { value: description } });
fireEvent.click(renderResult.getByText('Save'));
expect(renderResult.container.querySelector('.failureInstancePanel')).not.toBeNull;
expect(renderResult.container.querySelector('.failureInstancePanel')).not.toBeNull();

Check failure on line 215 in src/tests/unit/tests/DetailsView/components/failure-instance-panel-control.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests (1/2)

FailureInstancePanelControlTest › onSaveEditedFailureInstance

expect(received).not.toBeNull() Received: null at Object.toBeNull (src/tests/unit/tests/DetailsView/components/failure-instance-panel-control.test.tsx:215:83)
editInstanceMock.verifyAll();
clearPathSnippetDataMock.verify(handler => handler(), Times.exactly(2));
});
Expand All @@ -237,7 +237,7 @@
const textField = renderResult.getByRole('textbox') as HTMLInputElement;
fireEvent.change(textField, { target: { value: description } });
fireEvent.click(renderResult.getByText('Add failed instance'));
expect(renderResult.container.querySelector('.failureInstancePanel')).not.toBeNull;
expect(renderResult.container.querySelector('.failureInstancePanel')).not.toBeNull();

Check failure on line 240 in src/tests/unit/tests/DetailsView/components/failure-instance-panel-control.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests (1/2)

FailureInstancePanelControlTest › onAddFailureInstance

expect(received).not.toBeNull() Received: null at Object.toBeNull (src/tests/unit/tests/DetailsView/components/failure-instance-panel-control.test.tsx:240:83)
addInstanceMock.verifyAll();
clearPathSnippetDataMock.verify(handler => handler(), Times.exactly(2));
});
Expand Down
10 changes: 5 additions & 5 deletions src/tests/unit/tests/assessments/report-instance-field.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ describe('ReportInstanceField', () => {
});

describe('fromPropertyBagFunction', () => {
const field = ReportInstanceField.fromPropertyBagFunction<Bag>(
'Three',
'three',
b => b.one + ' + ' + b.two,
);
const field = ReportInstanceField.fromPropertyBagFunction<Bag>('Three', 'three', b => {
const oneStr = typeof b.one === 'object' ? JSON.stringify(b.one) : String(b.one ?? '');
const twoStr = typeof b.two === 'object' ? JSON.stringify(b.two) : String(b.two ?? '');
return oneStr + ' + ' + twoStr;
});

it('returns key', () => {
expect(field.key).toEqual('three');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,7 @@ describe('ActionCreatorTest', () => {
'PreviewFeatures',
)
.setupTelemetrySend(TelemetryEvents.PIVOT_CHILD_SELECTED, actionCreatorPayload, 1)
.setupShowDetailsView(
tabId,
Promise.reject({ message: showDetailsViewErrorMessage }),
)
.setupShowDetailsView(tabId, Promise.reject(new Error(showDetailsViewErrorMessage)))
.setupLogError(showDetailsViewErrorMessage);

const actionCreator = validator.buildActionCreator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
const errorMessage = 'error on showDetailsView';
detailsViewControllerMock
.setup(controller => controller.showDetailsView(tabId))
.returns(() => Promise.reject(errorMessage))
.returns(() => Promise.reject(new Error(errorMessage)))
.verifiable(Times.once());

testSubject.registerCallbacks();
Expand All @@ -75,7 +75,7 @@
handler => handler.publishTelemetry(CONTENT_PANEL_OPENED, payload),
Times.once(),
);
loggerMock.verify(logger => logger.error(errorMessage), Times.once());

Check failure on line 78 in src/tests/unit/tests/background/actions/content-action-creator.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests (1/2)

ContentActionMessageCreator › handles OpenPanel message › when showing the details view throws an error

MockException: expected invocation of Function(It.isValue("error on showDetailsView")) exactly 1 times, invoked 0 times Configured setups: Function(It.isValue("error on showDetailsView")) Performed invocations: Function({}) at MockException.Exception [as constructor] (node_modules/typemoq/dist/Error/Error/Error/Exception.ts:3:9) at new MockException (node_modules/typemoq/dist/Error/Error/Error/MockException.ts:20:9) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.throwVerifyCallCountException (node_modules/typemoq/dist/InterceptorExecute.ts:75:17) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.verifyCallCount (node_modules/typemoq/dist/InterceptorExecute.ts:64:18) at DynamicMock.Object.<anonymous>.DynamicMock.verify (node_modules/typemoq/dist/DynamicMock.ts:44:31) at Object.verify (src/tests/unit/tests/background/actions/content-action-creator.test.ts:78:24)
});

it('when there is no error from showing the details view', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

detailsViewControllerMock
.setup(controller => controller.showDetailsView(tabId))
.returns(() => Promise.reject(errorMessage))
.returns(() => Promise.reject(new Error(errorMessage)))
.verifiable(Times.once());

const loggerMock = Mock.ofType<Logger>();
Expand All @@ -124,7 +124,7 @@
handler => handler.publishTelemetry(telemetryEventName, defaultBasePayload),
Times.once(),
);
loggerMock.verify(logger => logger.error(errorMessage), Times.once());

Check failure on line 127 in src/tests/unit/tests/background/actions/details-view-action-creator.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests (2/2)

DetailsViewActionCreatorTest › handles open side panel message › Messages.Scoping.OpenPanel › when showDetailsView fails

MockException: expected invocation of Function(It.isValue("error on showDetailsView")) exactly 1 times, invoked 0 times Configured setups: Function(It.isValue("error on showDetailsView")) Performed invocations: Function({}) at MockException.Exception [as constructor] (node_modules/typemoq/dist/Error/Error/Error/Exception.ts:3:9) at new MockException (node_modules/typemoq/dist/Error/Error/Error/MockException.ts:20:9) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.throwVerifyCallCountException (node_modules/typemoq/dist/InterceptorExecute.ts:75:17) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.verifyCallCount (node_modules/typemoq/dist/InterceptorExecute.ts:64:18) at DynamicMock.Object.<anonymous>.DynamicMock.verify (node_modules/typemoq/dist/DynamicMock.ts:44:31) at Object.verify (src/tests/unit/tests/background/actions/details-view-action-creator.test.ts:127:28)

Check failure on line 127 in src/tests/unit/tests/background/actions/details-view-action-creator.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests (2/2)

DetailsViewActionCreatorTest › handles open side panel message › Messages.PreviewFeatures.OpenPanel › when showDetailsView fails

MockException: expected invocation of Function(It.isValue("error on showDetailsView")) exactly 1 times, invoked 0 times Configured setups: Function(It.isValue("error on showDetailsView")) Performed invocations: Function({}) at MockException.Exception [as constructor] (node_modules/typemoq/dist/Error/Error/Error/Exception.ts:3:9) at new MockException (node_modules/typemoq/dist/Error/Error/Error/MockException.ts:20:9) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.throwVerifyCallCountException (node_modules/typemoq/dist/InterceptorExecute.ts:75:17) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.verifyCallCount (node_modules/typemoq/dist/InterceptorExecute.ts:64:18) at DynamicMock.Object.<anonymous>.DynamicMock.verify (node_modules/typemoq/dist/DynamicMock.ts:44:31) at Object.verify (src/tests/unit/tests/background/actions/details-view-action-creator.test.ts:127:28)

Check failure on line 127 in src/tests/unit/tests/background/actions/details-view-action-creator.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests (2/2)

DetailsViewActionCreatorTest › handles open side panel message › Messages.SettingsPanel.OpenPanel › when showDetailsView fails

MockException: expected invocation of Function(It.isValue("error on showDetailsView")) exactly 1 times, invoked 0 times Configured setups: Function(It.isValue("error on showDetailsView")) Performed invocations: Function({}) at MockException.Exception [as constructor] (node_modules/typemoq/dist/Error/Error/Error/Exception.ts:3:9) at new MockException (node_modules/typemoq/dist/Error/Error/Error/MockException.ts:20:9) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.throwVerifyCallCountException (node_modules/typemoq/dist/InterceptorExecute.ts:75:17) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.verifyCallCount (node_modules/typemoq/dist/InterceptorExecute.ts:64:18) at DynamicMock.Object.<anonymous>.DynamicMock.verify (node_modules/typemoq/dist/DynamicMock.ts:44:31) at Object.verify (src/tests/unit/tests/background/actions/details-view-action-creator.test.ts:127:28)
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
const dummyError = 'test-dummy-error';
browserAdapterMock
.setup(adapter => adapter.switchToTab(tabId))
.returns(() => Promise.reject(dummyError));
.returns(() => Promise.reject(new Error(dummyError)));

testSubject.registerCallbacks();

Expand All @@ -106,7 +106,7 @@
);

changeInspectModeMock.verifyAll();
loggerMock.verify(

Check failure on line 109 in src/tests/unit/tests/background/actions/inspect-action-creator.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests (2/2)

InspectActionCreator › handles ChangeInspectMode message › logs error when switch to tab fails

MockException: expected invocation of Function(It.isValue("switchToTab failed"),It.isValue("test-dummy-error")) exactly 1 times, invoked 0 times Configured setups: Function(It.isValue("switchToTab failed"),It.isValue("test-dummy-error")) Performed invocations: Function("switchToTab failed",{}) at MockException.Exception [as constructor] (node_modules/typemoq/dist/Error/Error/Error/Exception.ts:3:9) at new MockException (node_modules/typemoq/dist/Error/Error/Error/MockException.ts:20:9) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.throwVerifyCallCountException (node_modules/typemoq/dist/InterceptorExecute.ts:75:17) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.verifyCallCount (node_modules/typemoq/dist/InterceptorExecute.ts:64:18) at DynamicMock.Object.<anonymous>.DynamicMock.verify (node_modules/typemoq/dist/DynamicMock.ts:44:31) at Object.verify (src/tests/unit/tests/background/actions/inspect-action-creator.test.ts:109:24)
logger => logger.error(`switchToTab failed`, dummyError),
Times.once(),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,16 @@
const errorMessage = 'dummy error';
shortcutsPageControllerMock
.setup(controller => controller.openShortcutsTab())
.returns(() => Promise.reject(errorMessage));
.returns(() => Promise.reject(new Error(errorMessage)));

testSubject.registerCallbacks();

await flushSettledPromises();

telemetryHandlerMock.verify(
handler => handler.publishTelemetry(SHORTCUT_CONFIGURE_OPEN, payload),
Times.once(),
);
loggerMock.verify(logger => logger.error(errorMessage), Times.once());

Check failure on line 95 in src/tests/unit/tests/background/actions/shortcuts-page-action-creator.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests (1/2)

ShortcutsPageActionCreator › handles ConfigureShortcuts message › sends telemetry › when opening shortcuts tab fails

MockException: expected invocation of Function(It.isValue("dummy error")) exactly 1 times, invoked 0 times Configured setups: Function(It.isValue("dummy error")) Performed invocations: Function({}) at MockException.Exception [as constructor] (node_modules/typemoq/dist/Error/Error/Error/Exception.ts:3:9) at new MockException (node_modules/typemoq/dist/Error/Error/Error/MockException.ts:20:9) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.throwVerifyCallCountException (node_modules/typemoq/dist/InterceptorExecute.ts:75:17) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.verifyCallCount (node_modules/typemoq/dist/InterceptorExecute.ts:64:18) at DynamicMock.Object.<anonymous>.DynamicMock.verify (node_modules/typemoq/dist/DynamicMock.ts:44:31) at Object.verify (src/tests/unit/tests/background/actions/shortcuts-page-action-creator.test.ts:95:28)
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
const dummyError = 'switch to tab dummy error';
browserAdapterMock
.setup(adapter => adapter.switchToTab(tabIdStub))
.returns(() => Promise.reject(dummyError));
.returns(() => Promise.reject(new Error(dummyError)));

testSubject.registerCallbacks();

Expand All @@ -193,7 +193,7 @@
tp => tp.publishTelemetry(SWITCH_BACK_TO_TARGET, payload),
Times.once(),
);
loggerMock.verify(

Check failure on line 196 in src/tests/unit/tests/background/actions/tab-action-creator.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests (1/2)

TabActionCreator › handles Tab.Switch message › logs error when switch to tab fails

MockException: expected invocation of Function(It.isValue("switchToTab failed: switch to tab dummy error"),It.isValue("switch to tab dummy error")) exactly 1 times, invoked 0 times Configured setups: Function(It.isValue("switchToTab failed: switch to tab dummy error"),It.isValue("switch to tab dummy error")) Performed invocations: Function("switchToTab failed: Error: switch to tab dummy error",{}) at MockException.Exception [as constructor] (node_modules/typemoq/dist/Error/Error/Error/Exception.ts:3:9) at new MockException (node_modules/typemoq/dist/Error/Error/Error/MockException.ts:20:9) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.throwVerifyCallCountException (node_modules/typemoq/dist/InterceptorExecute.ts:75:17) at InterceptorExecute.Object.<anonymous>.InterceptorExecute.verifyCallCount (node_modules/typemoq/dist/InterceptorExecute.ts:64:18) at DynamicMock.Object.<anonymous>.DynamicMock.verify (node_modules/typemoq/dist/DynamicMock.ts:44:31) at Object.verify (src/tests/unit/tests/background/actions/tab-action-creator.test.ts:196:24)
logger => logger.error(`switchToTab failed: ${dummyError}`, dummyError),
Times.once(),
);
Expand Down
Loading
Loading