@@ -5,7 +5,12 @@ import fixturify from 'fixturify';
55import { execa } from 'execa' ;
66import { beforeAll , beforeEach , describe , expect , it } from 'vitest' ;
77
8- import { assertGeneratedCorrectly , dirContents , SUPPORTED_PACKAGE_MANAGERS } from '../helpers.js' ;
8+ import {
9+ assertGeneratedCorrectly ,
10+ dirContents ,
11+ filesMatching ,
12+ SUPPORTED_PACKAGE_MANAGERS ,
13+ } from '../helpers.js' ;
914const blueprintPath = path . join ( __dirname , '../..' ) ;
1015let localEmberCli = require . resolve ( 'ember-cli/bin/ember' ) ;
1116
@@ -85,52 +90,48 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
8590 await commandSucceeds ( `${ packageManager } run build` ) ;
8691
8792 expect (
88- {
89- src : await dirContents ( join ( addonDir , 'src' ) ) ,
90- // rollup output:
91- dist : await dirContents ( join ( addonDir , 'dist' ) ) ,
92- 'dist/components' : await dirContents ( join ( addonDir , 'dist/components' ) ) ,
93- 'dist/services' : await dirContents ( join ( addonDir , 'dist/services' ) ) ,
94- // glint output:
95- declarations : await dirContents ( join ( addonDir , 'declarations' ) ) ,
96- 'declarations/components' : await dirContents ( join ( addonDir , 'declarations/components' ) ) ,
97- 'declarations/services' : await dirContents ( join ( addonDir , 'declarations/services' ) ) ,
98- } ,
99- `ensure we don't pollute the src dir with declarations and emit the js and .d.ts to the correct folders` ,
100- ) . to . deep . equal ( {
101- src : [ 'components' , 'index.ts' , 'services' , 'template-registry.ts' ] ,
102- dist : [
103- '_app_' ,
104- 'components' ,
105- 'index.js' ,
106- 'index.js.map' ,
107- 'services' ,
108- 'template-registry.js' ,
109- 'template-registry.js.map' ,
110- ] ,
111- 'dist/components' : [
112- 'another-gts.js' ,
113- 'another-gts.js.map' ,
114- 'template-import.js' ,
115- 'template-import.js.map' ,
116- ] ,
117- 'dist/services' : [ 'example.js' , 'example.js.map' ] ,
118- declarations : [
119- 'components' ,
120- 'index.d.ts' ,
121- 'index.d.ts.map' ,
122- 'services' ,
123- 'template-registry.d.ts' ,
124- 'template-registry.d.ts.map' ,
125- ] ,
126- 'declarations/components' : [
127- 'another-gts.gts.d.ts' ,
128- 'another-gts.gts.d.ts.map' ,
129- 'template-import.gts.d.ts' ,
130- 'template-import.gts.d.ts.map' ,
131- ] ,
132- 'declarations/services' : [ 'example.d.ts' , 'example.d.ts.map' ] ,
133- } ) ;
93+ await filesMatching ( 'src/**' , addonDir ) ,
94+ `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)` ,
95+ ) . toMatchInlineSnapshot ( `
96+ [
97+ "src/index.ts",
98+ "src/template-registry.ts",
99+ "src/components/another-gts.gts",
100+ "src/components/template-import.gts",
101+ "src/services/example.ts",
102+ ]
103+ ` ) ;
104+
105+ expect (
106+ await filesMatching ( '{dist,declarations}/**/*' , addonDir ) ,
107+ `ensure we emit the correct files out of the box to the correct folders` ,
108+ ) . toMatchInlineSnapshot ( `
109+ [
110+ "dist/index.js",
111+ "dist/index.js.map",
112+ "dist/template-registry.js",
113+ "dist/template-registry.js.map",
114+ "dist/components/another-gts.js",
115+ "dist/components/another-gts.js.map",
116+ "dist/components/template-import.js",
117+ "dist/components/template-import.js.map",
118+ "dist/services/example.js",
119+ "dist/services/example.js.map",
120+ "dist/_app_/components/another-gts.js",
121+ "dist/_app_/components/template-import.js",
122+ "dist/_app_/services/example.js",
123+ "declarations/index.d.ts",
124+ "declarations/index.d.ts.map",
125+ "declarations/template-registry.d.ts",
126+ "declarations/template-registry.d.ts.map",
127+ "declarations/components/another-gts.gts.d.ts",
128+ "declarations/components/another-gts.gts.d.ts.map",
129+ "declarations/components/template-import.gts.d.ts",
130+ "declarations/components/template-import.gts.d.ts.map",
131+ "declarations/services/example.d.ts",
132+ "declarations/services/example.d.ts.map",
133+ ]
134+ ` ) ;
134135 } ) ;
135136
136137 it ( 'test' , async ( ) => {
0 commit comments