Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import {
getActiveInterfaces,
} from '../network-interfaces'

vi.mock('os')
vi.mock('os', () => ({
default: {
networkInterfaces: vi.fn(),
},
networkInterfaces: vi.fn(),
}))

const mockV4: os.NetworkInterfaceInfoIPv4 = {
address: '192.168.1.17',
Expand Down Expand Up @@ -78,7 +83,7 @@ describe('system-info::network-interfaces', () => {
it('should be able to signal interface changes', () => {
const handleInterfaceChange = vi.fn()

vi.mocked(os.networkInterfaces).mockReturnValue({})
vi.mocked(os.networkInterfaces).mockReturnValueOnce({} as any)

createNetworkInterfaceMonitor({
pollInterval: 30000,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@vitejs/plugin-react": "4.2.0",
"@vitest/coverage-v8": "2.1.8",
"@vitest/coverage-v8": "4.0.3",
"ajv": "6.12.3",
"aws-sdk": "^2.493.0",
"babel-loader": "^8.2.2",
Expand Down Expand Up @@ -142,8 +142,8 @@
"typescript": "5.3.3",
"url-loader": "^2.1.0",
"vite": "7.1.1",
"vitest": "2.1.8",
"vitest-when": "0.5.0",
"vitest": "4.0.3",
"vitest-when": "0.9.0",
"wait-on": "^4.0.2",
"webpack": "^4.41.6",
"webpack-bundle-analyzer": "^3.6.0",
Expand Down
11 changes: 8 additions & 3 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ export default defineConfig({
},
resolve: {
alias: {
// More specific patterns first to prevent incorrect matching of test file paths
'/protocol-designer/src/': path.resolve('./protocol-designer/src') + '/',
'/app/src/': path.resolve('./app/src') + '/',
'/ai-client/src/': path.resolve('./opentrons-ai-client/src') + '/',
// Then the general patterns for imports
'/protocol-designer/': path.resolve('./protocol-designer/src/') + '/',
'/app/': path.resolve('./app/src/') + '/',
'/ai-client/': path.resolve('./opentrons-ai-client/src/') + '/',
// todo(mm, 2025-10-27): These cross-project aliases cause trouble like
// files being processed with the wrong config (the config from the
// consuming project vs. the config from the source project).
Expand All @@ -101,9 +109,6 @@ export default defineConfig({
'@opentrons/step-generation': path.resolve(
'./step-generation/src/index.ts'
),
'/app/': path.resolve('./app/src/') + '/',
'/ai-client/': path.resolve('./opentrons-ai-client/src/') + '/',
'/protocol-designer/': path.resolve('./protocol-designer/src/') + '/',
},
},
})
16 changes: 10 additions & 6 deletions vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ export default mergeConfig(
test: {
environment: 'jsdom',
allowOnly: true,
exclude: [...configDefaults.exclude, '**/node_modules/**', '**/dist/**', '**/lib/**'],
include: ['**/__tests__/**/*.test.{ts,tsx}', '**/*.test.{ts,tsx}'],
exclude: [
...configDefaults.exclude,
'**/node_modules/**',
'**/dist/**',
'**/lib/**',
],
setupFiles: ['./setup-vitest.mts'],
coverage: {
exclude: [
Expand All @@ -35,6 +41,9 @@ export default mergeConfig(
},
resolve: {
alias: {
'/protocol-designer/': path.resolve('./protocol-designer/src/') + '/',
'/app/': path.resolve('./app/src/') + '/',
'/ai-client/': path.resolve('./opentrons-ai-client/src/') + '/',
// todo(mm, 2025-10-27): These cross-project aliases cause trouble like
// files being processed with the wrong config (the config from the
// consuming project vs. the config from the source project).
Expand Down Expand Up @@ -72,11 +81,6 @@ export default mergeConfig(
'@opentrons/labware-library': path.resolve(
'./labware-library/src/labware-creator/index.tsx'
),
// "The resulting path (...) trailing slashes are removed unless the path is resolved to the root directory."
// https://nodejs.org/api/path.html#pathresolvepaths
'/app/': path.resolve('./app/src/') + '/',
'/protocol-designer/': path.resolve('./protocol-designer/src/') + '/',
'/ai-client/': path.resolve('./opentrons-ai-client/src/') + '/',
},
},
})
Expand Down
Loading
Loading