-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
I've just recently set up Detox in our project, but we're looking strip jest from our code base completely and we're in the process of migrating to vitest instead.
The detox documentation states that there is support for third party test runners so i tried to set up detox with vitest
My vitest setup is fairly simple at the moment
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["./__test__/**/*.test.ts"],
globalSetup: "./node_modules/detox/runners/jest/globalSetup",
},
});
and i've updated the .detoxrc configuration to use vitest as well
module.exports = {
testRunner: {
args: {
$0: "vitest",
config: "vitest.config.js",
},
},
....
Building on iOS is fine, but when i try to run a test i get the following error
DetoxRuntimeError: Detox worker instance has not been installed in this context (DetoxSecondaryContext).
HINT: If you are using Detox with Jest according to the latest guide, please report this issue on our GitHub tracker:
https://github.com/wix/Detox/issues
Otherwise, make sure you call detox.installWorker() beforehand.
3 | describe('Example', () => {
4 | beforeAll(async () => {
> 5 | await device.launchApp()
| ^
6 | })
7 |
8 | beforeEach(async () => {
I havent found any other documentation online or examples of using a third party test runner, so im coming here to see if there is anyone that has done this with vitest/knows if this is possible? Or maybe its recommended to not use vitest?
Any help or insight would be appreciated!
NOTE: If i just use the default setup with jest as the test runner, everything runs smoothly
Your environment
Detox version: 20.11.2
React Native version: 0.72.1
Node version: 16
Device model:
OS:
Test-runner (select one): jest / other