This repository has been archived by the owner on Mar 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: assertion messages are currently not handled
- Loading branch information
Showing
9 changed files
with
442 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`assert rendering handles equal 1`] = ` | ||
" ✕ is equal | ||
We failed to fully process the tap output: | ||
name: is equal | ||
diag: | ||
found: false | ||
wanted: true | ||
compare: === | ||
at: | ||
line: 7 | ||
column: 7 | ||
file: assertions.test.js | ||
type: Test | ||
stack: | | ||
Test.<anonymous> (assertions.test.js:7:7) | ||
Test.<anonymous> (assertions.test.js:4:11) | ||
Object.<anonymous> (assertions.test.js:3:1) | ||
source: |2 | ||
t.notOk(true, 'is notOk'); | ||
t.equal(false, true, 'is equal'); | ||
------^ | ||
t.same(false, true, 'is same'); | ||
}); | ||
fullname: assertions.test.js assertions equality | ||
" | ||
`; | ||
exports[`assert rendering handles notOk 1`] = ` | ||
" ✕ is notOk | ||
We failed to fully process the tap output: | ||
name: is notOk | ||
diag: | ||
at: | ||
line: 6 | ||
column: 7 | ||
file: assertions.test.js | ||
type: Test | ||
stack: | | ||
Test.<anonymous> (assertions.test.js:6:7) | ||
Test.<anonymous> (assertions.test.js:4:11) | ||
Object.<anonymous> (assertions.test.js:3:1) | ||
source: |2 | ||
t.ok(false, 'is ok'); | ||
t.notOk(true, 'is notOk'); | ||
------^ | ||
t.equal(false, true, 'is equal'); | ||
t.same(false, true, 'is same'); | ||
fullname: assertions.test.js assertions equality | ||
" | ||
`; | ||
exports[`assert rendering handles ok 1`] = ` | ||
" ✕ is ok | ||
We failed to fully process the tap output: | ||
name: is ok | ||
diag: | ||
at: | ||
line: 5 | ||
column: 7 | ||
file: assertions.test.js | ||
type: Test | ||
stack: | | ||
Test.<anonymous> (assertions.test.js:5:7) | ||
Test.<anonymous> (assertions.test.js:4:11) | ||
Object.<anonymous> (assertions.test.js:3:1) | ||
source: |2 | ||
await t.test('equality', async (t) => { | ||
t.ok(false, 'is ok'); | ||
------^ | ||
t.notOk(true, 'is notOk'); | ||
t.equal(false, true, 'is equal'); | ||
fullname: assertions.test.js assertions equality | ||
" | ||
`; | ||
exports[`assert rendering handles same 1`] = ` | ||
" ✕ is same | ||
We failed to fully process the tap output: | ||
name: is same | ||
diag: | ||
diff: | | ||
--- expected | ||
+++ actual | ||
@@ -1,1 +1,1 @@ | ||
-true | ||
+false | ||
at: | ||
line: 8 | ||
column: 7 | ||
file: assertions.test.js | ||
type: Test | ||
stack: | | ||
Test.<anonymous> (assertions.test.js:8:7) | ||
Test.<anonymous> (assertions.test.js:4:11) | ||
Object.<anonymous> (assertions.test.js:3:1) | ||
source: |2 | ||
t.equal(false, true, 'is equal'); | ||
t.same(false, true, 'is same'); | ||
------^ | ||
}); | ||
fullname: assertions.test.js assertions equality | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { testTranslation } from './translate.spec'; | ||
import { TestResult } from '@jest/test-result'; | ||
|
||
describe('assert rendering', () => { | ||
let result: TestResult; | ||
beforeAll(async () => { | ||
result = await testTranslation('./fixtures/assertions.tap'); | ||
}); | ||
|
||
function findAssert(name: string) { | ||
for (const test of result.testResults) { | ||
for (const message of test.failureMessages) { | ||
if (message.split('\n')[0].trim().endsWith(name)) { | ||
return message; | ||
} | ||
} | ||
} | ||
throw new Error('no test result found'); | ||
} | ||
|
||
it('handles ok', async () => { | ||
expect(findAssert('is ok')).toMatchSnapshot(); | ||
}); | ||
|
||
it('handles notOk', async () => { | ||
expect(findAssert('is notOk')).toMatchSnapshot(); | ||
}); | ||
|
||
it('handles equal', async () => { | ||
expect(findAssert('is equal')).toMatchSnapshot(); | ||
}); | ||
|
||
it('handles same', async () => { | ||
expect(findAssert('is same')).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.