pietr 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -9,7 +9,7 @@ To use it, just import it like you would any other module and define your tests
9
9
  ## Installation
10
10
 
11
11
  ```bash
12
- npm intsall --save-dev pietr
12
+ npm install --save-dev pietr
13
13
  ```
14
14
 
15
15
  ## Why yet another test runner?
@@ -87,4 +87,4 @@ Also, as with most other runners, you can pre-include a script:
87
87
 
88
88
  ## Limitations
89
89
 
90
- `pietr` does not support asynchronous functions, yet. I'm planning on adding async support via `Promise`s, but don't hold your breath.
90
+ `pietr` does not support asynchronous functions, yet. I'm planning to add async support via `Promise`s, but don't hold your breath.
package/bin/pietr CHANGED
File without changes
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { TestFn, test };
2
- declare type TestFn = () => any;
2
+ type TestFn = () => any;
3
3
  declare function test(f: TestFn): void;
4
4
  declare function test(title: string, f: TestFn): void;
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.test = test;
3
4
  const cli_script_utils_1 = require("cli-script-utils");
4
5
  const queue = [];
5
6
  const failed = [];
@@ -8,11 +9,10 @@ let timeoutToken = undefined;
8
9
  function test(arg1, arg2) {
9
10
  const testFn = typeof arg1 === 'function' ? arg1 : arg2;
10
11
  const title = typeof arg1 === 'string' ? arg1 : testFn.name;
11
- title || cli_script_utils_1.fail('Neither test title, nor function name provided', test);
12
+ title || (0, cli_script_utils_1.fail)('Neither test title, nor function name provided', test);
12
13
  queue.push([title, testFn]);
13
14
  dispatch();
14
15
  }
15
- exports.test = test;
16
16
  function dispatch() {
17
17
  if (!timeoutToken) {
18
18
  timeoutToken = setTimeout(tick, 0);
@@ -55,10 +55,10 @@ function reportAndExit() {
55
55
  }
56
56
  }
57
57
  }
58
- cli_script_utils_1.exit(failed.length && 1);
58
+ (0, cli_script_utils_1.exit)(failed.length && 1);
59
59
  }
60
60
  function showDiff(err) {
61
61
  return err
62
- && ((('showDiff' in err) && err.showDiff !== false)
63
- || (('actual' in err) && ('expected' in err)));
62
+ && ((!('showDiff' in err) || err.showDiff !== false)
63
+ && (('actual' in err) && ('expected' in err)));
64
64
  }
package/lib/pietr.js CHANGED
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_script_utils_1 = require("cli-script-utils");
4
- const toRequire = cli_script_utils_1.getValueOption('--require');
5
- const pattern = cli_script_utils_1.getValueOption('--pattern') || cli_script_utils_1.die(syntax());
4
+ const toRequire = (0, cli_script_utils_1.getValueOption)('--require');
5
+ const pattern = (0, cli_script_utils_1.getValueOption)('--pattern') || (0, cli_script_utils_1.die)(syntax());
6
6
  async function main() {
7
7
  if (toRequire) {
8
- await Promise.resolve().then(() => require(toRequire));
8
+ await import(toRequire);
9
9
  }
10
- const path = await Promise.resolve().then(() => require('path'));
10
+ const path = await import('path');
11
11
  const importPath = path.resolve('.');
12
- const files = cli_script_utils_1.glob('.', pattern);
12
+ const files = (0, cli_script_utils_1.glob)('.', pattern);
13
13
  for (const f of files) {
14
- await Promise.resolve().then(() => require(importPath + '/' + f));
14
+ await import(importPath + '/' + f);
15
15
  }
16
16
  }
17
17
  main().catch(e => setTimeout(() => { throw e; }, 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pietr",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
 
6
6
  "description": "A simple, lightweight nodejs test runner",
@@ -33,6 +33,6 @@
33
33
 
34
34
  "scripts": {
35
35
  "build-lib": "tsc && rm lib/pietr.d.ts",
36
- "prepublishOnly": "build-lib"
36
+ "prepublishOnly": "npm run build-lib"
37
37
  }
38
38
  }