Skip to content

Commit 61c6a85

Browse files
committed
Merge branch 'protocol_designer-migrate-webpack-to-vite' of github.com:Opentrons/opentrons into protocol_designer-migrate-webpack-to-vite
2 parents 2d78b26 + 1b23c98 commit 61c6a85

File tree

109 files changed

+3227
-3956
lines changed

Some content is hidden

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

109 files changed

+3227
-3956
lines changed

.github/workflows/app-test-build-deploy.yaml

+19-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ jobs:
6262
- uses: 'actions/setup-node@v3'
6363
with:
6464
node-version: '18.19.0'
65+
- uses: pnpm/action-setup@v3
66+
with:
67+
version: 8
6568
- name: 'install udev'
6669
run: sudo apt-get update && sudo apt-get install libudev-dev
6770
- name: 'set complex environment variables'
@@ -103,6 +106,9 @@ jobs:
103106
- uses: 'actions/setup-node@v3'
104107
with:
105108
node-version: '18.19.0'
109+
- uses: pnpm/action-setup@v3
110+
with:
111+
version: 8
106112
- uses: actions/setup-python@v4
107113
with:
108114
python-version: '3.10'
@@ -166,6 +172,11 @@ jobs:
166172
echo "both develop builds for edge"
167173
echo 'variants=["release", "internal-release"]' >> $GITHUB_OUTPUT
168174
echo 'type=develop' >> $GITHUB_OUTPUT
175+
elif [ "${{ format('{0}', endsWith(github.ref, 'protocol_designer-migrate-webpack-to-vite')) }}" = "true" ] ; then
176+
echo "REMOVE THIS AFTER APP TESTS ARE MIGRATED"
177+
echo "HACK: run release builds for the vite migration branch"
178+
echo 'variants=["release", "internal-release"]' >> $GITHUB_OUTPUT
179+
echo 'type=develop' >> $GITHUB_OUTPUT
169180
elif [ "${{ format('{0}', endsWith(github.ref, 'app-build-internal')) }}" = "true" ] ; then
170181
echo "internal-release builds for app-build-internal suffixes"
171182
echo 'variants=["internal-release"]' >> $GITHUB_OUTPUT
@@ -228,6 +239,9 @@ jobs:
228239
- uses: 'actions/setup-node@v3'
229240
with:
230241
node-version: '18.19.0'
242+
- uses: pnpm/action-setup@v3
243+
with:
244+
version: 8
231245
- uses: actions/setup-python@v4
232246
with:
233247
python-version: '3.10'
@@ -290,8 +304,9 @@ jobs:
290304
deploy-release-app:
291305
name: 'Deploy built app artifacts to S3'
292306
runs-on: 'ubuntu-22.04'
307+
# TODO: readd unit test dependency after tests are converted to vitest
293308
needs:
294-
['js-unit-test', 'backend-unit-test', 'build-app', 'determine-build-type']
309+
['build-app', 'determine-build-type']
295310
if: contains(fromJSON(needs.determine-build-type.outputs.variants), 'release') || contains(fromJSON(needs.determine-build-type.outputs.variants), 'internal-release')
296311
steps:
297312
- name: 'download run app builds'
@@ -401,6 +416,9 @@ jobs:
401416
cd ./monorepo
402417
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
403418
git checkout ${{ github.ref }}
419+
- uses: pnpm/action-setup@v3
420+
with:
421+
version: 8
404422
- uses: 'actions/setup-node@v3'
405423
with:
406424
node-version: '18.19.0'

.github/workflows/pd-test-build-deploy.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,4 @@ jobs:
188188
aws configure set role_arn ${{ secrets.OT_PD_DEPLOY_ROLE }} --profile deploy
189189
aws configure set source_profile identity --profile deploy
190190
aws s3 sync ./dist s3://sandbox.designer.opentrons.com/${{ env.OT_BRANCH }} --acl=public-read --profile=deploy
191-
aws cloudfront create-invalidation --distribution-id ENGOO2NRYGWKN --paths "/${{ env.OT_BRANCH }}/*"
192191
shell: bash

app-shell-odd/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"@types/uuid": "^3.4.7",
4343
"ajv": "6.12.3",
4444
"dateformat": "3.0.3",
45-
"electron-debug": "3.0.1",
4645
"electron-devtools-installer": "3.2.0",
4746
"electron-store": "5.1.1",
4847
"electron-updater": "4.1.2",

