MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / confirmBlueprintedForDir

Function confirmBlueprintedForDir

tests/acceptance/new-test.js:34–67  ·  view source on GitHub ↗
(blueprintDir, expectedAppDir = 'foo', typescript = false)

Source from the content-addressed store, hash-verified

32let tmpDir;
33
34function confirmBlueprintedForDir(blueprintDir, expectedAppDir = 'foo', typescript = false) {
35 let blueprintPath = path.join(blueprintDir, 'files');
36 // ignore TypeScript files
37 let expected = walkSync(blueprintPath, {
38 ignore: ['tsconfig.json', 'types', 'app/config'],
39 }).map((name) => (typescript ? name : name.replace(/\.ts$/, '.js')));
40
41 // This style of assertion can't handle conditionally available files
42 if (expected.some((x) => x.endsWith('eslint.config.mjs'))) {
43 expected = [...expected.filter((x) => !x.endsWith('eslint.config.mjs')), 'eslint.config.mjs'];
44 }
45 // GJS and GTS files are also conditionally available
46 expected = expected.filter((x) => !x.endsWith('.gjs') && !x.endsWith('.gts'));
47
48 let actual = walkSync('.').sort();
49 let directory = path.basename(process.cwd());
50
51 Object.keys(Blueprint.renamedFiles).forEach((srcFile) => {
52 expected[expected.indexOf(srcFile)] = Blueprint.renamedFiles[srcFile];
53 });
54
55 expected.sort();
56
57 // since the test is quite dynamic we want to make sure that the
58 // directory and the expected aren't empty
59 expect(directory).to.not.be.empty;
60 expect(expected).to.not.be.empty;
61
62 expect(directory).to.equal(expectedAppDir);
63 expect(expected).to.deep.equal(
64 actual,
65 `${EOL} expected: ${util.inspect(expected)}${EOL} but got: ${util.inspect(actual)}`
66 );
67}
68
69describe('Acceptance: ember new', function () {
70 this.timeout(300000);

Callers 1

new-test.jsFile · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…