(fixtureName, fileName, targetPath, value)
| 18 | } |
| 19 | |
| 20 | function 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 | |
| 40 | function checkEmberCLIBuild(fixtureName, fileName) { |
| 41 | let fixturePath = path.join(__dirname, '../fixtures', fixtureName, fileName); |
no test coverage detected
searching dependent graphs…