@@ -89,7 +89,7 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
8989 expect ( results . numPassedTests ) . toBe ( 1 ) ;
9090 } ) ;
9191
92- it ( 'should allow overriding builder options via runnerConfig file' , async ( ) => {
92+ it ( 'should allow overriding globals to false via runnerConfig file' , async ( ) => {
9393 harness . useTarget ( 'test' , {
9494 ...BASE_OPTIONS ,
9595 runnerConfig : 'vitest.config.ts' ,
@@ -111,7 +111,7 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
111111 harness . writeFile (
112112 'src/app/app.component.spec.ts' ,
113113 `
114- import { vi, test, expect } from 'vitest';
114+ import { expect } from 'vitest';
115115 test('should pass', () => {
116116 expect(true).toBe(true);
117117 });
@@ -122,6 +122,38 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
122122 expect ( result ?. success ) . toBeFalse ( ) ;
123123 } ) ;
124124
125+ it ( 'should initialize environment even when globals are disabled in runnerConfig file' , async ( ) => {
126+ harness . useTarget ( 'test' , {
127+ ...BASE_OPTIONS ,
128+ runnerConfig : 'vitest.config.ts' ,
129+ } ) ;
130+
131+ harness . writeFile (
132+ 'vitest.config.ts' ,
133+ `
134+ import { defineConfig } from 'vitest/config';
135+ export default defineConfig({
136+ test: {
137+ globals: false,
138+ },
139+ });
140+ ` ,
141+ ) ;
142+
143+ harness . writeFile (
144+ 'src/app/app.component.spec.ts' ,
145+ `
146+ import { test, expect } from 'vitest';
147+ test('should pass', () => {
148+ expect(true).toBe(true);
149+ });
150+ ` ,
151+ ) ;
152+
153+ const { result } = await harness . executeOnce ( ) ;
154+ expect ( result ?. success ) . toBeTrue ( ) ;
155+ } ) ;
156+
125157 it ( 'should fail when a DOM-dependent test is run in a node environment' , async ( ) => {
126158 harness . useTarget ( 'test' , {
127159 ...BASE_OPTIONS ,
0 commit comments