https://github.com/methodgrab/ava-power-assert-external-macro-test-case
Test case for avajs/ava#1049
https://github.com/methodgrab/ava-power-assert-external-macro-test-case
Last synced: 4 months ago
JSON representation
Test case for avajs/ava#1049
- Host: GitHub
- URL: https://github.com/methodgrab/ava-power-assert-external-macro-test-case
- Owner: MethodGrab
- Created: 2016-09-23T15:02:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-23T15:32:19.000Z (over 9 years ago)
- Last Synced: 2025-04-12T05:51:39.279Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test case: AVA power-assert with external macros
## Problem
External AVA macros are not transformed with power-assert.
## Example
- Close this repo
- `npm install && npm test`
- Observe console output
## Expected
Macros in the same file as the tests (internal macros) should have the same behaviour as those imported from an external file.
Both tests should output the same error:
```js
test( 'internalMacro: 2 + 2 === 4', internalMacro, '2 + 2', 8 );
test( 'externalMacro: 2 + 2 === 4', externalMacro, '2 + 2', 8 );
```
## Actual
External macros are not transformed with power-assert and so display standard errors:
```
running internal macro...
× internalMacro: 2 + 2 === 4
t.is(eval(input), expected)
| | |
4 "2 + 2" 8
running external macro...
× externalMacro: 2 + 2 === 4 4 === 8
2 tests failed [23:18:50]
1. internalMacro: 2 + 2 === 4
AssertionError:
4 "2 + 2" 8
Test.internalMacro (test.js:7:4)
_combinedTickCallback (internal/process/next_tick.js:67:7)
process._tickCallback (internal/process/next_tick.js:98:9)
2. externalMacro: 2 + 2 === 4
AssertionError: 4 === 8
Test.module.exports.externalMacro (macros.js:3:4)
_combinedTickCallback (internal/process/next_tick.js:67:7)
process._tickCallback (internal/process/next_tick.js:98:9)
```