@japa/runner 2.5.1 → 3.0.0-1

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.
Files changed (69) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/factories/main.d.ts +3 -0
  3. package/build/factories/main.d.ts.map +1 -0
  4. package/build/factories/main.js +2 -0
  5. package/build/factories/runner.d.ts +10 -0
  6. package/build/factories/runner.d.ts.map +1 -0
  7. package/build/factories/runner.js +155 -0
  8. package/build/index.d.ts +8 -29
  9. package/build/index.js +93 -466
  10. package/build/modules/core/main.d.ts +29 -0
  11. package/build/modules/core/main.d.ts.map +1 -0
  12. package/build/modules/core/main.js +68 -0
  13. package/build/modules/core/reporters/base.d.ts +21 -0
  14. package/build/modules/core/reporters/base.d.ts.map +1 -0
  15. package/build/modules/core/reporters/base.js +136 -0
  16. package/build/modules/core/types.d.ts +6 -0
  17. package/build/modules/core/types.d.ts.map +1 -0
  18. package/build/modules/core/types.js +1 -0
  19. package/build/src/cli_parser.d.ts +6 -0
  20. package/build/src/cli_parser.d.ts.map +1 -0
  21. package/build/src/cli_parser.js +49 -0
  22. package/build/src/config_manager.d.ts +7 -0
  23. package/build/src/config_manager.d.ts.map +1 -0
  24. package/build/src/config_manager.js +115 -0
  25. package/build/src/create_test.d.ts +16 -0
  26. package/build/src/create_test.d.ts.map +1 -0
  27. package/build/src/create_test.js +33 -0
  28. package/build/src/debug.d.ts +2 -1
  29. package/build/src/debug.d.ts.map +1 -0
  30. package/build/src/debug.js +2 -12
  31. package/build/src/exceptions_manager.d.ts +7 -0
  32. package/build/src/exceptions_manager.d.ts.map +1 -0
  33. package/build/src/exceptions_manager.js +58 -0
  34. package/build/src/files_manager.d.ts +7 -0
  35. package/build/src/files_manager.d.ts.map +1 -0
  36. package/build/src/files_manager.js +28 -0
  37. package/build/src/helpers.d.ts +23 -0
  38. package/build/src/helpers.d.ts.map +1 -0
  39. package/build/src/helpers.js +2 -0
  40. package/build/src/hooks.d.ts +9 -0
  41. package/build/src/hooks.d.ts.map +1 -0
  42. package/build/src/hooks.js +26 -0
  43. package/build/src/planner.d.ts +18 -0
  44. package/build/src/planner.d.ts.map +1 -0
  45. package/build/src/planner.js +67 -0
  46. package/build/src/plugins/retry.d.ts +8 -0
  47. package/build/src/plugins/retry.d.ts.map +1 -0
  48. package/build/src/plugins/retry.js +42 -0
  49. package/build/src/reporters/dot.d.ts +7 -0
  50. package/build/src/reporters/dot.d.ts.map +1 -0
  51. package/build/src/reporters/dot.js +24 -0
  52. package/build/src/reporters/main.d.ts +5 -0
  53. package/build/src/reporters/main.d.ts.map +1 -0
  54. package/build/src/reporters/main.js +21 -0
  55. package/build/src/reporters/ndjson.d.ts +12 -0
  56. package/build/src/reporters/ndjson.d.ts.map +1 -0
  57. package/build/src/reporters/ndjson.js +61 -0
  58. package/build/src/reporters/spec.d.ts +11 -0
  59. package/build/src/reporters/spec.d.ts.map +1 -0
  60. package/build/src/reporters/spec.js +103 -0
  61. package/build/src/types.d.ts +48 -49
  62. package/build/src/types.d.ts.map +1 -0
  63. package/build/src/types.js +1 -10
  64. package/build/src/validator.d.ts +11 -0
  65. package/build/src/validator.d.ts.map +1 -0
  66. package/build/src/validator.js +46 -0
  67. package/package.json +78 -83
  68. package/build/src/core/main.d.ts +0 -49
  69. package/build/src/core/main.js +0 -87
