@japa/runner 2.3.0 → 2.5.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
@@ -196,6 +196,7 @@ Examples:
196
196
  */
197
197
  function configure(options) {
198
198
  const defaultOptions = {
199
+ cliArgs: {},
199
200
  cwd: process.cwd(),
200
201
  files: [],
201
202
  suites: [],
@@ -238,6 +239,7 @@ function processCliArgs(argv) {
238
239
  });
239
240
  const config = {
240
241
  filters: {},
242
+ cliArgs: parsed,
241
243
  };
242
244
  processAsString(parsed, 'tags', (tags) => (config.filters.tags = tags));
243
245
  processAsString(parsed, 'ignoreTags', (tags) => {
@@ -426,8 +428,9 @@ function test(title, callback) {
426
428
  ensureIsConfigured('Cannot add test without configuring the test runner');
427
429
  const testInstance = new main_1.Test(title, getContext, emitter, runnerOptions.refiner, activeGroup);
428
430
  /**
429
- * Set filename
431
+ * Set filename and suite
430
432
  */
433
+ testInstance.options.meta.suite = activeSuite;
431
434
  testInstance.options.meta.fileName = recentlyImportedFile;
432
435
  /**
433
436
  * Define timeout on the test when exists globally
@@ -466,8 +469,9 @@ test.group = function (title, callback) {
466
469
  }
467
470
  activeGroup = new main_1.Group(title, emitter, runnerOptions.refiner);
468
471
  /**
469
- * Set filename
472
+ * Set filename and suite
470
473
  */
474
+ activeGroup.options.meta.suite = activeSuite;
471
475
  activeGroup.options.meta.fileName = recentlyImportedFile;
472
476
  /**
473
477
  * 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;
@@ -34,6 +34,7 @@ export type RunnerHooks = {
34
34
  * Base configuration options
35
35
  */
36
36
  export type BaseConfig = {
37
+ cliArgs?: Record<string, any>;
37
38
  cwd?: string;
38
39
  timeout?: number;
39
40
  plugins?: PluginFn[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@japa/runner",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "Runner for Japa testing framework",
5
5
  "main": "build/index.js",
6
6
  "files": [
@@ -36,7 +36,7 @@
36
36
  "devDependencies": {
37
37
  "@adonisjs/mrm-preset": "^5.0.3",
38
38
  "@adonisjs/require-ts": "^2.0.13",
39
- "@types/node": "^18.11.19",
39
+ "@types/node": "^18.14.0",
40
40
  "commitizen": "^4.3.0",
41
41
  "cz-conventional-changelog": "^3.3.0",
42
42
  "del-cli": "^5.0.0",