diff --git a/Makefile b/Makefile index f508269de7a..68e4e98e350 100755 --- a/Makefile +++ b/Makefile @@ -256,7 +256,7 @@ circular-dependencies-js: .PHONY: test-js-internal test-js-internal: - yarn jest $(tests) $(test_opts) $(cov_opts) + yarn vitest $(tests) $(test_opts) $(cov_opts) .PHONY: test-js-% test-js-%: diff --git a/app-shell/src/config/actions.ts b/app-shell/src/config/actions.ts index c2aadd1df2b..ef1958044f6 100644 --- a/app-shell/src/config/actions.ts +++ b/app-shell/src/config/actions.ts @@ -75,6 +75,12 @@ import { USB_HTTP_REQUESTS_STOP, VALUE_UPDATED, VIEW_PROTOCOL_SOURCE_FOLDER, + NOTIFY_SUBSCRIBE, + NOTIFY_UNSUBSCRIBE, + ROBOT_MASS_STORAGE_DEVICE_ADDED, + ROBOT_MASS_STORAGE_DEVICE_ENUMERATED, + ROBOT_MASS_STORAGE_DEVICE_REMOVED, + UPDATE_BRIGHTNESS, } from '../constants' import type { InitializedAction, @@ -102,14 +108,6 @@ import type { UpdateBrightnessAction, UsbRequestsAction, } from '@opentrons/app/src/redux/shell/types' -import type { - NOTIFY_SUBSCRIBE, - NOTIFY_UNSUBSCRIBE, - ROBOT_MASS_STORAGE_DEVICE_ADDED, - ROBOT_MASS_STORAGE_DEVICE_ENUMERATED, - ROBOT_MASS_STORAGE_DEVICE_REMOVED, - UPDATE_BRIGHTNESS, -} from '@opentrons/app/src/redux/shell/actions' // config file has been initialized export const configInitialized = (config: Config): ConfigInitializedAction => ({ diff --git a/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpace.tsx b/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpace.tsx index 6d2ddb027dc..0ed3c523294 100644 --- a/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpace.tsx +++ b/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpace.tsx @@ -15,7 +15,6 @@ export function RobotCoordinateSpace( ...restProps, } return animated ? ( - // @ts-expect-error Type instantiation is excessively deep and possibly infinite {children} ) : ( {children} @@ -25,4 +24,5 @@ export function RobotCoordinateSpace( /** * These animated components needs to be split out because react-spring and styled-components don't play nice * @see https://github.com/pmndrs/react-spring/issues/1515 */ +// @ts-expect-error Type instantiation is excessively deep and possibly infinite const AnimatedSvg = styled(animated.svg)`` diff --git a/labware-library/src/labware-creator/__tests__/labwareDefToFields.test.ts b/labware-library/src/labware-creator/__tests__/labwareDefToFields.test.ts index 71ed638364b..d8569476b66 100644 --- a/labware-library/src/labware-creator/__tests__/labwareDefToFields.test.ts +++ b/labware-library/src/labware-creator/__tests__/labwareDefToFields.test.ts @@ -12,7 +12,7 @@ vi.mock('../../definitions') describe('labwareDefToFields', () => { it('fixture_96_plate', () => { const def = fixture_96_plate - const result = labwareDefToFields(def) + const result = labwareDefToFields(def as any) expect(result).toEqual({ labwareType: 'wellPlate', tubeRackInsertLoadName: null, @@ -59,7 +59,7 @@ describe('labwareDefToFields', () => { it('fixture_12_trough', () => { // make sure rectangular wells + single row works as expected const def = fixture_12_trough - const result = labwareDefToFields(def) + const result = labwareDefToFields(def as any) expect(result?.labwareType).toEqual('reservoir') expect(result?.gridSpacingY).toBe(null) // single row -> null Y-spacing @@ -69,13 +69,13 @@ describe('labwareDefToFields', () => { it('fixture_irregular_example_1 should return null (until multi-grid labware is supported in LC)', () => { const def = fixture_irregular_example_1 - const result = labwareDefToFields(def) + const result = labwareDefToFields(def as any) expect(result).toEqual(null) }) it('fixture_24_tuberack should match snapshot', () => { const def = fixture_24_tuberack - const result = labwareDefToFields(def) + const result = labwareDefToFields(def as any) expect(result?.labwareType).toEqual('tubeRack') expect(result?.brand).toBe('Opentrons') diff --git a/labware-library/src/labware-creator/__tests__/loadAndSaveIntegration.test.ts b/labware-library/src/labware-creator/__tests__/loadAndSaveIntegration.test.ts index dbf3f9e7442..0a9bb1c1cc8 100644 --- a/labware-library/src/labware-creator/__tests__/loadAndSaveIntegration.test.ts +++ b/labware-library/src/labware-creator/__tests__/loadAndSaveIntegration.test.ts @@ -23,19 +23,19 @@ describe('load and immediately save integrity test', () => { // (without these fields, Yup schema cast would fail) const testCases = [ { - inputDef: fixture_96_plate, + inputDef: fixture_96_plate as LabwareDefinition2, extraFields: { pipetteName }, }, { - inputDef: fixture_12_trough, + inputDef: fixture_12_trough as LabwareDefinition2, extraFields: { pipetteName }, }, { - inputDef: fixture_tiprack_300_ul, + inputDef: fixture_tiprack_300_ul as LabwareDefinition2, extraFields: { pipetteName }, }, { - inputDef: fixture_24_tuberack, + inputDef: fixture_24_tuberack as LabwareDefinition2, extraFields: { pipetteName, tubeRackInsertLoadName: 'customTubeRack' }, }, ] diff --git a/protocol-designer/src/components/FilePage.tsx b/protocol-designer/src/components/FilePage.tsx index 485f965b896..884aef8e5cd 100644 --- a/protocol-designer/src/components/FilePage.tsx +++ b/protocol-designer/src/components/FilePage.tsx @@ -15,7 +15,6 @@ import { InputField, } from '@opentrons/components' import { resetScrollElements } from '../ui/steps/utils' -import { Portal } from './portals/MainPageModalPortal' import { EditModulesCard } from './modules' import { EditModules } from './EditModules' diff --git a/protocol-designer/src/components/FileSidebar/FileSidebar.tsx b/protocol-designer/src/components/FileSidebar/FileSidebar.tsx index b28a30a2acf..cecb57422db 100644 --- a/protocol-designer/src/components/FileSidebar/FileSidebar.tsx +++ b/protocol-designer/src/components/FileSidebar/FileSidebar.tsx @@ -18,7 +18,7 @@ import { selectors as stepFormSelectors } from '../../step-forms' import { getRobotType } from '../../file-data/selectors' import { getAdditionalEquipment } from '../../step-forms/selectors' import { resetScrollElements } from '../../ui/steps/utils' -import { Portal, getMainPagePortalEl } from '../portals/MainPageModalPortal' +import { getMainPagePortalEl } from '../portals/MainPageModalPortal' import { useBlockingHint } from '../Hints/useBlockingHint' import { KnowledgeBaseLink } from '../KnowledgeBaseLink' import { diff --git a/protocol-designer/src/components/IngredientsList/LabwareDetailsCard/LabwareDetailsCard.tsx b/protocol-designer/src/components/IngredientsList/LabwareDetailsCard/LabwareDetailsCard.tsx index 2272301a985..46abd882ef9 100644 --- a/protocol-designer/src/components/IngredientsList/LabwareDetailsCard/LabwareDetailsCard.tsx +++ b/protocol-designer/src/components/IngredientsList/LabwareDetailsCard/LabwareDetailsCard.tsx @@ -63,7 +63,11 @@ export function LabwareDetailsCard(): JSX.Element { {t('generic.nickname')} diff --git a/protocol-designer/src/components/LiquidPlacementModal.tsx b/protocol-designer/src/components/LiquidPlacementModal.tsx index d5184173f6b..bd7e95a02aa 100644 --- a/protocol-designer/src/components/LiquidPlacementModal.tsx +++ b/protocol-designer/src/components/LiquidPlacementModal.tsx @@ -19,7 +19,7 @@ import { WellSelectionInstructions } from './WellSelectionInstructions' import styles from './LiquidPlacementModal.module.css' -export function LiquidPlacementModal(): JSX.Element { +export function LiquidPlacementModal(): JSX.Element | null { const [highlightedWells, setHighlightedWells] = React.useState< WellGroup | {} >({}) @@ -37,6 +37,7 @@ export function LiquidPlacementModal(): JSX.Element { false, 'LiquidPlacementModal: No labware is selected, and no labwareId was given to LiquidPlacementModal' ) + return null } const labwareDef = labwareEntities[labwareId]?.def diff --git a/protocol-designer/src/components/modals/CreateFileWizard/__tests__/MetadataTile.test.tsx b/protocol-designer/src/components/modals/CreateFileWizard/__tests__/MetadataTile.test.tsx index 40d22527cf5..eb711bf132a 100644 --- a/protocol-designer/src/components/modals/CreateFileWizard/__tests__/MetadataTile.test.tsx +++ b/protocol-designer/src/components/modals/CreateFileWizard/__tests__/MetadataTile.test.tsx @@ -27,7 +27,7 @@ const mockWizardTileProps: Partial = { goBack: vi.fn(), proceed: vi.fn(), watch: vi.fn((name: keyof typeof values) => values[name]) as any, - register: vi.fn(), + register: vi.fn() as any, formState: { errors: { fields: { name: null } }, touchedFields: { fields: { name: true } }, diff --git a/protocol-designer/src/components/modals/FileUploadMessageModal/modalContents.tsx b/protocol-designer/src/components/modals/FileUploadMessageModal/modalContents.tsx index cb323c80ce4..f09052a5c5f 100644 --- a/protocol-designer/src/components/modals/FileUploadMessageModal/modalContents.tsx +++ b/protocol-designer/src/components/modals/FileUploadMessageModal/modalContents.tsx @@ -195,7 +195,6 @@ export function useModalContents( false, `invalid messageKey ${uploadResponse.messageKey} specified for modal` ) - // @ts-expect-error (ce, 2021-06-23) the case below will never happened, as we've already narrowed all posibilities return { title: '', body: uploadResponse.messageKey } } } diff --git a/protocol-designer/src/timelineMiddleware/__tests__/generateRobotStateTimeline.test.ts b/protocol-designer/src/timelineMiddleware/__tests__/generateRobotStateTimeline.test.ts index 02f713835b3..dc4589e8515 100644 --- a/protocol-designer/src/timelineMiddleware/__tests__/generateRobotStateTimeline.test.ts +++ b/protocol-designer/src/timelineMiddleware/__tests__/generateRobotStateTimeline.test.ts @@ -130,8 +130,8 @@ describe('generateRobotStateTimeline', () => { ) // NOTE: if you update this snapshot, make sure this it exhibits eager tip dropping expect(commandOverview).toMatchInlineSnapshot(` - Array [ - Array [ + [ + [ "pickUpTip", "aspirate", "dispense", @@ -140,14 +140,14 @@ describe('generateRobotStateTimeline', () => { "moveToAddressableAreaForDropTip", "dropTipInPlace", ], - Array [ + [ "pickUpTip", "aspirate", "dispense", "moveToAddressableAreaForDropTip", "dropTipInPlace", ], - Array [ + [ "pickUpTip", "aspirate", "dispense", diff --git a/protocol-designer/src/timelineMiddleware/generateRobotStateTimeline.ts b/protocol-designer/src/timelineMiddleware/generateRobotStateTimeline.ts index 9af82141b7c..308c780b150 100644 --- a/protocol-designer/src/timelineMiddleware/generateRobotStateTimeline.ts +++ b/protocol-designer/src/timelineMiddleware/generateRobotStateTimeline.ts @@ -22,7 +22,6 @@ export interface GenerateRobotStateTimelineArgs { export const generateRobotStateTimeline = ( args: GenerateRobotStateTimelineArgs ): StepGeneration.Timeline => { - console.log('got to generateRobotStateTimeline') const { allStepArgsAndErrors, orderedStepIds, diff --git a/protocol-designer/tsconfig-data.json b/protocol-designer/tsconfig-data.json index 1aad3b0f529..79a9673faa9 100644 --- a/protocol-designer/tsconfig-data.json +++ b/protocol-designer/tsconfig-data.json @@ -7,6 +7,6 @@ "rootDir": ".", "outDir": "lib" }, - "include": ["src/**/*.json", "fixtures/**/*.json"], + "include": ["src/**/*.json", "fixtures/**/*.json", "vite.config.ts"], "exclude": ["**/*.ts", "**/*.tsx"] } diff --git a/protocol-designer/tsconfig.json b/protocol-designer/tsconfig.json index 4a7f7ac1673..6a2a9eac5bd 100644 --- a/protocol-designer/tsconfig.json +++ b/protocol-designer/tsconfig.json @@ -12,8 +12,7 @@ }, { "path": "../step-generation" - }, - { "path": "./tsconfig.node.json" } + } ], "compilerOptions": { "rootDir": "src", diff --git a/protocol-designer/tsconfig.node.json b/protocol-designer/tsconfig.node.json deleted file mode 100644 index ebe804848f5..00000000000 --- a/protocol-designer/tsconfig.node.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "composite": true, - "skipLibCheck": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true - }, - "include": ["vite.config.ts"] -} diff --git a/protocol-designer/typings/global.d.ts b/protocol-designer/typings/global.d.ts index 9fe08d2ebd8..2d45e0b9aaa 100644 --- a/protocol-designer/typings/global.d.ts +++ b/protocol-designer/typings/global.d.ts @@ -1,12 +1,12 @@ -declare global { - interface Global { - document: { - getElementsByClassName: (val: string) => any[] - } - enablePrereleaseMode: () => void +declare const global: typeof globalThis & { + document: { + getElementsByClassName: (val: string) => any[] } + enablePrereleaseMode: () => void + } + interface Window { __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: (val: string) => any } \ No newline at end of file diff --git a/step-generation/src/fixtures/commandFixtures.ts b/step-generation/src/fixtures/commandFixtures.ts index 2948525d24d..2c38a361ee7 100644 --- a/step-generation/src/fixtures/commandFixtures.ts +++ b/step-generation/src/fixtures/commandFixtures.ts @@ -1,5 +1,12 @@ import { expect } from 'vitest' -import { tiprackWellNamesFlat } from './data' +import { + tiprackWellNamesFlat, + DEFAULT_PIPETTE, + SOURCE_LABWARE, + AIR_GAP_META, + DEFAULT_BLOWOUT_WELL, + DEST_LABWARE, +} from './data' import { AddressableAreaName, AspDispAirgapParams, @@ -89,17 +96,6 @@ export const getFlowRateAndOffsetParamsMix = (): FlowRateAndOffsetParamsMix => ( // for mix only touchTipMmFromBottom: TOUCH_TIP_OFFSET_FROM_BOTTOM_MM, }) -// ================= -export const DEFAULT_PIPETTE = 'p300SingleId' -export const MULTI_PIPETTE = 'p300MultiId' -export const PIPETTE_96 = 'p100096Id' -export const SOURCE_LABWARE = 'sourcePlateId' -export const DEST_LABWARE = 'destPlateId' -export const TROUGH_LABWARE = 'troughId' -export const DEFAULT_BLOWOUT_WELL = 'A1' -export const TIPRACK_1 = 'tiprack1Id' -export const AIR_GAP_META = { isAirGap: true } // to differentiate if the aspirate or dispense command is an air gap or not -// ================= type MakeAspDispHelper

= ( bakedParams?: Partial

) => (well: string, volume: number, params?: Partial

) => CreateCommand diff --git a/step-generation/src/fixtures/index.ts b/step-generation/src/fixtures/index.ts index ed7f6c08311..be0ce610c9c 100644 --- a/step-generation/src/fixtures/index.ts +++ b/step-generation/src/fixtures/index.ts @@ -1,2 +1,3 @@ export * from './robotStateFixtures' export * from './commandFixtures' +export * from './data' diff --git a/step-generation/src/index.ts b/step-generation/src/index.ts index 36c4b115386..7b918ed0c68 100644 --- a/step-generation/src/index.ts +++ b/step-generation/src/index.ts @@ -30,3 +30,4 @@ export * from './types' export * from './constants' export * from './getNextRobotStateAndWarnings' export * from './fixtures/robotStateFixtures' +export * from './fixtures/data' diff --git a/step-generation/src/utils/index.ts b/step-generation/src/utils/index.ts index a5df9164f09..ac363cbcd97 100644 --- a/step-generation/src/utils/index.ts +++ b/step-generation/src/utils/index.ts @@ -5,6 +5,7 @@ import { reduceCommandCreators } from './reduceCommandCreators' import { modulePipetteCollision } from './modulePipetteCollision' import { thermocyclerPipetteCollision } from './thermocyclerPipetteCollision' import { getLabwareSlot } from './getLabwareSlot' +import { movableTrashCommandsUtil } from './movableTrashCommandsUtil' export { commandCreatorsTimeline, @@ -13,6 +14,7 @@ export { modulePipetteCollision, thermocyclerPipetteCollision, getLabwareSlot, + movableTrashCommandsUtil, } export * from './commandCreatorArgsGetters' export * from './heaterShakerCollision' diff --git a/step-generation/tsconfig.json b/step-generation/tsconfig.json index ee6bdb2ec23..c6a7b651e8e 100644 --- a/step-generation/tsconfig.json +++ b/step-generation/tsconfig.json @@ -8,6 +8,7 @@ "compilerOptions": { "composite": true, "noErrorTruncation": true, + "emitDeclarationOnly": false, "rootDir": "src", "outDir": "lib" }, diff --git a/tsconfig-base.json b/tsconfig-base.json index cc899f23299..47271f50eba 100644 --- a/tsconfig-base.json +++ b/tsconfig-base.json @@ -13,8 +13,5 @@ "skipLibCheck": true, "moduleResolution": "node", "types": ["vite/client", "vitest/globals", "@testing-library/jest-dom"], - "paths": { - "@opentrons/shared-data": ["./shared-data"] - } } } diff --git a/usb-bridge/node-client/src/cli.ts b/usb-bridge/node-client/src/cli.ts deleted file mode 100644 index e34c14a4731..00000000000 --- a/usb-bridge/node-client/src/cli.ts +++ /dev/null @@ -1,112 +0,0 @@ -import Yargs from 'yargs' -import { buildUSBAgent } from './usb-agent' -import fetch from 'node-fetch' - -import type { MiddlewareFunction } from 'yargs' - -type LogLevel = - | 'error' - | 'warn' - | 'info' - | 'http' - | 'verbose' - | 'debug' - | 'silly' - -const LOG_LVLS: LogLevel[] = [ - 'error', - 'warn', - 'info', - 'http', - 'verbose', - 'debug', - 'silly', -] - -type Logger = Record void> - -interface Argv { - logLevel: LogLevel | string -} - -interface CurlArgv extends Argv { - serialPath: string - method: string - httpPath: string -} - -const createLogger = (argv: Argv): Logger => { - const level = (LOG_LVLS as string[]).indexOf(argv.logLevel) - - return { - error: level >= 0 ? console.error : () => {}, - warn: level >= 1 ? console.warn : () => {}, - info: level >= 2 ? console.info : () => {}, - http: level >= 3 ? console.debug : () => {}, - verbose: level >= 4 ? console.debug : () => {}, - debug: level >= 5 ? console.debug : () => {}, - silly: level >= 6 ? console.debug : () => {}, - } -} - -const debugLogArgvMiddleware: MiddlewareFunction = (argv): void => { - const log = createLogger(argv) - log.debug(`Calling ${argv.$0} with argv:`, argv) - - // @ts-expect-error(mc, 2021-02-16): this return is probably unnecessary, remove - return argv -} - -function curl(argv: CurlArgv): void { - const log = createLogger(argv) - log.verbose(`building agent for ${argv.serialPath}`) - const agent = buildUSBAgent({ serialPort: argv.serialPath }) - const fakePath = `http://www.company.com/${argv.httpPath}` - log.info(`starting fetch to ${fakePath}`) - fetch(fakePath, { - method: argv.method, - agent: agent, - headers: { - 'opentrons-version': '2', - }, - }) - .then(res => res.text()) - .then(text => console.log(text)) - .finally(() => { - log.info('done, closing connection') - agent.destroy() - }) -} - -Yargs.options({ - logLevel: { - describe: 'Log level', - alias: 'l', - choices: [...LOG_LVLS, 'off'], - default: 'info', - }, -}) - .middleware([debugLogArgvMiddleware]) - .command( - 'usb-curl ', - 'Provide a curl-like interface that will make a request via the specified USB serial', - yargs => { - yargs.positional('serialPath', { - describe: 'Path to serial port to communicate with', - type: 'string', - }) - yargs.positional('method', { - describe: 'HTTP method', - type: 'string', - }) - yargs.positional('httpPath', { - describe: 'Path to query', - type: 'string', - }) - }, - curl - ) - .strict() - .version(_PKG_VERSION_) - .help() - .parse()