Skip to content

Commit ff9c275

Browse files
committed
Setup test infrastructure.
1 parent 2434952 commit ff9c275

10 files changed

+3683
-95
lines changed

.flowconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
.*/node_modules/tap/*
44
.*/node_modules/documentation/*
55
.*/node_modules/browserify*
6-
.*/node_modules/is-*
76
.*/node_modules/*
8-
!.*/node_modules/blue-tape
9-
!.*/node_modules/random-access-storage
107

118
[libs]
129

flow-typed/npm/blue-tape_vx.x.x.js

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// flow-typed signature: 319345c7d1f795de3b740a00bf5e38f1
2+
// flow-typed version: 622c2ee76d/tape_v4.5.x/flow_>=v0.25.x
3+
4+
/* eslint-disable */
5+
6+
declare type tape$TestOpts =
7+
| {
8+
skip: boolean,
9+
timeout?: number
10+
}
11+
| {
12+
skip?: boolean,
13+
timeout: number
14+
}
15+
16+
declare type tape$TestCb = (t: tape$Context) => mixed
17+
declare type tape$TestFn = (
18+
a: string | tape$TestOpts | tape$TestCb,
19+
b?: tape$TestOpts | tape$TestCb,
20+
c?: tape$TestCb
21+
) => void
22+
23+
declare interface tape$Context {
24+
fail(msg?: string): void;
25+
pass(msg?: string): void;
26+
27+
error(err: mixed, msg?: string): void;
28+
ifError(err: mixed, msg?: string): void;
29+
ifErr(err: mixed, msg?: string): void;
30+
iferror(err: mixed, msg?: string): void;
31+
32+
ok(value: mixed, msg?: string): void;
33+
true(value: mixed, msg?: string): void;
34+
assert(value: mixed, msg?: string): void;
35+
36+
notOk(value: mixed, msg?: string): void;
37+
false(value: mixed, msg?: string): void;
38+
notok(value: mixed, msg?: string): void;
39+
40+
// equal + aliases
41+
equal(actual: mixed, expected: mixed, msg?: string): void;
42+
equals(actual: mixed, expected: mixed, msg?: string): void;
43+
isEqual(actual: mixed, expected: mixed, msg?: string): void;
44+
is(actual: mixed, expected: mixed, msg?: string): void;
45+
strictEqual(actual: mixed, expected: mixed, msg?: string): void;
46+
strictEquals(actual: mixed, expected: mixed, msg?: string): void;
47+
48+
// notEqual + aliases
49+
notEqual(actual: mixed, expected: mixed, msg?: string): void;
50+
notEquals(actual: mixed, expected: mixed, msg?: string): void;
51+
notStrictEqual(actual: mixed, expected: mixed, msg?: string): void;
52+
notStrictEquals(actual: mixed, expected: mixed, msg?: string): void;
53+
isNotEqual(actual: mixed, expected: mixed, msg?: string): void;
54+
isNot(actual: mixed, expected: mixed, msg?: string): void;
55+
not(actual: mixed, expected: mixed, msg?: string): void;
56+
doesNotEqual(actual: mixed, expected: mixed, msg?: string): void;
57+
isInequal(actual: mixed, expected: mixed, msg?: string): void;
58+
59+
// deepEqual + aliases
60+
deepEqual(actual: mixed, expected: mixed, msg?: string): void;
61+
deepEquals(actual: mixed, expected: mixed, msg?: string): void;
62+
isEquivalent(actual: mixed, expected: mixed, msg?: string): void;
63+
same(actual: mixed, expected: mixed, msg?: string): void;
64+
65+
// notDeepEqual
66+
notDeepEqual(actual: mixed, expected: mixed, msg?: string): void;
67+
notEquivalent(actual: mixed, expected: mixed, msg?: string): void;
68+
notDeeply(actual: mixed, expected: mixed, msg?: string): void;
69+
notSame(actual: mixed, expected: mixed, msg?: string): void;
70+
isNotDeepEqual(actual: mixed, expected: mixed, msg?: string): void;
71+
isNotDeeply(actual: mixed, expected: mixed, msg?: string): void;
72+
isNotEquivalent(actual: mixed, expected: mixed, msg?: string): void;
73+
isInequivalent(actual: mixed, expected: mixed, msg?: string): void;
74+
75+
// deepLooseEqual
76+
deepLooseEqual(actual: mixed, expected: mixed, msg?: string): void;
77+
looseEqual(actual: mixed, expected: mixed, msg?: string): void;
78+
looseEquals(actual: mixed, expected: mixed, msg?: string): void;
79+
80+
// notDeepLooseEqual
81+
notDeepLooseEqual(actual: mixed, expected: mixed, msg?: string): void;
82+
notLooseEqual(actual: mixed, expected: mixed, msg?: string): void;
83+
notLooseEquals(actual: mixed, expected: mixed, msg?: string): void;
84+
85+
throws(fn: Function, expected?: RegExp | Function, msg?: string): void;
86+
doesNotThrow(fn: Function, expected?: RegExp | Function, msg?: string): void;
87+
88+
timeoutAfter(ms: number): void;
89+
90+
skip(msg?: string): void;
91+
plan(n: number): void;
92+
onFinish(fn: Function): void;
93+
end(): void;
94+
comment(msg: string): void;
95+
test: tape$TestFn;
96+
}
97+
98+
declare module "blue-tape" {
99+
declare type TestHarness = Tape
100+
declare type StreamOpts = {
101+
objectMode?: boolean
102+
}
103+
104+
declare type Tape = {
105+
(
106+
a: string | tape$TestOpts | tape$TestCb,
107+
b?: tape$TestCb | tape$TestOpts,
108+
c?: tape$TestCb,
109+
...rest: Array<void>
110+
): void,
111+
test: tape$TestFn,
112+
skip: (name: string, cb?: tape$TestCb) => void,
113+
createHarness: () => TestHarness,
114+
createStream: (opts?: StreamOpts) => stream$Readable,
115+
only: (
116+
a: string | tape$TestOpts | tape$TestCb,
117+
b?: tape$TestCb | tape$TestOpts,
118+
c?: tape$TestCb,
119+
...rest: Array<void>
120+
) => void
121+
}
122+
123+
declare module.exports: Tape
124+
}

