@japa/runner 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -426,8 +426,9 @@ function test(title, callback) {
426
426
  ensureIsConfigured('Cannot add test without configuring the test runner');
427
427
  const testInstance = new main_1.Test(title, getContext, emitter, runnerOptions.refiner, activeGroup);
428
428
  /**
429
- * Set filename
429
+ * Set filename and suite
430
430
  */
431
+ testInstance.options.meta.suite = activeSuite;
431
432
  testInstance.options.meta.fileName = recentlyImportedFile;
432
433
  /**
433
434
  * Define timeout on the test when exists globally
@@ -466,8 +467,9 @@ test.group = function (title, callback) {
466
467
  }
467
468
  activeGroup = new main_1.Group(title, emitter, runnerOptions.refiner);
468
469
  /**
469
- * Set filename
470
+ * Set filename and suite
470
471
  */
472
+ activeGroup.options.meta.suite = activeSuite;
471
473
  activeGroup.options.meta.fileName = recentlyImportedFile;
472
474
  /**
473
475
  * Add group to the default suite
@@ -24,6 +24,9 @@ export declare class Test<TestData extends DataSetNode = undefined> extends Base
24
24
  export declare class Group extends BaseGroup<TestContext> {
25
25
  }
26
26
  export declare class Suite extends BaseSuite<TestContext> {
27
+ onGroup(callback: (group: Group) => void): this;
28
+ onTest(callback: (test: Test<any>) => void): this;
27
29
  }
28
30
  export declare class Runner extends BaseRunner<TestContext> {
31
+ onSuite(callback: (suite: Suite) => void): this;
29
32
  }
@@ -46,8 +46,20 @@ class Group extends core_1.Group {
46
46
  }
47
47
  exports.Group = Group;
48
48
  class Suite extends core_1.Suite {
49
+ onGroup(callback) {
50
+ super.onGroup(callback);
51
+ return this;
52
+ }
53
+ onTest(callback) {
54
+ super.onTest(callback);
55
+ return this;
56
+ }
49
57
  }
50
58
  exports.Suite = Suite;
51
59
  class Runner extends core_1.Runner {
60
+ onSuite(callback) {
61
+ super.onSuite(callback);
62
+ return this;
63
+ }
52
64
  }
53
65
  exports.Runner = Runner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@japa/runner",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Runner for Japa testing framework",
5
5
  "main": "build/index.js",
6
6
  "files": [