|
| 1 | +import { test } from 'node:test' |
| 2 | +import { execa } from 'execa' |
| 3 | +import { join } from 'desm' |
| 4 | +import { strictEqual } from 'node:assert' |
| 5 | +import path from 'node:path' |
| 6 | + |
| 7 | +const borp = join(import.meta.url, '..', 'borp.js') |
| 8 | +const confFilesDir = join(import.meta.url, '..', 'fixtures', 'conf') |
| 9 | + |
| 10 | +test('reporter from node_modules', async () => { |
| 11 | + const cwd = join(import.meta.url, '..', 'fixtures', 'ts-esm') |
| 12 | + const { stdout } = await execa('node', [borp], { |
| 13 | + cwd, |
| 14 | + env: { |
| 15 | + BORP_CONF_FILE: path.join(confFilesDir, 'reporters.yaml') |
| 16 | + } |
| 17 | + }) |
| 18 | + |
| 19 | + strictEqual(stdout.indexOf('tests 2') >= 0, true) |
| 20 | +}) |
| 21 | + |
| 22 | +test('reporter from relative path', async () => { |
| 23 | + const cwd = join(import.meta.url, '..', 'fixtures', 'relative-reporter') |
| 24 | + const { stdout } = await execa('node', [borp], { |
| 25 | + cwd, |
| 26 | + env: { |
| 27 | + BORP_CONF_FILE: path.join(confFilesDir, 'relative-reporter.yaml') |
| 28 | + } |
| 29 | + }) |
| 30 | + |
| 31 | + strictEqual(/passed:.+add\.test\.js/.test(stdout), true) |
| 32 | + strictEqual(/passed:.+add2\.test\.js/.test(stdout), true) |
| 33 | +}) |
| 34 | + |
| 35 | +test('interprets globs for files', async () => { |
| 36 | + const cwd = join(import.meta.url, '..', 'fixtures', 'files-glob') |
| 37 | + const { stdout } = await execa('node', [borp], { |
| 38 | + cwd, |
| 39 | + env: { |
| 40 | + BORP_CONF_FILE: path.join(confFilesDir, 'glob-files.yaml') |
| 41 | + } |
| 42 | + }) |
| 43 | + |
| 44 | + strictEqual(stdout.indexOf('tests 2') >= 0, true) |
| 45 | +}) |
0 commit comments