Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/skills17-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ export default class Skills17Reporter implements Reporter {
}

onTestResult(test: Test, testResult: TestResult, _aggregatedResults: AggregatedResult): void {
const isExtra = test.path.includes('/extra/');
const isExtraPath = test.path.includes('/extra/');
for (const result of testResult.testResults) {
const isExtra = isExtraPath || result.ancestorTitles.map(title => title.toLowerCase()).includes('extra');
this.testRun?.recordTest(
`${result.ancestorTitles.join(' > ')} > ${result.title}`,
`${result.ancestorTitles.filter(title => title.toLowerCase() !== 'extra').join(' > ')} > ${result.title}`,
result.title,
isExtra,
result.status === 'passed',
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/extra-tests-fail/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# yaml-language-server: $schema=https://schema.skills17.ch/task-config/v3/config.schema.json
id: basic-functionality
groups:
- match: example.+
21 changes: 21 additions & 0 deletions tests/integration/extra-tests-fail/expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"testResults": [
{
"group": "example.+",
"points": 1,
"maxPoints": 1,
"strategy": "add",
"manualCheck": true,
"tests": [
{
"name": "adds 1 + 2 to equal 3",
"points": 1,
"maxPoints": 1,
"successful": true,
"required": false,
"manualCheck": true
}
]
}
]
}
9 changes: 9 additions & 0 deletions tests/integration/extra-tests-fail/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
------------ RESULT ------------

Summary:
example.+: 1/1 point [manual check required]
? adds 1 + 2 to equal 3 please check manually for static return values and/or logical errors

Total: 1/1 point

Info: The detailed test and error information is visible above the result summary.
14 changes: 14 additions & 0 deletions tests/integration/extra-tests-fail/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import process from 'node:process';
import {type JestConfigWithTsJest} from 'ts-jest';

const jsonOnlyReport = Boolean(process.env.SKILLS17_JSON);

const config: JestConfigWithTsJest = {
clearMocks: true,
reporters: jsonOnlyReport
? [['../../../lib/skills17-reporter', {json: jsonOnlyReport}]]
: ['../../../lib/skills17-reporter'],
testEnvironment: 'node',
};

export default config;
3 changes: 3 additions & 0 deletions tests/integration/extra-tests-fail/src/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function sum(a, b) {
return a + b;
}
17 changes: 17 additions & 0 deletions tests/integration/extra-tests-fail/src/example.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sum from './example.js';

/* eslint-disable no-undef */
describe('example', () => {
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});
});

describe('extra', () => {
describe('example', () => {
test('adds 1 + 2 to equal 3', () => {
expect(sum(0, 0)).toBe(1);
});
});
});
/* eslint-enable no-undef */