flow-typed/npm/tape_v4.5.x.js

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// flow-typed signature: 319345c7d1f795de3b740a00bf5e38f1
2+
// flow-typed version: 622c2ee76d/tape_v4.5.x/flow_>=v0.25.x
3+
4+
/* eslint-disable */
5+
6+
declare type tape$TestOpts = {
7+
skip: boolean,
8+
timeout?: number,
9+
} | {
10+
skip?: boolean,
11+
timeout: number,
12+
};
13+
14+
15+
declare type tape$TestCb = (t: tape$Context) => mixed;
16+
declare type tape$TestFn = (a: string | tape$TestOpts | tape$TestCb, b?: tape$TestOpts | tape$TestCb, c?: tape$TestCb) => void;
17+
18+
declare interface tape$Context {
19+
fail(msg?: string): void,
20+
pass(msg?: string): void,
21+
22+
error(err: mixed, msg?: string): void,
23+
ifError(err: mixed, msg?: string): void,
24+
ifErr(err: mixed, msg?: string): void,
25+
iferror(err: mixed, msg?: string): void,
26+
27+
ok(value: mixed, msg?: string): void,
28+
true(value: mixed, msg?: string): void,
29+
assert(value: mixed, msg?: string): void,
30+
31+
notOk(value: mixed, msg?: string): void,
32+
false(value: mixed, msg?: string): void,
33+
notok(value: mixed, msg?: string): void,
34+
35+
// equal + aliases
36+
equal(actual: mixed, expected: mixed, msg?: string): void,
37+
equals(actual: mixed, expected: mixed, msg?: string): void,
38+
isEqual(actual: mixed, expected: mixed, msg?: string): void,
39+
is(actual: mixed, expected: mixed, msg?: string): void,
40+
strictEqual(actual: mixed, expected: mixed, msg?: string): void,
41+
strictEquals(actual: mixed, expected: mixed, msg?: string): void,
42+
43+
// notEqual + aliases
44+
notEqual(actual: mixed, expected: mixed, msg?: string): void,
45+
notEquals(actual: mixed, expected: mixed, msg?: string): void,
46+
notStrictEqual(actual: mixed, expected: mixed, msg?: string): void,
47+
notStrictEquals(actual: mixed, expected: mixed, msg?: string): void,
48+
isNotEqual(actual: mixed, expected: mixed, msg?: string): void,
49+
isNot(actual: mixed, expected: mixed, msg?: string): void,
50+
not(actual: mixed, expected: mixed, msg?: string): void,
51+
doesNotEqual(actual: mixed, expected: mixed, msg?: string): void,
52+
isInequal(actual: mixed, expected: mixed, msg?: string): void,
53+
54+
// deepEqual + aliases
55+
deepEqual(actual: mixed, expected: mixed, msg?: string): void,
56+
deepEquals(actual: mixed, expected: mixed, msg?: string): void,
57+
isEquivalent(actual: mixed, expected: mixed, msg?: string): void,
58+
same(actual: mixed, expected: mixed, msg?: string): void,
59+
60+
// notDeepEqual
61+
notDeepEqual(actual: mixed, expected: mixed, msg?: string): void,
62+
notEquivalent(actual: mixed, expected: mixed, msg?: string): void,
63+
notDeeply(actual: mixed, expected: mixed, msg?: string): void,
64+
notSame(actual: mixed, expected: mixed, msg?: string): void,
65+
isNotDeepEqual(actual: mixed, expected: mixed, msg?: string): void,
66+
isNotDeeply(actual: mixed, expected: mixed, msg?: string): void,
67+
isNotEquivalent(actual: mixed, expected: mixed, msg?: string): void,
68+
isInequivalent(actual: mixed, expected: mixed, msg?: string): void,
69+
70+
// deepLooseEqual
71+
deepLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
72+
looseEqual(actual: mixed, expected: mixed, msg?: string): void,
73+
looseEquals(actual: mixed, expected: mixed, msg?: string): void,
74+
75+
// notDeepLooseEqual
76+
notDeepLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
77+
notLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
78+
notLooseEquals(actual: mixed, expected: mixed, msg?: string): void,
79+
80+
throws(fn: Function, expected?: RegExp | Function, msg?: string): void,
81+
doesNotThrow(fn: Function, expected?: RegExp | Function, msg?: string): void,
82+
83+
timeoutAfter(ms: number): void,
84+
85+
skip(msg?: string): void,
86+
plan(n: number): void,
87+
onFinish(fn: Function): void,
88+
end(): void,
89+
comment(msg: string): void,
90+
test: tape$TestFn,
91+
}
92+
93+
94+
declare module 'tape' {
95+
declare type TestHarness = Tape;
96+
declare type StreamOpts = {
97+
objectMode?: boolean,
98+
};
99+
100+
declare type Tape = {
101+
(a: string | tape$TestOpts | tape$TestCb, b?: tape$TestCb | tape$TestOpts, c?: tape$TestCb, ...rest: Array<void>): void,
102+
test: tape$TestFn,
103+
skip: (name: string, cb?: tape$TestCb) => void,
104+
createHarness: () => TestHarness,
105+
createStream: (opts?: StreamOpts) => stream$Readable,
106+
only: (a: string | tape$TestOpts | tape$TestCb, b?: tape$TestCb | tape$TestOpts, c?: tape$TestCb, ...rest: Array<void>) => void,
107+
};
108+
109+
declare module.exports: Tape;
110+
}

