Skip to content

Commit

Permalink
fix: assert should be (actual, expected)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Jul 5, 2017
1 parent 9b30ca3 commit 9fcb418
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function pluginTester(
const formattedOutput = [code, separator, result].join('')
expect(`\n${formattedOutput}\n`).toMatchSnapshot(title)
} else if (error) {
assertError(error, result)
assertError(result, error)
} else if (output) {
assert.equal(result, output, 'Output is incorrect.')
} else {
Expand Down Expand Up @@ -223,7 +223,7 @@ function testFixtures({
.readFileSync(path.join(fixtureDir, 'output.js'), 'utf8')
.trim()

assert.equal(output, actual, 'actual output does not match output.js')
assert.equal(actual, output, 'actual output does not match output.js')

This comment has been minimized.

Copy link
@kentcdodds

kentcdodds Jul 5, 2017

Member

This was the actual issue I believe.

})
})
})
Expand Down Expand Up @@ -298,7 +298,7 @@ function getPath(filename, basename) {
}

// eslint-disable-next-line complexity
function assertError(error, result) {
function assertError(result, error) {
if (typeof error === 'function') {
if (!(result instanceof error || error(result) === true)) {
throw result
Expand Down

0 comments on commit 9fcb418

Please sign in to comment.