Skip to content

Commit

Permalink
Merge pull request #1 from AthennaIO/develop
Browse files Browse the repository at this point in the history
fix(core): bind class instances to methods
  • Loading branch information
jlenon7 committed Jul 7, 2022
2 parents 61bb610 + 5a1516e commit 406461e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/test",
"version": "1.0.0",
"version": "1.0.1",
"description": "Template for new projects.",
"license": "MIT",
"author": "João Lenon <lenon@athenna.io>",
Expand Down
12 changes: 7 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ export class Test {
*/
convert() {
test.group(this.constructor.name, suite => {
if (this.beforeAll) suite.setup(this.beforeAll)
if (this.beforeEach) suite.each.setup(this.beforeEach)
if (this.afterAll) suite.teardown(this.afterAll)
if (this.afterEach) suite.each.teardown(this.afterEach)
if (this.beforeAll) suite.setup(this.beforeAll.bind(this))
if (this.beforeEach) suite.each.setup(this.beforeEach.bind(this))
if (this.afterAll) suite.teardown(this.afterAll.bind(this))
if (this.afterEach) suite.each.teardown(this.afterEach.bind(this))

this.testNames.forEach(testName => {
const japaTest = test(testName, this[testName]).timeout(this.timeout)
const japaTest = test(testName, this[testName].bind(this)).timeout(
this.timeout,
)

if (this.runOnly[0] === '*') {
return
Expand Down

0 comments on commit 406461e

Please sign in to comment.