karma.conf.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = config =>
2+
config.set({
3+
frameworks: ["browserify", "tap", "source-map-support"],
4+
reporters: ["tap-pretty"],
5+
browsers: ["Firefox"],
6+
files: ["test/**/*.js"],
7+
preprocessors: {
8+
"test/**/*.js": ["browserify"]
9+
},
10+
browserify: {
11+
debug: true,
12+
transform: ["babelify"]
13+
},
14+
tapReporter: {
15+
prettify: require("faucet"),
16+
separator: "----------------------------------------"
17+
},
18+
logLevel: config.LOG_ERROR,
19+
browserConsoleLogOptions: {
20+
level: "error",
21+
format: "%b %T: %m",
22+
terminal: false
23+
}
24+
})

package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,25 @@
1919
"babel-preset-env": "1.7.0",
2020
"babel-preset-flow-node": "^2.0.1",
2121
"babel-register": "^6.26.0",
22+
"babelify": "8.0.0",
2223
"blue-tape": "^1.0.0",
24+
"browserify": "16.2.2",
2325
"documentation": "8.0.0",
26+
"faucet": "0.0.1",
2427
"flow-bin": "^0.75.0",
2528
"flow-copy-source": "^2.0.0",
29+
"karma": "2.0.4",
30+
"karma-babel-preprocessor": "7.0.0",
31+
"karma-browserify": "5.3.0",
32+
"karma-firefox-launcher": "1.1.0",
33+
"karma-source-map-support": "1.3.0",
34+
"karma-tap": "4.1.4",
35+
"karma-tap-pretty-reporter": "4.1.0",
2636
"lint-staged": "^7.2.0",
27-
"prettier": "^1.9.2"
37+
"prettier": "^1.9.2",
38+
"rollup": "0.61.2",
39+
"rollup.config.flow": "1.1.0",
40+
"watchify": "3.11.0"
2841
},
2942
"scripts": {
3043
"test": "npm run test:flow && npm run test:tape",

src/IndexedDB.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ export interface IDBOpenDBRequest extends IDBRequest<Error, IDBDatabase> {
2929
onupgradeneeded: (e: any) => mixed;
3030
}
3131

32+
export interface DOMStringList {
33+
+length: number;
34+
item(): string;
35+
contains(string): boolean;
36+
}
37+
3238
export interface IDBDatabase extends EventTarget {
3339
close(): void;
3440
createObjectStore(
@@ -49,7 +55,7 @@ export interface IDBDatabase extends EventTarget {
4955
): IDBTransaction;
5056
name: string;
5157
version: number;
52-
objectStoreNames: string[];
58+
objectStoreNames: DOMStringList;
5359
onabort: (e: any) => mixed;
5460
onclose: (e: any) => mixed;
5561
onerror: (e: any) => mixed;
@@ -173,4 +179,4 @@ export interface IDBFileHandle extends EventTarget {
173179

174180
export type LockedFile = IDBFileHandle
175181

176-
export const indexedDB: IDBFactory = self.indexedDB
182+
export const indexedDB: IDBFactory = window.indexedDB

0 commit comments

Comments
 (0)