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

Function checkFileWithJSONReplacement

tests/helpers-internal/fixtures.js:20–38  ·  view source on GitHub ↗
(fixtureName, fileName, targetPath, value)

Source from the content-addressed store, hash-verified

18}
19
20function checkFileWithJSONReplacement(fixtureName, fileName, targetPath, value) {
21 let fixturePath = path.join(__dirname, '../fixtures', fixtureName, fileName);
22 let fixtureContents = fs.readFileSync(fixturePath, { encoding: 'utf-8' });
23 let fixtureData = JSON.parse(fixtureContents);
24
25 let candidateContents = fs.readFileSync(fileName, 'utf8');
26 let candidateData = JSON.parse(candidateContents);
27
28 if (process.env.WRITE_FIXTURES) {
29 let newFixtureData = cloneDeep(candidateData);
30 set(newFixtureData, targetPath, get(fixtureData, targetPath));
31 fs.mkdirSync(path.dirname(fixturePath), { recursive: true });
32 fs.writeFileSync(fixturePath, `${JSON.stringify(newFixtureData, null, 2)}\n`, { encoding: 'utf-8' });
33 }
34
35 set(fixtureData, targetPath, value);
36
37 expect(JSON.stringify(candidateData, null, 2)).to.equal(JSON.stringify(fixtureData, null, 2));
38}
39
40function checkEmberCLIBuild(fixtureName, fileName) {
41 let fixturePath = path.join(__dirname, '../fixtures', fixtureName, fileName);

Callers 2

new-test.jsFile · 0.85
addon-test.jsFile · 0.85

Calls 2

setFunction · 0.85
getFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…