-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Testdeck Version
0.0.6
Testdeck Package
-
@testdeck/core -
@testdeck/mocha
NodeJS Version
- 10
Mocha / Jasmine / Jest Version
- Mocha: 6.1.4
@types/mocha: 5.2.6
Operating System
- Mac OS X
Actual Behaviour
Consider the following test:
import { suite, test } from "@testdeck/mocha";
[{ title: 'world'}, { title: 'github'}]
.forEach(({title}) => {
@suite(`Hello ${title}`)
class Hello {
constructor() {
console.log('');
console.log(`Hello ${title}`);
}
@test
test1() {
console.log('test1');
}
@test
test2() {
console.log('test2');
}
}
});Hello class is instantiated 4 times, i.e. once per test
Hello world
test1
Hello world
test2
Hello github
test1
Hello github
test2
Expected Behaviour
Only 2 Hello class instances should have been created
Hello world
test1
test2
Hello github
test1
test2
Additional Information
Official documentation Instance Lifecycle Hooks is providing the impression that @suite class may have an internal state, which is clearly not true.
Please note, that suite scope state can only be achieved via class instance or actual mocha suite. IMHO it's a bad practice to pollute mocha suite context.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request