Skip to content

Commit

Permalink
fix(core): bind class instances to methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Jul 7, 2022
1 parent 61bb610 commit a80b685
Show file tree
Hide file tree
Showing 2 changed files with 6 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
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ 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 a80b685

Please sign in to comment.