-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Version
System:
OS: macOS 15.7.2
CPU: (14) arm64 Apple M4 Pro
Memory: 136.38 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Browsers:
Chrome: 145.0.7632.160
Firefox: 147.0.1
Safari: 26.1
npmPackages:
@rstest/adapter-rsbuild: ^0.2.2 => 0.2.2
@rstest/core: ^0.9.2 => 0.9.2Details
I tried to migrate from vite in my project, and found a strange issue with only one specific dependency vue-router@4.5.1. When I try to mock it, it seems that something is off with module resolution. I found that the bug appears only when I set testEnvironment to jsdom. Fixed by either disabling jsdom, OR changing the specifier on the mock decalration.
Reproduce link
Reproduce Steps
reproduces without a config file rstest --include test.ts --testEnvironment jsdom:
import {rs} from '@rstest/core'
import * as vueRouterActual from 'vue-router' with { rstest: 'importActual' }
import {
useRoute,
} from 'vue-router'
rs.mock('vue-router', () => {
return {
useRoute: rs.fn(),
}
})
console.log(vueRouterActual.useRoute === useRoute) // true, but expected falseIf I change the import specifier to vue-router/dist/vue-router it works!
import {rs} from '@rstest/core'
import * as vueRouterActual from 'vue-router/dist/vue-router' with { rstest: 'importActual' }
import {
useRoute,
} from 'vue-router'
rs.mock('vue-router/dist/vue-router', () => {
return {
useRoute: rs.fn(() => mockedRoute),
}
})
console.log(vueRouterActual.useRoute === useRoute) // false as expectedReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels