Add support for specifying the target generator config file

This commit is contained in:
James M. Greene
2022-08-05 17:31:59 -05:00
parent 404d23c4a6
commit 7c3932ff89
23 changed files with 410 additions and 38 deletions

View File

@@ -1,4 +1,5 @@
const fs = require('fs')
const core = require('@actions/core')
const { ConfigParser } = require('./config-parser')
const { getTempFolder, compareFiles } = require('./test-helpers')
@@ -134,8 +135,18 @@ const cases = [
]
describe('config-parser', () => {
beforeEach(() => {
jest.restoreAllMocks()
// Mock error/warning/info/debug to silence their output
jest.spyOn(core, 'error').mockImplementation(jest.fn())
jest.spyOn(core, 'warning').mockImplementation(jest.fn())
jest.spyOn(core, 'info').mockImplementation(jest.fn())
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
})
cases.forEach(({ property, source, expected }, index) => {
it(`Inject path properly for case #${index}`, () => {
it(`injects path properly for case #${index}`, () => {
// Write the source file
const sourceFile = `${tempFolder}/source.js`
fs.writeFileSync(sourceFile, source, { encoding: 'utf8' })