How to test this case?
I have a variable in the settings:
setup() { const address = `${process.env.VAR_ENV}` onMounted(async () => { const stop = await isContinuing(address)
When the test is running, the function await isContinuing(address)
is executing. How can I make the function not run while the test is running?
My test has undefined wrapper variable
beforeEach(() => { wrapper = shallowMount(App, { }) }) describe('Dashboard', () => { it('test to verify if initial section.', () => { const expected = 0 expect(wrapper.findComponent({ ref: 'section' }).element.value).toBe( expected ) })
Jest (and I assume most testing frameworks) sets the NODE_ENV environment variable to
test
. So you can use a simpleif
statement to not do something in your test: