Skip to content
Discussion options

You must be logged in to vote

@Android789515 A custom environment usually requires extends accessing the setup.
In libs/my-env/index.ts:

export default {
  name: ''my-electron-env'',
  setup(global) {
    // Inject mocks
    global.window = { ... }; 
    return {
      teardown() { ... }
    }
  }
}

Then in vitest.config.ts:

test: {
  environment: ''./libs/my-env/index.ts''
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Android789515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants