just-test-node 1.4.3 → 2.0.0-alpha.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 (57) hide show
  1. package/README.md +11 -15
  2. package/lib/Discover.d.ts +25 -0
  3. package/lib/Discover.js +4 -0
  4. package/lib/OptionsDefinitions.d.ts +16 -0
  5. package/lib/OptionsDefinitions.js +61 -0
  6. package/lib/StackTrace.d.ts +1 -0
  7. package/lib/StackTrace.js +44 -0
  8. package/lib/Suite.d.ts +46 -0
  9. package/lib/Suite.js +113 -0
  10. package/lib/SuiteProvider.d.ts +9 -0
  11. package/lib/SuiteProvider.js +88 -0
  12. package/lib/Test.d.ts +13 -6
  13. package/lib/Test.js +41 -39
  14. package/lib/TestStage.d.ts +1 -1
  15. package/lib/TestStage.js +3 -0
  16. package/lib/code-position-resolution.d.ts +2 -0
  17. package/lib/code-position-resolution.js +50 -0
  18. package/lib/examples/dir-suite/@test-suite +0 -0
  19. package/lib/examples/dir-suite/child-dir-suite/@test-suite +0 -0
  20. package/lib/{exampleTestFile.test.d.ts → examples/dir-suite/child-dir-suite/childDirTests.test.d.ts} +0 -0
  21. package/lib/examples/dir-suite/child-dir-suite/childDirTests.test.js +9 -0
  22. package/lib/examples/dir-suite/inDirSuite.test.d.ts +2 -0
  23. package/lib/examples/dir-suite/inDirSuite.test.js +9 -0
  24. package/lib/examples/dir-suite/just-a-folder/inJustAFolderTest.d.ts +2 -0
  25. package/lib/examples/dir-suite/just-a-folder/inJustAFolderTest.js +9 -0
  26. package/lib/examples/exampleTestFile.test.d.ts +2 -0
  27. package/lib/examples/exampleTestFile.test.js +57 -0
  28. package/lib/help.d.ts +1 -1
  29. package/lib/help.js +3 -0
  30. package/lib/index.d.ts +1 -0
  31. package/lib/index.js +111 -70
  32. package/lib/reporters/JsonReporter.d.ts +20 -0
  33. package/lib/reporters/JsonReporter.js +39 -0
  34. package/lib/reporters/Reporter.d.ts +4 -0
  35. package/lib/reporters/Reporter.js +4 -0
  36. package/lib/reporters/SpecReporter.d.ts +14 -0
  37. package/lib/reporters/SpecReporter.js +90 -0
  38. package/lib/reporters/index.d.ts +3 -0
  39. package/lib/reporters/index.js +17 -0
  40. package/lib/run-results/SuiteRunResult.d.ts +11 -0
  41. package/lib/run-results/SuiteRunResult.js +19 -0
  42. package/lib/run-results/TestRunResult.d.ts +9 -0
  43. package/lib/run-results/TestRunResult.js +15 -0
  44. package/lib/run-results/index.d.ts +2 -0
  45. package/lib/run-results/index.js +16 -0
  46. package/package.json +69 -64
  47. package/lib/OptionsDefinition.d.ts +0 -4
  48. package/lib/OptionsDefinition.js +0 -2
  49. package/lib/PerformancePolyfill.d.ts +0 -1
  50. package/lib/PerformancePolyfill.js +0 -14
  51. package/lib/SpecReporter.d.ts +0 -12
  52. package/lib/SpecReporter.js +0 -74
  53. package/lib/TestRunResult.d.ts +0 -9
  54. package/lib/TestRunResult.js +0 -11
  55. package/lib/TestSuiteClass.d.ts +0 -27
  56. package/lib/TestSuiteClass.js +0 -85
  57. package/lib/exampleTestFile.test.js +0 -65
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SuiteRunResult = exports.SuiteResultStatus = void 0;
4
+ var SuiteResultStatus;
5
+ (function (SuiteResultStatus) {
6
+ SuiteResultStatus["Passed"] = "passed";
7
+ SuiteResultStatus["Failed"] = "failed";
8
+ SuiteResultStatus["Partial"] = "partial";
9
+ })(SuiteResultStatus = exports.SuiteResultStatus || (exports.SuiteResultStatus = {}));
10
+ class SuiteRunResult {
11
+ constructor(title, elapsed, status) {
12
+ this.title = title;
13
+ this.elapsed = elapsed;
14
+ this.status = status;
15
+ }
16
+ }
17
+ exports.SuiteRunResult = SuiteRunResult;
18
+
19
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bi1yZXN1bHRzL1N1aXRlUnVuUmVzdWx0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLElBQVksaUJBSVg7QUFKRCxXQUFZLGlCQUFpQjtJQUM1QixzQ0FBaUIsQ0FBQTtJQUNqQixzQ0FBaUIsQ0FBQTtJQUNqQix3Q0FBbUIsQ0FBQTtBQUNwQixDQUFDLEVBSlcsaUJBQWlCLEdBQWpCLHlCQUFpQixLQUFqQix5QkFBaUIsUUFJNUI7QUFFRCxNQUFhLGNBQWM7SUFDMUIsWUFBbUIsS0FBYSxFQUFTLE9BQWUsRUFBUyxNQUF5QjtRQUF2RSxVQUFLLEdBQUwsS0FBSyxDQUFRO1FBQVMsWUFBTyxHQUFQLE9BQU8sQ0FBUTtRQUFTLFdBQU0sR0FBTixNQUFNLENBQW1CO0lBQzFGLENBQUM7Q0FDRDtBQUhELHdDQUdDIiwiZmlsZSI6InJ1bi1yZXN1bHRzL1N1aXRlUnVuUmVzdWx0LmpzIiwic291cmNlUm9vdCI6Ii4uXFwuLlxcc3JjIn0=
@@ -0,0 +1,9 @@
1
+ import { TestStage } from "../TestStage";
2
+ export declare class TestRunResult {
3
+ title: string;
4
+ elapsed: number;
5
+ stage: TestStage;
6
+ passed: boolean;
7
+ reason?: any;
8
+ constructor(title: string, elapsed: number, stage: TestStage, passed: boolean, reason?: any);
9
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestRunResult = void 0;
4
+ class TestRunResult {
5
+ constructor(title, elapsed, stage, passed, reason) {
6
+ this.title = title;
7
+ this.elapsed = elapsed;
8
+ this.stage = stage;
9
+ this.passed = passed;
10
+ this.reason = reason;
11
+ }
12
+ }
13
+ exports.TestRunResult = TestRunResult;
14
+
15
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bi1yZXN1bHRzL1Rlc3RSdW5SZXN1bHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsTUFBYSxhQUFhO0lBQ3pCLFlBQW1CLEtBQWEsRUFBUyxPQUFlLEVBQVMsS0FBZ0IsRUFBUyxNQUFlLEVBQVMsTUFBWTtRQUEzRyxVQUFLLEdBQUwsS0FBSyxDQUFRO1FBQVMsWUFBTyxHQUFQLE9BQU8sQ0FBUTtRQUFTLFVBQUssR0FBTCxLQUFLLENBQVc7UUFBUyxXQUFNLEdBQU4sTUFBTSxDQUFTO1FBQVMsV0FBTSxHQUFOLE1BQU0sQ0FBTTtJQUM5SCxDQUFDO0NBQ0Q7QUFIRCxzQ0FHQyIsImZpbGUiOiJydW4tcmVzdWx0cy9UZXN0UnVuUmVzdWx0LmpzIiwic291cmNlUm9vdCI6Ii4uXFwuLlxcc3JjIn0=
@@ -0,0 +1,2 @@
1
+ export * from "./SuiteRunResult";
2
+ export * from "./TestRunResult";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./SuiteRunResult"), exports);
14
+ __exportStar(require("./TestRunResult"), exports);
15
+
16
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bi1yZXN1bHRzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLG1EQUFpQztBQUNqQyxrREFBZ0MiLCJmaWxlIjoicnVuLXJlc3VsdHMvaW5kZXguanMiLCJzb3VyY2VSb290IjoiLi5cXC4uXFxzcmMifQ==
package/package.json CHANGED
@@ -1,64 +1,69 @@
1
- {
2
- "name": "just-test-node",
3
- "version": "1.4.3",
4
- "description": "just-test on node.",
5
- "main": "./lib/index.js",
6
- "typings": "./lib/index.d.ts",
7
- "files": [
8
- "lib/"
9
- ],
10
- "scripts": {
11
- "test": "gulp build && node ./lib/index.js",
12
- "build": "gulp build",
13
- "prepublishOnly": "gulp clean && gulp build",
14
- "example": "gulp build && node ./lib/index.js"
15
- },
16
- "author": {
17
- "name": "Itay Ronen",
18
- "url": "https://gitlab.com/itayronen"
19
- },
20
- "homepage": "https://gitlab.com/itayronen/just-test-node",
21
- "repository": {
22
- "type": "git",
23
- "url": "https://gitlab.com/itayronen/just-test-node.git"
24
- },
25
- "license": "MIT",
26
- "keywords": [
27
- "test",
28
- "testing",
29
- "unit",
30
- "unit-test",
31
- "unittest",
32
- "just-test",
33
- "es",
34
- "es6",
35
- "node",
36
- "typescript"
37
- ],
38
- "publishConfig": {
39
- "registry": "https://registry.npmjs.org/"
40
- },
41
- "bin": {
42
- "just-test": "./lib/index.js",
43
- "just-test-node": "./lib/index.js"
44
- },
45
- "dependencies": {
46
- "chalk": "^2.4.1",
47
- "command-line-args": "^5.0.2",
48
- "glob": "^7.1.2",
49
- "itay-events": "^2.1.4",
50
- "just-test-api": "^1.1.0"
51
- },
52
- "devDependencies": {
53
- "@types/chalk": "^2.2.0",
54
- "@types/command-line-args": "^5.0.0",
55
- "@types/glob": "^5.0.35",
56
- "del": "^3.0.0",
57
- "gulp": "^3.9.1",
58
- "gulp-read": "0.0.1",
59
- "gulp-typescript": "^4.0.2",
60
- "itay-gulp-changed": "^1.1.1",
61
- "merge2": "^1.2.2",
62
- "typescript": "^2.8.3"
63
- }
64
- }
1
+ {
2
+ "name": "just-test-node",
3
+ "version": "2.0.0-alpha.1",
4
+ "description": "just-test on node.",
5
+ "main": "./lib/index.js",
6
+ "typings": "./lib/index.d.ts",
7
+ "files": [
8
+ "lib/"
9
+ ],
10
+ "scripts": {
11
+ "build": "gulp build",
12
+ "prepublishOnly": "gulp clean && gulp build",
13
+ "test": "gulp build && node ./lib/index.js --directorySuitesGlob=./lib/**/@test-suite",
14
+ "test-json": "npm run test -- --reporter=json",
15
+ "test-json-partial": "npm run test -- --reporter=json \"Simple test\"",
16
+ "test-discover": "npm run test -- --discover",
17
+ "test-ts": "gulp build && ts-node ./src/index.ts --glob=./src/**/*.test.ts --directorySuitesGlob=./src/**/@test-suite",
18
+ "test-ts-discover": "npm run test-ts -- --discover"
19
+ },
20
+ "author": {
21
+ "name": "Itay Ronen",
22
+ "url": "https://gitlab.com/itayronen"
23
+ },
24
+ "homepage": "https://gitlab.com/itayronen/just-test-node",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://gitlab.com/itayronen/just-test-node.git"
28
+ },
29
+ "license": "MIT",
30
+ "keywords": [
31
+ "test",
32
+ "testing",
33
+ "unit",
34
+ "unit-test",
35
+ "unittest",
36
+ "just-test",
37
+ "es",
38
+ "es6",
39
+ "node",
40
+ "typescript"
41
+ ],
42
+ "publishConfig": {
43
+ "registry": "https://registry.npmjs.org/"
44
+ },
45
+ "bin": {
46
+ "just-test": "./lib/index.js",
47
+ "just-test-node": "./lib/index.js"
48
+ },
49
+ "dependencies": {
50
+ "chalk": "^4.1.2",
51
+ "command-line-args": "^5.2.0",
52
+ "glob": "^7.2.0",
53
+ "itay-events": "^3.0.1",
54
+ "just-test-api": "^2.0.1"
55
+ },
56
+ "devDependencies": {
57
+ "@types/chalk": "^2.2.0",
58
+ "@types/command-line-args": "^5.2.0",
59
+ "@types/glob": "^7.2.0",
60
+ "del": "^6.0.0",
61
+ "gulp": "^4.0.2",
62
+ "gulp-read": "^1.0.1",
63
+ "gulp-sourcemaps": "^3.0.0",
64
+ "gulp-typescript": "^5.0.1",
65
+ "itay-gulp-changed": "^1.2.0",
66
+ "merge2": "^1.4.1",
67
+ "typescript": "^4.5.2"
68
+ }
69
+ }
@@ -1,4 +0,0 @@
1
- import * as args from "command-line-args";
2
- export interface OptionDefinition extends args.OptionDefinition {
3
- description: string;
4
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export declare function polyfillPerformance(): void;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function polyfillPerformance() {
4
- if (global && !global.performance) {
5
- const start = process.hrtime();
6
- global.performance = {
7
- now: function () {
8
- const end = process.hrtime(start);
9
- return Math.round((end[0] * 1000) + (end[1] / 1000000));
10
- }
11
- };
12
- }
13
- }
14
- exports.polyfillPerformance = polyfillPerformance;
@@ -1,12 +0,0 @@
1
- import { TestSuiteClass } from "./TestSuiteClass";
2
- export declare class SpecReporter {
3
- private output;
4
- private symbols;
5
- private indentation;
6
- private passedCount;
7
- private errors;
8
- constructor(output: Console);
9
- listenTo(suite: TestSuiteClass): void;
10
- private onEnd();
11
- private getTestFullTitle(test);
12
- }
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chalk_1 = require("chalk");
4
- class SpecReporter {
5
- constructor(output) {
6
- this.output = output;
7
- this.symbols = {
8
- ok: '✓',
9
- err: '✖',
10
- };
11
- this.indentation = " ";
12
- this.passedCount = 0;
13
- this.errors = [];
14
- }
15
- listenTo(suite) {
16
- let indent = "";
17
- suite.onSuiteStart.add(suite => {
18
- if (!suite.title)
19
- return;
20
- this.output.log();
21
- this.output.info(indent + suite.title);
22
- indent += this.indentation;
23
- });
24
- suite.onSuiteEnd.add(endedSuite => {
25
- indent = indent.substr(0, indent.length - this.indentation.length);
26
- if (endedSuite == suite) {
27
- this.onEnd();
28
- }
29
- });
30
- suite.onTestEnd.add(result => {
31
- if (result.passed) {
32
- this.passedCount++;
33
- this.output.log(chalk_1.default.green(`${indent}${this.symbols.ok} ${result.test.title}`));
34
- }
35
- else {
36
- this.errors.push(result);
37
- this.output.log(chalk_1.default.red(`${indent}${this.symbols.err} ${result.test.title}`));
38
- }
39
- });
40
- }
41
- onEnd() {
42
- for (let result of this.errors) {
43
- this.output.log();
44
- let title = this.getTestFullTitle(result.test);
45
- this.output.log(title);
46
- let isError = result.reason instanceof Error;
47
- let message = isError ?
48
- result.reason.message :
49
- JSON.stringify(result.reason);
50
- this.output.log(this.indentation + chalk_1.default.red(`${message}`));
51
- isError && this.output.log(this.indentation + `${result.reason.stack}`);
52
- }
53
- this.output.log();
54
- this.output.log(chalk_1.default.green(`${this.passedCount} passing`));
55
- if (this.errors.length > 0) {
56
- this.output.log(chalk_1.default.red(`${this.errors.length} failing`));
57
- }
58
- this.output.log();
59
- }
60
- getTestFullTitle(test) {
61
- let titles = [test.title];
62
- let parent = test.parent;
63
- while (parent && parent.title) {
64
- titles.push(parent.title);
65
- parent = parent.parent;
66
- }
67
- let title = titles.pop();
68
- while (titles.length > 0) {
69
- title += " -> " + titles.pop();
70
- }
71
- return title;
72
- }
73
- }
74
- exports.SpecReporter = SpecReporter;
@@ -1,9 +0,0 @@
1
- import { Test } from "./Test";
2
- import { TestStage } from "./TestStage";
3
- export declare class TestRunResult {
4
- test: Test;
5
- stage: TestStage;
6
- passed: boolean;
7
- reason: any;
8
- constructor(test: Test, stage: TestStage, passed: boolean, reason?: any);
9
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class TestRunResult {
4
- constructor(test, stage, passed, reason) {
5
- this.test = test;
6
- this.stage = stage;
7
- this.passed = passed;
8
- this.reason = reason;
9
- }
10
- }
11
- exports.TestRunResult = TestRunResult;
@@ -1,27 +0,0 @@
1
- import { TestSuite, TestParams } from "just-test-api";
2
- import { Event1 } from "itay-events";
3
- import { Test } from "./Test";
4
- import { TestRunResult } from "./TestRunResult";
5
- export interface RunParams {
6
- filter?: string;
7
- }
8
- export declare class TestSuiteClass implements TestSuite {
9
- title: string;
10
- parent?: TestSuiteClass;
11
- childrenSuites: TestSuiteClass[];
12
- tests: Test[];
13
- onSuiteStart: Event1<TestSuiteClass>;
14
- onSuiteEnd: Event1<TestSuiteClass>;
15
- onTestStart: Event1<Test>;
16
- onTestEnd: Event1<TestRunResult>;
17
- constructor();
18
- describe(title: string | {
19
- name: string;
20
- }, suiteFunction: (suite: TestSuiteClass) => void): void;
21
- test(title: string, testFunction: (test: TestParams) => Promise<void> | void): void;
22
- run(params: RunParams): Promise<boolean>;
23
- private getFilteredTests(params);
24
- countTotalTests(params: RunParams): number;
25
- private createLocalParams(params);
26
- private isPassingFilter(filter);
27
- }
@@ -1,85 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const itay_events_1 = require("itay-events");
12
- const Test_1 = require("./Test");
13
- class TestSuiteClass {
14
- constructor() {
15
- this.title = "";
16
- this.childrenSuites = [];
17
- this.tests = [];
18
- this.onSuiteStart = new itay_events_1.Event1();
19
- this.onSuiteEnd = new itay_events_1.Event1();
20
- this.onTestStart = new itay_events_1.Event1();
21
- this.onTestEnd = new itay_events_1.Event1();
22
- }
23
- describe(title, suiteFunction) {
24
- let childSuite = new TestSuiteClass();
25
- childSuite.title = typeof (title) === "string" ? title : title.name;
26
- childSuite.onTestStart.add(t => this.onTestStart.trigger(t));
27
- childSuite.onTestEnd.add(result => this.onTestEnd.trigger(result));
28
- childSuite.onSuiteStart.add(s => this.onSuiteStart.trigger(s));
29
- childSuite.onSuiteEnd.add(s => this.onSuiteEnd.trigger(s));
30
- childSuite.parent = this;
31
- this.childrenSuites.push(childSuite);
32
- suiteFunction(childSuite);
33
- }
34
- test(title, testFunction) {
35
- this.tests.push(new Test_1.Test(title, testFunction, this));
36
- }
37
- run(params) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- let passed = true;
40
- params = this.createLocalParams(params);
41
- let filteredTests = this.getFilteredTests(params);
42
- this.onSuiteStart.trigger(this);
43
- for (let test of filteredTests) {
44
- this.onTestStart.trigger(test);
45
- let result = yield test.run();
46
- passed = passed && result.passed;
47
- this.onTestEnd.trigger(result);
48
- }
49
- for (let suite of this.childrenSuites) {
50
- if (suite.countTotalTests(params) > 0) {
51
- let suitePassed = yield suite.run(params);
52
- passed = passed && suitePassed;
53
- }
54
- }
55
- this.onSuiteEnd.trigger(this);
56
- return passed;
57
- });
58
- }
59
- getFilteredTests(params) {
60
- if (!params.filter)
61
- return this.tests;
62
- let filter = params.filter.toLowerCase();
63
- return this.tests.filter(t => t.title.toLowerCase().indexOf(filter) >= 0);
64
- }
65
- countTotalTests(params) {
66
- params = this.createLocalParams(params);
67
- let filteredTests = this.getFilteredTests(params);
68
- let count = filteredTests.length;
69
- for (let childSuite of this.childrenSuites) {
70
- count += childSuite.countTotalTests(params);
71
- }
72
- return count;
73
- }
74
- createLocalParams(params) {
75
- params = Object.assign({}, params);
76
- if (this.isPassingFilter(params.filter)) {
77
- params.filter = undefined;
78
- }
79
- return params;
80
- }
81
- isPassingFilter(filter) {
82
- return !filter || this.title.toLowerCase().indexOf(filter.toLowerCase()) >= 0;
83
- }
84
- }
85
- exports.TestSuiteClass = TestSuiteClass;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- function someFunction() { }
12
- function default_1(suite) {
13
- suite.describe("Some suite title", suite => {
14
- suite.describe("Pass suite", suite => {
15
- suite.test("Nothing", t => {
16
- });
17
- suite.test("Async", (t) => __awaiter(this, void 0, void 0, function* () {
18
- yield Promise.resolve("Hi");
19
- }));
20
- suite.describe(someFunction, suite => {
21
- suite.test("Nothing", t => {
22
- });
23
- });
24
- });
25
- suite.describe("Fail suite", suite => {
26
- suite.test("No stage error", t => {
27
- throw "asdf";
28
- });
29
- suite.test("Arrage error", t => {
30
- t.arrange();
31
- throw "asdf";
32
- });
33
- suite.test("Act error", t => {
34
- t.act();
35
- throw "asdf";
36
- });
37
- suite.test("Assert error", t => {
38
- t.assert();
39
- throw "asdf";
40
- });
41
- suite.test("Throw Error", t => {
42
- t.assert();
43
- throw new Error("Some error message.");
44
- });
45
- suite.test("Throws after await", (t) => __awaiter(this, void 0, void 0, function* () {
46
- yield new Promise(r => setTimeout(r, 1));
47
- t.assert();
48
- throw "error";
49
- }));
50
- suite.test("Timeout reached.", (t) => __awaiter(this, void 0, void 0, function* () {
51
- t.timeout = 1;
52
- yield new Promise(r => setTimeout(r, 100));
53
- }));
54
- });
55
- suite.describe("Pass suite 2", suite => {
56
- suite.test("Nothing", t => {
57
- });
58
- });
59
- });
60
- suite.describe("Some suite title2", suite => {
61
- suite.test("Nothing", t => {
62
- });
63
- });
64
- }
65
- exports.default = default_1;