package/package.json CHANGED
@@ -1,30 +1,40 @@
1
1
  {
2
2
  "name": "@japa/runner",
3
- "version": "2.5.1",
3
+ "version": "3.0.0-1",
4
4
  "description": "Runner for Japa testing framework",
5
5
  "main": "build/index.js",
6
+ "type": "module",
6
7
  "files": [
8
+ "build/factories",
9
+ "build/modules",
7
10
  "build/src",
8
11
  "build/index.d.ts",
9
12
  "build/index.js"
10
13
  ],
14
+ "engines": {
15
+ "node": ">=18.16.0"
16
+ },
11
17
  "exports": {
12
- ".": "./build/index.js"
18
+ ".": "./build/index.js",
19
+ "./types": "./build/src/types.js",
20
+ "./reporters": "./build/src/reporters/main.js",
21
+ "./factories": "./build/factories/main.js",
22
+ "./core": "./build/modules/core/main.js"
13
23
  },
14
24
  "scripts": {
15
- "mrm": "mrm --preset=@adonisjs/mrm-preset",
16
25
  "pretest": "npm run lint",
17
- "test": "cross-env NODE_DEBUG=japa:runner node .bin/test.js",
18
- "clean": "del-cli build",
26
+ "test": "cross-env NODE_ENV=japa:runner c8 npm run quick:test",
27
+ "quick:test": "glob -c \"node --enable-source-maps --loader=ts-node/esm --test\" \"tests/*.spec.ts\"",
28
+ "clean": "del build",
29
+ "typecheck": "tsc --noEmit",
19
30
  "compile": "npm run lint && npm run clean && tsc",
20
31
  "build": "npm run compile",
32
+ "release": "np",
21
33
  "prepublishOnly": "npm run build",
22
34
  "lint": "eslint . --ext=.ts",
23
35
  "format": "prettier --write .",
24
- "commit": "git-cz",
25
- "release": "np --message=\"chore(release): %s\"",
26
36
  "version": "npm run build",
27
- "sync-labels": "github-label-sync --labels ./node_modules/@adonisjs/mrm-preset/gh-labels.json japa/runner"
37
+ "sync-labels": "github-label-sync --labels .github/labels.json japa/runner"
28
38
  },
29
39
  "keywords": [
30
40
  "japa",
@@ -34,89 +44,42 @@
34
44
  "author": "virk,japa",
35
45
  "license": "MIT",
36
46
  "devDependencies": {
37
- "@adonisjs/mrm-preset": "^5.0.3",
47
+ "@adonisjs/eslint-config": "^1.1.5",
48
+ "@adonisjs/prettier-config": "^1.1.5",
38
49
  "@adonisjs/require-ts": "^2.0.13",
39
- "@types/node": "^18.14.0",
40
- "commitizen": "^4.3.0",
50
+ "@adonisjs/tsconfig": "^1.1.5",
51
+ "@commitlint/cli": "^17.6.6",
52
+ "@commitlint/config-conventional": "^17.6.6",
53
+ "@swc/core": "^1.3.66",
54
+ "@types/chai": "^4.3.5",
55
+ "@types/chai-subset": "^1.3.3",
56
+ "@types/find-cache-dir": "^3.2.1",
57
+ "@types/ms": "^0.7.31",
58
+ "@types/node": "^20.3.2",
59
+ "c8": "^8.0.0",
60
+ "chai": "^4.3.7",
61
+ "chai-subset": "^1.6.0",
41
62
  "cross-env": "^7.0.3",
42
- "cz-conventional-changelog": "^3.3.0",
43
63
  "del-cli": "^5.0.0",
44
- "eslint": "^8.33.0",
45
- "eslint-config-prettier": "^8.6.0",
46
- "eslint-plugin-adonis": "^2.1.1",
47
- "eslint-plugin-prettier": "^4.2.1",
48
- "github-label-sync": "^2.2.0",
64
+ "eslint": "^8.36.0",
65
+ "github-label-sync": "^2.3.1",
66
+ "glob": "^10.3.0",
49
67
  "husky": "^8.0.3",
50
68
  "japa": "^4.0.0",
51
- "mrm": "^4.1.13",
52
- "np": "^7.6.3",
53
- "prettier": "^2.8.4",
54
- "typescript": "^4.9.5"
55
- },
56
- "mrmConfig": {
57
- "core": false,
58
- "license": "MIT",
59
- "services": [
60
- "github-actions"
61
- ],
62
- "minNodeVersion": "16.13.1",
63
- "probotApps": [
64
- "stale",
65
- "lock"
66
- ],
67
- "runGhActionsOnWindows": true
68
- },
69
- "eslintConfig": {
70
- "extends": [
71
- "plugin:adonis/typescriptPackage",
72
- "prettier"
73
- ],
74
- "plugins": [
75
- "prettier"
76
- ],
77
- "rules": {
78
- "prettier/prettier": [
79
- "error",
80
- {
81
- "endOfLine": "auto"
82
- }
83
- ]
84
- }
85
- },
86
- "eslintIgnore": [
87
- "build"
88
- ],
89
- "prettier": {
90
- "trailingComma": "es5",
91
- "semi": false,
92
- "singleQuote": true,
93
- "useTabs": false,
94
- "quoteProps": "consistent",
95
- "bracketSpacing": true,
96
- "arrowParens": "always",
97
- "printWidth": 100
98
- },
99
- "config": {
100
- "commitizen": {
101
- "path": "cz-conventional-changelog"
102
- }
103
- },
104
- "np": {
105
- "contents": ".",
106
- "anyBranch": false
69
+ "np": "^8.0.4",
70
+ "prettier": "^2.8.8",
71
+ "ts-node": "^10.9.1",
72
+ "typescript": "^5.1.3"
107
73
  },
108
74
  "dependencies": {
109
- "@japa/core": "^7.3.2",
110
- "@japa/errors-printer": "^2.1.0",
111
- "@poppinss/cliui": "^3.0.5",
112
- "@poppinss/hooks": "^6.0.2-0",
75
+ "@japa/core": "^8.0.0-6",
76
+ "@japa/errors-printer": "^3.0.0-4",
77
+ "@poppinss/cliui": "^6.1.1-2",
78
+ "@poppinss/hooks": "^7.1.1-3",
113
79
  "fast-glob": "^3.2.12",
80
+ "find-cache-dir": "^4.0.0",
114
81
  "getopts": "^2.3.0",
115
- "inclusion": "^1.0.1"
116
- },
117
- "publishConfig": {
118
- "access": "public",
119
- "tag": "latest"
82
+ "ms": "^2.1.3"
120
83
  },
121
84
  "directories": {
122
85
  "test": "test"
@@ -128,5 +91,37 @@
128
91
  "bugs": {
129
92
  "url": "https://github.com/japa/runner/issues"
130
93
  },
131
- "homepage": "https://github.com/japa/runner#readme"
94
+ "homepage": "https://github.com/japa/runner#readme",
95
+ "publishConfig": {
96
+ "access": "public",
97
+ "tag": "next"
98
+ },
99
+ "np": {
100
+ "message": "chore(release): %s",
101
+ "tag": "next",
102
+ "branch": "main",
103
+ "anyBranch": false
104
+ },
105
+ "commitlint": {
106
+ "extends": [
107
+ "@commitlint/config-conventional"
108
+ ]
109
+ },
110
+ "prettier": "@adonisjs/prettier-config",
111
+ "eslintConfig": {
112
+ "extends": "@adonisjs/eslint-config/package"
113
+ },
114
+ "c8": {
115
+ "reporter": [
116
+ "text",
117
+ "html"
118
+ ],
119
+ "exclude": [
120
+ "tests/**",
121
+ "tests_helpers/**",
122
+ "factories/**",
123
+ "modules/core/**",
124
+ "src/reporters/**"
125
+ ]
126
+ }
132
127
  }
@@ -1,49 +0,0 @@
1
- import { DataSetNode, Test as BaseTest, Group as BaseGroup, Suite as BaseSuite, Runner as BaseRunner, TestHooksCleanupHandler, TestContext as BaseTestContext } from '@japa/core';
2
- /**
3
- * Runner specific test context. Here we extend the test context to register
4
- * cleanup methods with the test and register hooks to get notified when
5
- * a new instance of test context is created.
6
- */
7
- export declare class TestContext extends BaseTestContext {
8
- test: Test;
9
- /**
10
- * Methods to call after the test context instance
11
- * is created
12
- */
13
- static createdCallbacks: ((context: TestContext) => void)[];
14
- /**
15
- * Register a function to get notified when an instance of test
16
- * context is created. The callback must be synchronous
17
- */
18
- static created(callback: (context: TestContext) => void): typeof TestContext;
19
- /**
20
- * Register a cleanup function. Cleanup functions are called after
21
- * the test finishes
22
- */
23
- cleanup: (handler: TestHooksCleanupHandler<this>) => void;
24
- constructor(test: Test);
25
- }
26
- /**
27
- * Runner specific Test with a fixed TestContext static type.
28
- */
29
- export declare class Test<TestData extends DataSetNode = undefined> extends BaseTest<TestContext, TestData> {
30
- static disposeCallbacks: never[];
31
- }
32
- /**
33
- * Runner specific Group with a fixed TestContext static type.
34
- */
35
- export declare class Group extends BaseGroup<TestContext> {
36
- }
37
- /**
38
- * Runner specific Suite with a fixed TestContext static type.
39
- */
40
- export declare class Suite extends BaseSuite<TestContext> {
41
- onGroup(callback: (group: Group) => void): this;
42
- onTest(callback: (test: Test<any>) => void): this;
43
- }
44
- /**
45
- * Runner specific tests Runner with a fixed TestContext static type.
46
- */
47
- export declare class Runner extends BaseRunner<TestContext> {
48
- onSuite(callback: (suite: Suite) => void): this;
49
- }
@@ -1,87 +0,0 @@
1
- "use strict";
2
- /*
3
- * @japa/runner
4
- *
5
- * (c) Japa.dev
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- var __importDefault = (this && this.__importDefault) || function (mod) {
11
- return (mod && mod.__esModule) ? mod : { "default": mod };
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.Runner = exports.Suite = exports.Group = exports.Test = exports.TestContext = void 0;
15
- const core_1 = require("@japa/core");
16
- const debug_1 = __importDefault(require("../debug"));
17
- /**
18
- * Runner specific test context. Here we extend the test context to register
19
- * cleanup methods with the test and register hooks to get notified when
20
- * a new instance of test context is created.
21
- */
22
- class TestContext extends core_1.TestContext {
23
- /**
24
- * Register a function to get notified when an instance of test
25
- * context is created. The callback must be synchronous
26
- */
27
- static created(callback) {
28
- (0, debug_1.default)('registering test context created hook "%s"', callback);
29
- this.createdCallbacks.push(callback);
30
- return this;
31
- }
32
- constructor(test) {
33
- super();
34
- this.test = test;
35
- this.cleanup = (handler) => {
36
- test.cleanup(handler);
37
- };
38
- /**
39
- * Invoke ready callbacks
40
- */
41
- const Constructor = this.constructor;
42
- Constructor.createdCallbacks.forEach((callback) => callback(this));
43
- }
44
- }
45
- exports.TestContext = TestContext;
46
- /**
47
- * Methods to call after the test context instance
48
- * is created
49
- */
50
- TestContext.createdCallbacks = [];
51
- /**
52
- * Runner specific Test with a fixed TestContext static type.
53
- */
54
- class Test extends core_1.Test {
55
- }
56
- exports.Test = Test;
57
- Test.disposeCallbacks = [];
58
- /**
59
- * Runner specific Group with a fixed TestContext static type.
60
- */
61
- class Group extends core_1.Group {
62
- }
63
- exports.Group = Group;
64
- /**
65
- * Runner specific Suite with a fixed TestContext static type.
66
- */
67
- class Suite extends core_1.Suite {
68
- onGroup(callback) {
69
- super.onGroup(callback);
70
- return this;
71
- }
72
- onTest(callback) {
73
- super.onTest(callback);
74
- return this;
75
- }
76
- }
77
- exports.Suite = Suite;
78
- /**
79
- * Runner specific tests Runner with a fixed TestContext static type.
80
- */
81
- class Runner extends core_1.Runner {
82
- onSuite(callback) {
83
- super.onSuite(callback);
84
- return this;
85
- }
86
- }
87
- exports.Runner = Runner;