app-shell/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,19 @@
4444
"@types/pump": "^1.1.0",
4545
"@types/uuid": "^3.4.7",
4646
"ajv": "6.12.3",
47+
"axios": "^0.21.1",
4748
"dateformat": "3.0.3",
4849
"electron-context-menu": "3.6.1",
4950
"electron-debug": "3.0.1",
51+
"electron-localshortcut": "3.2.1",
5052
"electron-devtools-installer": "3.2.0",
5153
"electron-store": "5.1.1",
5254
"electron-updater": "4.1.2",
5355
"execa": "4.0.0",
5456
"form-data": "2.5.0",
5557
"fs-extra": "10.0.0",
5658
"get-stream": "5.1.0",
59+
"lodash": "4.17.21",
5760
"merge-options": "1.0.1",
5861
"mqtt": "4.3.8",
5962
"node-fetch": "2.6.7",

app/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
"@types/mixpanel-browser": "^2.35.6",
7575
"@types/node-fetch": "2.6.11",
7676
"@types/styled-components": "^5.1.26",
77-
"axios": "^0.21.1"
77+
"axios": "^0.21.1",
78+
"postcss-apply": "0.12.0",
79+
"postcss-color-mod-function": "3.0.3",
80+
"postcss-import": "16.0.0",
81+
"postcss-preset-env": "9.3.0"
7882
}
7983
}

app/src/organisms/Devices/HeaterShakerIsRunningModal/__tests__/hooks.test.tsx

+8-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as React from 'react'
22
import { Provider } from 'react-redux'
3+
import { describe, it, vi, beforeEach, expect } from 'vitest'
4+
import '@testing-library/jest-dom/vitest'
35
import { createStore } from 'redux'
46
import { renderHook } from '@testing-library/react'
57
import { HEATERSHAKER_MODULE_V1 } from '@opentrons/shared-data'
@@ -10,26 +12,18 @@ import { RUN_ID_1 } from '../../../RunTimeControl/__fixtures__'
1012
import type { Store } from 'redux'
1113
import type { State } from '../../../../redux/types'
1214

13-
jest.mock('../../hooks')
14-
jest.mock('../../../LabwarePositionCheck/useMostRecentCompletedAnalysis')
15-
16-
const mockUseMostRecentCompletedAnalysis = useMostRecentCompletedAnalysis as jest.MockedFunction<
17-
typeof useMostRecentCompletedAnalysis
18-
>
15+
vi.mock('../../hooks')
16+
vi.mock('../../../LabwarePositionCheck/useMostRecentCompletedAnalysis')
1917

