@@ -7,9 +7,9 @@ import { beforeAll, beforeEach, describe, expect, it } from 'vitest';
77
88import {
99 assertGeneratedCorrectly ,
10- dirContents ,
1110 filesMatching ,
1211 SUPPORTED_PACKAGE_MANAGERS ,
12+ safeExecaEnv ,
1313} from '../helpers.js' ;
1414const blueprintPath = path . join ( __dirname , '../..' ) ;
1515let localEmberCli = require . resolve ( 'ember-cli/bin/ember' ) ;
@@ -25,6 +25,8 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
2525 cwd : addonDir ,
2626 shell : true ,
2727 preferLocal : true ,
28+ extendEnv : false ,
29+ env : safeExecaEnv ( ) ,
2830 // Allows us to not fail yet when the command fails
2931 // but we'd still fail appropriately with the exitCode check below.
3032 // When we fail, we want to check for git diffs for debugging purposes.
@@ -50,13 +52,14 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
5052 addonDir = join ( tmpDir , addonName ) ;
5153 await execa ( {
5254 cwd : tmpDir ,
55+ extendEnv : false ,
5356 } ) `${ localEmberCli } addon ${ addonName } -b ${ blueprintPath } --skip-npm --prefer-local true --${ packageManager } --typescript` ;
5457 // Have to use --force because NPM is *stricter* when you use tags in package.json
5558 // than pnpm (in that tags don't match any specified stable version)
5659 if ( packageManager === 'npm' ) {
57- await execa ( { cwd : addonDir } ) `npm install --force` ;
60+ await execa ( { cwd : addonDir , extendEnv : false } ) `npm install --force` ;
5861 } else if ( packageManager === 'pnpm' ) {
59- await execa ( { cwd : addonDir } ) `pnpm install` ;
62+ await execa ( { cwd : addonDir , extendEnv : false } ) `pnpm install` ;
6063 }
6164 } ) ;
6265
@@ -92,56 +95,56 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
9295 await commandSucceeds ( `${ packageManager } run build` ) ;
9396
9497 expect (
95- await filesMatching ( 'src/**' , addonDir ) ,
98+ ( await filesMatching ( 'src/**' , addonDir ) ) . sort ( ) ,
9699 `ensure we don't pollute the src dir with declarations and emit the js and .d.ts to the correct folders -- this should be the same as the input files (no change from the fixture + default files)` ,
97100 ) . toMatchInlineSnapshot ( `
98101 [
102+ "src/components/another-gts.gts",
103+ "src/components/template-import.gts",
99104 "src/index.ts",
100105 "src/lint-test-gts.gts",
101106 "src/lint-test-ts.ts",
102- "src/template-registry.ts",
103- "src/components/another-gts.gts",
104- "src/components/template-import.gts",
105107 "src/services/example.ts",
108+ "src/template-registry.ts",
106109 ]
107110 ` ) ;
108111
109112 expect (
110- await filesMatching ( '{dist,declarations}/**/*' , addonDir ) ,
113+ ( await filesMatching ( '{dist,declarations}/**/*' , addonDir ) ) . sort ( ) ,
111114 `ensure we emit the correct files out of the box to the correct folders` ,
112115 ) . toMatchInlineSnapshot ( `
113116 [
114- "dist/index.js",
115- "dist/index.js.map",
116- "dist/lint-test-gts.js",
117- "dist/lint-test-gts.js.map",
118- "dist/lint-test-ts.js",
119- "dist/lint-test-ts.js.map",
120- "dist/template-registry.js",
121- "dist/template-registry.js.map",
122- "dist/components/another-gts.js",
123- "dist/components/another-gts.js.map",
124- "dist/components/template-import.js",
125- "dist/components/template-import.js.map",
126- "dist/services/example.js",
127- "dist/services/example.js.map",
128- "dist/_app_/components/another-gts.js",
129- "dist/_app_/components/template-import.js",
130- "dist/_app_/services/example.js",
117+ "declarations/components/another-gts.d.ts",
118+ "declarations/components/another-gts.d.ts.map",
119+ "declarations/components/template-import.d.ts",
120+ "declarations/components/template-import.d.ts.map",
131121 "declarations/index.d.ts",
132122 "declarations/index.d.ts.map",
133123 "declarations/lint-test-gts.d.ts",
134124 "declarations/lint-test-gts.d.ts.map",
135125 "declarations/lint-test-ts.d.ts",
136126 "declarations/lint-test-ts.d.ts.map",
137- "declarations/template-registry.d.ts",
138- "declarations/template-registry.d.ts.map",
139- "declarations/components/another-gts.d.ts",
140- "declarations/components/another-gts.d.ts.map",
141- "declarations/components/template-import.d.ts",
142- "declarations/components/template-import.d.ts.map",
143127 "declarations/services/example.d.ts",
144128 "declarations/services/example.d.ts.map",
129+ "declarations/template-registry.d.ts",
130+ "declarations/template-registry.d.ts.map",
131+ "dist/_app_/components/another-gts.js",
132+ "dist/_app_/components/template-import.js",
133+ "dist/_app_/services/example.js",
134+ "dist/components/another-gts.js",
135+ "dist/components/another-gts.js.map",
136+ "dist/components/template-import.js",
137+ "dist/components/template-import.js.map",
138+ "dist/index.js",
139+ "dist/index.js.map",
140+ "dist/lint-test-gts.js",
141+ "dist/lint-test-gts.js.map",
142+ "dist/lint-test-ts.js",
143+ "dist/lint-test-ts.js.map",
144+ "dist/services/example.js",
145+ "dist/services/example.js.map",
146+ "dist/template-registry.js",
147+ "dist/template-registry.js.map",
145148 ]
146149 ` ) ;
147150 } ) ;
0 commit comments