diff --git a/package.json b/package.json index 53eb1bf..d5a2ee0 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "type": "git" }, "scripts": { - "test": "NODE_PATH=src node node_modules/.bin/ava 'src/**/**/*.spec.ts' -e", + "test": "NODE_PATH=src node node_modules/.bin/ava 'tests/*.spec.ts' -e", "test:debug": "NODE_PATH=src node inspect node_modules/ava/profile.ts", "test:all": "NODE_PATH=src node node_modules/.bin/ava", "lint": "tslint -p tsconfig.json", @@ -45,7 +45,7 @@ }, "ava": { "files": [ - "src/**/*.spec.ts" + "tests/*.spec.ts" ], "sources": [ "src/**/*.ts" diff --git a/src/functions/accumulator/index.ts b/src/functions/accumulator.ts similarity index 96% rename from src/functions/accumulator/index.ts rename to src/functions/accumulator.ts index 81531c7..b8faeab 100644 --- a/src/functions/accumulator/index.ts +++ b/src/functions/accumulator.ts @@ -1,7 +1,10 @@ import { Transform } from "stream"; -import { AccumulatorByIteratee, FlushStrategy } from "./definitions"; -import { TransformOptions } from "../baseDefinitions"; -import { batch } from "../../index"; +import { + AccumulatorByIteratee, + FlushStrategy, + TransformOptions, +} from "./baseDefinitions"; +import { batch } from "."; function _accumulator( accumulateBy: (data: T, buffer: T[], stream: Transform) => void, diff --git a/src/functions/accumulator/definitions.ts b/src/functions/accumulator/definitions.ts deleted file mode 100644 index bd6ec50..0000000 --- a/src/functions/accumulator/definitions.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum FlushStrategy { - rolling = "rolling", - sliding = "sliding", -} - -export type AccumulatorByIteratee = (event: T, bufferChunk: T) => boolean; diff --git a/src/functions/baseDefinitions.ts b/src/functions/baseDefinitions.ts index 791ada9..c3f5461 100644 --- a/src/functions/baseDefinitions.ts +++ b/src/functions/baseDefinitions.ts @@ -21,3 +21,9 @@ export type JsonValue = JsonPrimitive | JsonPrimitive[]; export interface JsonParseOptions { pretty: boolean; } +export enum FlushStrategy { + rolling = "rolling", + sliding = "sliding", +} + +export type AccumulatorByIteratee = (event: T, bufferChunk: T) => boolean; diff --git a/src/functions/batch/index.ts b/src/functions/batch.ts similarity index 95% rename from src/functions/batch/index.ts rename to src/functions/batch.ts index 4dad33a..76551eb 100644 --- a/src/functions/batch/index.ts +++ b/src/functions/batch.ts @@ -1,5 +1,5 @@ import { Transform } from "stream"; -import { TransformOptions } from "../baseDefinitions"; +import { TransformOptions } from "./baseDefinitions"; /** * Stores chunks of data internally in array and batches when batchSize is reached. * diff --git a/src/functions/child/index.ts b/src/functions/child.ts similarity index 92% rename from src/functions/child/index.ts rename to src/functions/child.ts index e564eec..e2e0c22 100644 --- a/src/functions/child/index.ts +++ b/src/functions/child.ts @@ -1,5 +1,5 @@ import { ChildProcess } from "child_process"; -import { duplex } from "../baseFunctions"; +import { duplex } from "./baseFunctions"; /** * Return a Duplex stream from a child process' stdin and stdout * @param childProcess Child process from which to create duplex stream diff --git a/src/functions/collect/index.ts b/src/functions/collect.ts similarity index 93% rename from src/functions/collect/index.ts rename to src/functions/collect.ts index 57dd8e0..33b7330 100644 --- a/src/functions/collect/index.ts +++ b/src/functions/collect.ts @@ -1,5 +1,5 @@ import { Transform } from "stream"; -import { ThroughOptions } from "../baseDefinitions"; +import { ThroughOptions } from "./baseDefinitions"; /** * Return a ReadWrite stream that collects streamed chunks into an array or buffer * @param options diff --git a/src/functions/concat/index.ts b/src/functions/concat.ts similarity index 100% rename from src/functions/concat/index.ts rename to src/functions/concat.ts diff --git a/src/functions/duplex/index.ts b/src/functions/duplex.ts similarity index 100% rename from src/functions/duplex/index.ts rename to src/functions/duplex.ts diff --git a/src/functions/filter/index.ts b/src/functions/filter.ts similarity index 96% rename from src/functions/filter/index.ts rename to src/functions/filter.ts index fad186d..5714dd1 100644 --- a/src/functions/filter/index.ts +++ b/src/functions/filter.ts @@ -1,5 +1,5 @@ import { Transform } from "stream"; -import { ThroughOptions } from "../baseDefinitions"; +import { ThroughOptions } from "./baseDefinitions"; /** * Return a ReadWrite stream that filters out streamed chunks for which the predicate does not hold * @param predicate Predicate with which to filter scream chunks diff --git a/src/functions/flatMap/index.ts b/src/functions/flatMap.ts similarity index 96% rename from src/functions/flatMap/index.ts rename to src/functions/flatMap.ts index 3497ca7..ba8915f 100644 --- a/src/functions/flatMap/index.ts +++ b/src/functions/flatMap.ts @@ -1,5 +1,5 @@ import { Transform } from "stream"; -import { TransformOptions } from "../baseDefinitions"; +import { TransformOptions } from "./baseDefinitions"; /** * Return a ReadWrite stream that flat maps streamed chunks * @param mapper Mapper function, mapping each (chunk, encoding) to an array of new chunks (or a promise of such) diff --git a/src/functions/fromArray/index.ts b/src/functions/fromArray.ts similarity index 100% rename from src/functions/fromArray/index.ts rename to src/functions/fromArray.ts diff --git a/src/functions/index.ts b/src/functions/index.ts index 247400f..426d03d 100644 --- a/src/functions/index.ts +++ b/src/functions/index.ts @@ -7,12 +7,9 @@ import { TransformOptions, WithEncoding, JsonParseOptions, -} from "./baseDefinitions"; - -import { FlushStrategy, AccumulatorByIteratee, -} from "./accumulator/definitions"; +} from "./baseDefinitions"; /** * Convert an array into a Readable stream of its elements diff --git a/src/functions/join/index.ts b/src/functions/join.ts similarity index 95% rename from src/functions/join/index.ts rename to src/functions/join.ts index d3772c0..c1a28b6 100644 --- a/src/functions/join/index.ts +++ b/src/functions/join.ts @@ -1,6 +1,6 @@ import { Transform } from "stream"; import { StringDecoder } from "string_decoder"; -import { WithEncoding } from "../baseDefinitions"; +import { WithEncoding } from "./baseDefinitions"; /** * Return a ReadWrite stream that joins streamed chunks using the given separator * @param separator Separator to join with diff --git a/src/functions/last/index.ts b/src/functions/last.ts similarity index 100% rename from src/functions/last/index.ts rename to src/functions/last.ts diff --git a/src/functions/map/index.ts b/src/functions/map.ts similarity index 94% rename from src/functions/map/index.ts rename to src/functions/map.ts index 4941b98..0bf708d 100644 --- a/src/functions/map/index.ts +++ b/src/functions/map.ts @@ -1,5 +1,5 @@ import { Transform } from "stream"; -import { TransformOptions } from "../baseDefinitions"; +import { TransformOptions } from "./baseDefinitions"; /** * Return a ReadWrite stream that maps streamed chunks * @param mapper Mapper function, mapping each (chunk, encoding) to a new chunk (or a promise of such) diff --git a/src/functions/merge/index.ts b/src/functions/merge.ts similarity index 100% rename from src/functions/merge/index.ts rename to src/functions/merge.ts diff --git a/src/functions/parallelMap/index.ts b/src/functions/parallelMap.ts similarity index 92% rename from src/functions/parallelMap/index.ts rename to src/functions/parallelMap.ts index 353ab29..7610f49 100644 --- a/src/functions/parallelMap/index.ts +++ b/src/functions/parallelMap.ts @@ -1,6 +1,6 @@ import { Transform } from "stream"; -import { sleep } from "../../helpers"; -import { TransformOptions } from "../baseDefinitions"; +import { sleep } from "../helpers"; +import { TransformOptions } from "./baseDefinitions"; /** * Limits number of parallel processes in flight. * @param parallel Max number of parallel processes. diff --git a/src/functions/parse/index.ts b/src/functions/parse.ts similarity index 93% rename from src/functions/parse/index.ts rename to src/functions/parse.ts index 3bc9d69..da2ccee 100644 --- a/src/functions/parse/index.ts +++ b/src/functions/parse.ts @@ -1,6 +1,6 @@ import { Transform } from "stream"; import { StringDecoder } from "string_decoder"; -import { SerializationFormats } from "../baseDefinitions"; +import { SerializationFormats } from "./baseDefinitions"; /** * Return a ReadWrite stream that parses the streamed chunks as JSON. Each streamed chunk * must be a fully defined JSON string. diff --git a/src/functions/rate/index.ts b/src/functions/rate.ts similarity index 91% rename from src/functions/rate/index.ts rename to src/functions/rate.ts index b199efd..bed7edd 100644 --- a/src/functions/rate/index.ts +++ b/src/functions/rate.ts @@ -1,7 +1,7 @@ import { Transform } from "stream"; import { performance } from "perf_hooks"; -import { sleep } from "../../helpers"; -import { TransformOptions } from "../baseDefinitions"; +import { sleep } from "../helpers"; +import { TransformOptions } from "./baseDefinitions"; /** * Limits date of data transferred into stream. * @param targetRate Desired rate in ms diff --git a/src/functions/reduce/index.ts b/src/functions/reduce.ts similarity index 97% rename from src/functions/reduce/index.ts rename to src/functions/reduce.ts index 743d156..6dfcdf9 100644 --- a/src/functions/reduce/index.ts +++ b/src/functions/reduce.ts @@ -1,5 +1,5 @@ import { Transform } from "stream"; -import { TransformOptions } from "../baseDefinitions"; +import { TransformOptions } from "./baseDefinitions"; /** * Return a ReadWrite stream that reduces streamed chunks down to a single value and yield that * value diff --git a/src/functions/replace/index.ts b/src/functions/replace.ts similarity index 95% rename from src/functions/replace/index.ts rename to src/functions/replace.ts index 4726a35..e8bc0e7 100644 --- a/src/functions/replace/index.ts +++ b/src/functions/replace.ts @@ -1,6 +1,6 @@ import { Transform } from "stream"; import { StringDecoder } from "string_decoder"; -import { WithEncoding } from "../baseDefinitions"; +import { WithEncoding } from "./baseDefinitions"; /** * Return a ReadWrite stream that replaces occurrences of the given string or regular expression in * the streamed chunks with the specified replacement string diff --git a/src/functions/split/index.ts b/src/functions/split.ts similarity index 95% rename from src/functions/split/index.ts rename to src/functions/split.ts index 4ae3e4e..fe31d65 100644 --- a/src/functions/split/index.ts +++ b/src/functions/split.ts @@ -1,6 +1,6 @@ import { Transform } from "stream"; import { StringDecoder } from "string_decoder"; -import { WithEncoding } from "../baseDefinitions"; +import { WithEncoding } from "./baseDefinitions"; /** * Return a ReadWrite stream that splits streamed chunks using the given separator * @param separator Separator to split by, defaulting to "\n" diff --git a/src/functions/stringify/index.ts b/src/functions/stringify.ts similarity index 89% rename from src/functions/stringify/index.ts rename to src/functions/stringify.ts index aaa5918..21996ad 100644 --- a/src/functions/stringify/index.ts +++ b/src/functions/stringify.ts @@ -1,5 +1,5 @@ import { Transform } from "stream"; -import { JsonValue, JsonParseOptions } from "../baseDefinitions"; +import { JsonValue, JsonParseOptions } from "./baseDefinitions"; /** * Return a ReadWrite stream that stringifies the streamed chunks to JSON diff --git a/src/functions/unbatch/index.ts b/src/functions/unbatch.ts similarity index 89% rename from src/functions/unbatch/index.ts rename to src/functions/unbatch.ts index 946c754..d8fc25f 100644 --- a/src/functions/unbatch/index.ts +++ b/src/functions/unbatch.ts @@ -1,5 +1,5 @@ import { Transform } from "stream"; -import { TransformOptions } from "../baseDefinitions"; +import { TransformOptions } from "./baseDefinitions"; /** * Unbatches and sends individual chunks of data */ diff --git a/src/index.ts b/src/index.ts index 3d57c81..c0eabe4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,4 +20,5 @@ export { rate, parallelMap, accumulator, + accumulatorBy, } from "./functions"; diff --git a/src/functions/accumulator/accumulator.spec.ts b/tests/accumulator.spec.ts similarity index 99% rename from src/functions/accumulator/accumulator.spec.ts rename to tests/accumulator.spec.ts index a64c921..c5a5ae3 100644 --- a/src/functions/accumulator/accumulator.spec.ts +++ b/tests/accumulator.spec.ts @@ -1,8 +1,8 @@ import test from "ava"; import { expect } from "chai"; import { Readable } from "stream"; -import { accumulator, accumulatorBy } from "."; -import { FlushStrategy } from "./definitions"; +import { accumulator, accumulatorBy } from "../src"; +import { FlushStrategy } from "../src/functions/baseDefinitions"; test.cb("accumulator() rolling", t => { t.plan(3); diff --git a/src/functions/batch/batch.spec.ts b/tests/batch.spec.ts similarity index 97% rename from src/functions/batch/batch.spec.ts rename to tests/batch.spec.ts index 056af0d..bccd1b6 100644 --- a/src/functions/batch/batch.spec.ts +++ b/tests/batch.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { batch } from "."; +import { batch } from "../src"; test.cb("batch() batches chunks together", t => { t.plan(3); diff --git a/src/functions/child/child.spec.ts b/tests/child.spec.ts similarity index 95% rename from src/functions/child/child.spec.ts rename to tests/child.spec.ts index fd1ae79..7730790 100644 --- a/src/functions/child/child.spec.ts +++ b/tests/child.spec.ts @@ -2,7 +2,7 @@ import * as cp from "child_process"; import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { child } from "."; +import { child } from "../src"; test.cb( "child() allows easily writing to child process stdin and reading from its stdout", diff --git a/src/functions/collect/collect.spec.ts b/tests/collect.spec.ts similarity index 99% rename from src/functions/collect/collect.spec.ts rename to tests/collect.spec.ts index b585fe9..1e4cd03 100644 --- a/src/functions/collect/collect.spec.ts +++ b/tests/collect.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { collect } from "."; +import { collect } from "../src"; test.cb( "collect() collects streamed elements into an array (object, flowing mode)", diff --git a/src/functions/concat/concat.spec.ts b/tests/concat.spec.ts similarity index 99% rename from src/functions/concat/concat.spec.ts rename to tests/concat.spec.ts index 0750174..596fbad 100644 --- a/src/functions/concat/concat.spec.ts +++ b/tests/concat.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { concat, collect } from "../baseFunctions"; +import { concat, collect } from "../src"; test.cb( "concat() concatenates multiple readable streams (object, flowing mode)", diff --git a/src/functions/duplex/duplex.spec.ts b/tests/duplex.spec.ts similarity index 94% rename from src/functions/duplex/duplex.spec.ts rename to tests/duplex.spec.ts index c1ef28b..e5fafd7 100644 --- a/src/functions/duplex/duplex.spec.ts +++ b/tests/duplex.spec.ts @@ -2,7 +2,7 @@ import * as cp from "child_process"; import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { duplex } from "../baseFunctions"; +import { duplex } from "../src"; test.cb( "duplex() combines a writable and readable stream into a ReadWrite stream", diff --git a/src/functions/filter/filter.spec.ts b/tests/filter.spec.ts similarity index 98% rename from src/functions/filter/filter.spec.ts rename to tests/filter.spec.ts index a537372..7fa2053 100644 --- a/src/functions/filter/filter.spec.ts +++ b/tests/filter.spec.ts @@ -1,7 +1,7 @@ import test from "ava"; import { expect } from "chai"; import { Readable } from "stream"; -import { filter } from "."; +import { filter } from "../src"; test.cb("filter() filters elements synchronously", t => { t.plan(2); diff --git a/src/functions/flatMap/flatMap.spec.ts b/tests/flatMap.spec.ts similarity index 98% rename from src/functions/flatMap/flatMap.spec.ts rename to tests/flatMap.spec.ts index 4e6c28d..a8b22bb 100644 --- a/src/functions/flatMap/flatMap.spec.ts +++ b/tests/flatMap.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { flatMap } from "."; +import { flatMap } from "../src"; test.cb("flatMap() maps elements synchronously", t => { t.plan(6); diff --git a/src/functions/fromArray/fromArray.spec.ts b/tests/fromArray.spec.ts similarity index 97% rename from src/functions/fromArray/fromArray.spec.ts rename to tests/fromArray.spec.ts index b0b9a95..3e4c93e 100644 --- a/src/functions/fromArray/fromArray.spec.ts +++ b/tests/fromArray.spec.ts @@ -1,6 +1,6 @@ import test from "ava"; import { expect } from "chai"; -import { fromArray } from "."; +import { fromArray } from "../src"; test.cb("fromArray() streams array elements in flowing mode", t => { t.plan(3); diff --git a/src/functions/join/join.spec.ts b/tests/join.spec.ts similarity index 98% rename from src/functions/join/join.spec.ts rename to tests/join.spec.ts index fc9d5b7..6b0be52 100644 --- a/src/functions/join/join.spec.ts +++ b/tests/join.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { join } from "."; +import { join } from "../src"; test.cb("join() joins chunks using the specified separator", t => { t.plan(9); diff --git a/src/functions/last/last.spec.ts b/tests/last.spec.ts similarity index 91% rename from src/functions/last/last.spec.ts rename to tests/last.spec.ts index 5bb0338..033c9d8 100644 --- a/src/functions/last/last.spec.ts +++ b/tests/last.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { last } from "../baseFunctions"; +import { last } from "../src"; test("last() resolves to the last chunk streamed by the given readable stream", async t => { const source = new Readable({ objectMode: true }); diff --git a/src/functions/map/map.spec.ts b/tests/map.spec.ts similarity index 98% rename from src/functions/map/map.spec.ts rename to tests/map.spec.ts index 5d6a114..75210ff 100644 --- a/src/functions/map/map.spec.ts +++ b/tests/map.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { map } from "."; +import { map } from "../src"; test.cb("map() maps elements synchronously", t => { t.plan(3); diff --git a/src/functions/merge/merge.spec.ts b/tests/merge.spec.ts similarity index 97% rename from src/functions/merge/merge.spec.ts rename to tests/merge.spec.ts index 84a8dca..dbbfd79 100644 --- a/src/functions/merge/merge.spec.ts +++ b/tests/merge.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { merge } from "../baseFunctions"; +import { merge } from "../src"; test.cb( "merge() merges multiple readable streams in chunk arrival order", diff --git a/src/functions/parallelMap/parallelMap.spec.ts b/tests/parallelMap.spec.ts similarity index 96% rename from src/functions/parallelMap/parallelMap.spec.ts rename to tests/parallelMap.spec.ts index 9ae4d37..dff719a 100644 --- a/src/functions/parallelMap/parallelMap.spec.ts +++ b/tests/parallelMap.spec.ts @@ -2,8 +2,8 @@ import { Readable } from "stream"; import { performance } from "perf_hooks"; import test from "ava"; import { expect } from "chai"; -import { parallelMap } from "../baseFunctions"; -import { sleep } from "../../helpers"; +import { parallelMap } from "../src"; +import { sleep } from "../src/helpers"; test.cb("parallelMap() parallel mapping", t => { t.plan(6); diff --git a/src/functions/parse/parse.spec.ts b/tests/parse.spec.ts similarity index 95% rename from src/functions/parse/parse.spec.ts rename to tests/parse.spec.ts index 0f17b53..d9aebbb 100644 --- a/src/functions/parse/parse.spec.ts +++ b/tests/parse.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { parse } from "../baseFunctions"; +import { parse } from "../src"; test.cb("parse() parses the streamed elements as JSON", t => { t.plan(3); diff --git a/src/functions/rate/rate.spec.ts b/tests/rate.spec.ts similarity index 95% rename from src/functions/rate/rate.spec.ts rename to tests/rate.spec.ts index a88d179..024724c 100644 --- a/src/functions/rate/rate.spec.ts +++ b/tests/rate.spec.ts @@ -2,7 +2,7 @@ import { Readable } from "stream"; import { performance } from "perf_hooks"; import test from "ava"; import { expect } from "chai"; -import { rate } from "../baseFunctions"; +import { rate } from "../src"; test.cb("rate() sends data at desired rate", t => { t.plan(9); @@ -19,7 +19,7 @@ test.cb("rate() sends data at desired rate", t => { let k = 0; sourceFast - .pipe(rate(fastRate)) + .pipe(rate(fastRate, 1)) .on("data", (element: string[]) => { const currentRate = (i / (performance.now() - start)) * 1000; expect(element).to.deep.equal(expectedElements[i]); @@ -30,7 +30,7 @@ test.cb("rate() sends data at desired rate", t => { .on("error", t.end); sourceMed - .pipe(rate(medRate)) + .pipe(rate(medRate, 1)) .on("data", (element: string[]) => { const currentRate = (j / (performance.now() - start)) * 1000; expect(element).to.deep.equal(expectedElements[j]); diff --git a/src/functions/reduce/reduce.spec.ts b/tests/reduce.spec.ts similarity index 98% rename from src/functions/reduce/reduce.spec.ts rename to tests/reduce.spec.ts index c01a51e..b005896 100644 --- a/src/functions/reduce/reduce.spec.ts +++ b/tests/reduce.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { reduce } from "."; +import { reduce } from "../src"; test.cb("reduce() reduces elements synchronously", t => { t.plan(1); diff --git a/src/functions/replace/replace.spec.ts b/tests/replace.spec.ts similarity index 98% rename from src/functions/replace/replace.spec.ts rename to tests/replace.spec.ts index a36642c..5829f8e 100644 --- a/src/functions/replace/replace.spec.ts +++ b/tests/replace.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { replace } from "."; +import { replace } from "../src"; test.cb( "replace() replaces occurrences of the given string in the streamed elements with the specified " + diff --git a/src/functions/split/split.spec.ts b/tests/split.spec.ts similarity index 98% rename from src/functions/split/split.spec.ts rename to tests/split.spec.ts index 9e909f3..1819e2b 100644 --- a/src/functions/split/split.spec.ts +++ b/tests/split.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { split } from "."; +import { split } from "../src"; test.cb("split() splits chunks using the default separator (\\n)", t => { t.plan(5); diff --git a/src/functions/stringify/stringify.spec.ts b/tests/stringify.spec.ts similarity index 97% rename from src/functions/stringify/stringify.spec.ts rename to tests/stringify.spec.ts index 1569ec1..7452e99 100644 --- a/src/functions/stringify/stringify.spec.ts +++ b/tests/stringify.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { stringify } from "../baseFunctions"; +import { stringify } from "../src"; test.cb("stringify() stringifies the streamed elements as JSON", t => { t.plan(4); diff --git a/src/functions/unbatch/unbatch.spec.ts b/tests/unbatch.spec.ts similarity index 92% rename from src/functions/unbatch/unbatch.spec.ts rename to tests/unbatch.spec.ts index 6a99a05..d48b1b9 100644 --- a/src/functions/unbatch/unbatch.spec.ts +++ b/tests/unbatch.spec.ts @@ -1,7 +1,7 @@ import { Readable } from "stream"; import test from "ava"; import { expect } from "chai"; -import { unbatch, batch } from "../baseFunctions"; +import { unbatch, batch } from "../src"; test.cb("unbatch() unbatches", t => { t.plan(3); diff --git a/tsconfig.json b/tsconfig.json index 4a3d25c..56ed6a8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,29 @@ { - "compilerOptions": { - "noImplicitAny": true, - "strictNullChecks": true, - "noImplicitReturns": true, - "noUnusedLocals": false, - "noImplicitThis": true, - "forceConsistentCasingInFileNames": true, - "suppressImplicitAnyIndexErrors": true, - "outDir": "./dist", - "module": "commonjs", - "target": "es5", - "lib": ["es2016", "es2019"], - "sourceMap": true, - "declaration": true + "compilerOptions": { + "noImplicitAny": true, + "strictNullChecks": true, + "noImplicitReturns": true, + "noUnusedLocals": false, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "suppressImplicitAnyIndexErrors": true, + "outDir": "./dist", + "module": "commonjs", + "baseUrl": ".", + "paths": { + "src/*": [ + "src/*" + ] }, - "include": ["src/**/*.ts"] + "target": "es5", + "lib": [ + "es2016", + "es2019" + ], + "sourceMap": true, + "declaration": true + }, + "include": [ + "src/**/*.ts" + ] }