2018
describe('useHeaterShakerModuleIdsFromRun', () => {
21-
const store: Store<State> = createStore(jest.fn(), {})
19+
const store: Store<State> = createStore(vi.fn(), {})
2220

2321
beforeEach(() => {
24-
store.dispatch = jest.fn()
25-
})
26-
27-
afterEach(() => {
28-
jest.restoreAllMocks()
22+
store.dispatch = vi.fn()
2923
})
3024

3125
it('should return a heater shaker module id from protocol analysis load command result', () => {
32-
mockUseMostRecentCompletedAnalysis.mockReturnValue({
26+
vi.mocked(useMostRecentCompletedAnalysis).mockReturnValue({
3327
pipettes: {},
3428
labware: {},
3529
modules: {
@@ -76,7 +70,7 @@ describe('useHeaterShakerModuleIdsFromRun', () => {
7670
})
7771

7872
it('should return two heater shaker module ids if two modules are loaded in the protocol', () => {
79-
mockUseMostRecentCompletedAnalysis.mockReturnValue({
73+
vi.mocked(useMostRecentCompletedAnalysis).mockReturnValue({
8074
pipettes: {},
8175
labware: {},
8276
modules: {
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import * as React from 'react'
2-
import { renderWithProviders } from '@opentrons/components'
2+
import { screen } from '@testing-library/react'
3+
import { describe, it, vi, beforeEach } from 'vitest'
4+
import '@testing-library/jest-dom/vitest'
5+
import { renderWithProviders } from '../../../../__testing-utils__'
36
import { i18n } from '../../../../i18n'
47
import { HeaterShakerModuleCard } from '../HeaterShakerModuleCard'
58
import { HeaterShakerModuleData } from '../../../ModuleCard/HeaterShakerModuleData'
69
import { mockHeaterShaker } from '../../../../redux/modules/__fixtures__'
710

8-
jest.mock('../../../ModuleCard/HeaterShakerModuleData')
9-
10-
const mockHeaterShakerModuleData = HeaterShakerModuleData as jest.MockedFunction<
11-
typeof HeaterShakerModuleData
12-
>
11+
vi.mock('../../../ModuleCard/HeaterShakerModuleData')
1312

1413
const render = (props: React.ComponentProps<typeof HeaterShakerModuleCard>) => {
1514
return renderWithProviders(<HeaterShakerModuleCard {...props} />, {
@@ -23,17 +22,17 @@ describe('HeaterShakerModuleCard', () => {
2322
props = {
2423
module: mockHeaterShaker,
2524
}
26-
mockHeaterShakerModuleData.mockReturnValue(
25+
vi.mocked(HeaterShakerModuleData).mockReturnValue(
2726
<div>mock heater shaker module data</div>
2827
)
2928
})
3029

3130
it('renders the correct info', () => {
32-
const { getByText, getByAltText, getByLabelText } = render(props)
33-
getByText('usb-1')
34-
getByText('Heater-Shaker Module GEN1')
35-
getByText('mock heater shaker module data')
36-
getByAltText('Heater-Shaker')
37-
getByLabelText('heater-shaker')
31+
render(props)
32+
screen.getByText('usb-1')
33+
screen.getByText('Heater-Shaker Module GEN1')
34+
screen.getByText('mock heater shaker module data')
35+
screen.getByAltText('Heater-Shaker')
36+
screen.getByLabelText('heater-shaker')
3837
})
3938
})
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import * as React from 'react'
2-
import { renderWithProviders } from '@opentrons/components'
2+
import { describe, it, vi, beforeEach, expect } from 'vitest'
3+
import '@testing-library/jest-dom/vitest'
4+
import { renderWithProviders } from '../../../../__testing-utils__'
35
import { useInstrumentsQuery } from '@opentrons/react-api-client'
4-
import { fireEvent } from '@testing-library/react'
6+
import { fireEvent, screen } from '@testing-library/react'
57
import { i18n } from '../../../../i18n'
68
import { AboutPipetteSlideout } from '../AboutPipetteSlideout'
79
import { mockLeftSpecs } from '../../../../redux/pipettes/__fixtures__'
810
import { LEFT } from '../../../../redux/pipettes'
911

10-
jest.mock('@opentrons/react-api-client')
11-
12-
const mockUseInstrumentsQuery = useInstrumentsQuery as jest.MockedFunction<
13-
typeof useInstrumentsQuery
14-
>
12+
vi.mock('@opentrons/react-api-client')
1513

1614
const render = (props: React.ComponentProps<typeof AboutPipetteSlideout>) => {
1715
return renderWithProviders(<AboutPipetteSlideout {...props} />, {
@@ -27,28 +25,25 @@ describe('AboutPipetteSlideout', () => {
2725
pipetteName: mockLeftSpecs.displayName,
2826
mount: LEFT,
2927
isExpanded: true,
30-
onCloseClick: jest.fn(),
28+
onCloseClick: vi.fn(),
3129
}
32-
mockUseInstrumentsQuery.mockReturnValue({
30+
vi.mocked(useInstrumentsQuery).mockReturnValue({
3331
data: { data: [] },
3432
} as any)
3533
})
36-
afterEach(() => {
37-
jest.resetAllMocks()
38-
})
3934

4035
it('renders correct info', () => {
41-
const { getByText, getByRole } = render(props)
36+
render(props)
4237

43-
getByText('About Left Pipette Pipette')
44-
getByText('123')
45-
getByText('SERIAL NUMBER')
46-
const button = getByRole('button', { name: /exit/i })
38+
screen.getByText('About Left Pipette Pipette')
39+
screen.getByText('123')
40+
screen.getByText('SERIAL NUMBER')
41+
const button = screen.getByRole('button', { name: /exit/i })
4742
fireEvent.click(button)
4843
expect(props.onCloseClick).toHaveBeenCalled()
4944
})
5045
it('renders the firmware version if it exists', () => {
51-
mockUseInstrumentsQuery.mockReturnValue({
46+
vi.mocked(useInstrumentsQuery).mockReturnValue({
5247
data: {
5348
data: [
5449
{
@@ -61,9 +56,9 @@ describe('AboutPipetteSlideout', () => {
6156
},
6257
} as any)
6358

64-
const { getByText } = render(props)
59+
render(props)
6560

66-
getByText('CURRENT VERSION')
67-
getByText('12')
61+
screen.getByText('CURRENT VERSION')
62+
screen.getByText('12')
6863
})
6964
})

0 commit comments

Comments
 (0)