now testing properly

This commit is contained in:
Philipp Kunz 2017-03-26 22:01:33 +02:00
parent c54644949e
commit 638c1a8c8c
8 changed files with 1636 additions and 66 deletions

View File

@ -21,7 +21,7 @@ minimal and fast loading plugin for startup time measuring
## Usage
Use TypeScript for best in class instellisense.
```typescript
```javascript
// Put the following at the start of your module
import * as early from "early";
early.start("myModuleName");

5
dist/index.js vendored
View File

@ -1,4 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
const beautycolor = require("beautycolor");
const smartq = require("smartq");
@ -22,8 +23,8 @@ exports.stop = () => {
let endTime = Date.now();
let earlyExecutionTime = (endTime - startTime);
let earlyExecutionTimeString = (earlyExecutionTime / 1000).toString();
console.log(`... finished loading within ${beautycolor.coloredString(earlyExecutionTimeString, 'blue')}`);
console.log(`OK! -> finished loading within ${beautycolor.coloredString(earlyExecutionTimeString, 'blue')}`);
done.resolve(earlyExecutionTime);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLDJDQUEwQztBQUMxQyxpQ0FBZ0M7QUFFaEMsSUFBSSxNQUFNLEdBQVksS0FBSyxDQUFBO0FBQzNCLElBQUksVUFBVSxHQUFXLHVCQUF1QixDQUFBO0FBQ2hELElBQUksU0FBUyxHQUFHLElBQUksQ0FBQyxHQUFHLEVBQUUsQ0FBQTtBQUUxQixFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDdEMsTUFBTSxHQUFHLElBQUksQ0FBQTtBQUNmLENBQUM7QUFFRDs7R0FFRztBQUNRLFFBQUEsS0FBSyx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sd0JBQXdCLEVBQUUsTUFBTSxDQUFDLEVBQUUsQ0FBQyxDQUFBO0lBQzVHLElBQUksQ0FBQyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQTtJQUNoQyxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtBQUNyQixDQUFDLENBQUEifQ==

View File

@ -21,8 +21,8 @@
},
"homepage": "https://gitlab.com/pushrocks/early#readme",
"devDependencies": {
"npmts-g": "^6.0.0",
"typings-test": "^1.0.3"
"smartdelay": "^1.0.1",
"tapbundle": "^1.0.5"
},
"dependencies": {
"beautycolor": "^1.0.7",

1
test/test.d.ts vendored
View File

@ -1 +0,0 @@
import 'typings-test';

View File

@ -1,17 +0,0 @@
"use strict";
require("typings-test");
const early = require("../dist/index");
describe('early', function () {
it('.start()', function (done) {
this.timeout(10000);
early.start('early');
setTimeout(done, 5000);
});
it('.stop()', function (done) {
early.stop()
.then(() => {
done();
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQix1Q0FBdUM7QUFFdkMsUUFBUSxDQUFDLE9BQU8sRUFBRTtJQUNoQixFQUFFLENBQUMsVUFBVSxFQUFFLFVBQVUsSUFBSTtRQUMzQixJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFBO1FBQ25CLEtBQUssQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDcEIsVUFBVSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQTtJQUN4QixDQUFDLENBQUMsQ0FBQTtJQUNGLEVBQUUsQ0FBQyxTQUFTLEVBQUUsVUFBVSxJQUFJO1FBQzFCLEtBQUssQ0FBQyxJQUFJLEVBQUU7YUFDVCxJQUFJLENBQUM7WUFDSixJQUFJLEVBQUUsQ0FBQTtRQUNSLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUMsQ0FBQSJ9

View File

@ -1,16 +1,11 @@
import 'typings-test'
import { expect, tap } from 'tapbundle'
import * as smartdelay from 'smartdelay'
import early = require('../dist/index')
describe('early', function () {
it('.start()', function (done) {
this.timeout(10000)
tap.test('.start()', async () => {
early.start('early')
setTimeout(done, 5000)
})
it('.stop()', function (done) {
early.stop()
.then(() => {
done()
})
})
await smartdelay.delayFor(2000)
})
tap.test('.stop()', async () => {
await early.stop()
})

View File

@ -25,7 +25,7 @@ export let stop = (): Promise<number> => {
let endTime = Date.now()
let earlyExecutionTime: number = (endTime - startTime)
let earlyExecutionTimeString: string = (earlyExecutionTime / 1000).toString()
console.log(`... finished loading within ${beautycolor.coloredString(earlyExecutionTimeString, 'blue')}`)
console.log(`OK! -> finished loading within ${beautycolor.coloredString(earlyExecutionTimeString, 'blue')}`)
done.resolve(earlyExecutionTime)
return done.promise
}

1650
yarn.lock

File diff suppressed because it is too large Load Diff