Add "debug" mode to tests

This commit is contained in:
freearhey 2025-01-05 19:02:24 +03:00
parent ae7b32b079
commit c8055f10d6
7 changed files with 31 additions and 27 deletions

View file

@ -9,7 +9,8 @@ describe('channels:lint', () => {
it('will show a message if the file contains a syntax error', () => {
try {
const cmd = 'npm run channels:lint --- tests/__data__/input/channels-lint/error.channels.xml'
execSync(cmd, { encoding: 'utf8' })
const stdout = execSync(cmd, { encoding: 'utf8' })
if (process.env.DEBUG === 'true') console.log(stdout)
process.exit(1)
} catch (error) {
expect((error as ExecError).status).toBe(1)
@ -23,7 +24,8 @@ describe('channels:lint', () => {
try {
const cmd =
'npm run channels:lint --- tests/__data__/input/channels-lint/invalid.channels.xml'
execSync(cmd, { encoding: 'utf8' })
const stdout = execSync(cmd, { encoding: 'utf8' })
if (process.env.DEBUG === 'true') console.log(stdout)
process.exit(1)
} catch (error) {
expect((error as ExecError).status).toBe(1)
@ -37,7 +39,8 @@ describe('channels:lint', () => {
try {
const cmd =
'npm run channels:lint --- tests/__data__/input/channels-lint/error.channels.xml tests/__data__/input/channels-lint/invalid.channels.xml'
execSync(cmd, { encoding: 'utf8' })
const stdout = execSync(cmd, { encoding: 'utf8' })
if (process.env.DEBUG === 'true') console.log(stdout)
process.exit(1)
} catch (error) {
expect((error as ExecError).status).toBe(1)