Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo committed Mar 22, 2020
1 parent 0d68f27 commit 335472e
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 265 deletions.
2 changes: 2 additions & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require: "ts-node/register"
ui: qunit
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ docs: build # runs the documentation tests

fix: # fixes the fixable issues in the code base
tslint --project tsconfig.json --fix
prettier --write src/*.ts
prettier --write test/*.ts
prettier --write src/
prettier --write test/
prettier --write **/*.md

help: # prints all make targets
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"memory-streams": "0.1.3",
"mocha": "7.1.1",
"nyc": "15.0.0",
"prettier": "1.19.1",
"prettier": "2.0.1",
"source-map-support": "0.5.16",
"text-runner": "4.0.2",
"ts-node": "8.7.0",
"ts-node": "8.8.1",
"tslint": "6.1.0",
"typescript": "3.8.3"
},
Expand Down
2 changes: 1 addition & 1 deletion test/fulltext-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { strict as assert } from "assert"
import { ReadableStream } from "memory-streams"
import { TextStreamSearch } from "../src/text-stream-search"

test("TextStreamSearch.fullText()", function() {
test("TextStreamSearch.fullText()", function () {
const stream = new ReadableStream("")
const search = new TextStreamSearch(stream)
assert.equal(search.fullText(), "", "should start out empty")
Expand Down
2 changes: 0 additions & 2 deletions test/mocha.opts

This file was deleted.

2 changes: 1 addition & 1 deletion test/text-accumulator-test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { strict as assert } from "assert"
import { TextAccumulator } from "../src/text-accumulator"

test("TextAccumulator", function() {
test("TextAccumulator", function () {
const accumulator = new TextAccumulator()
assert.equal(accumulator.toString(), "", "should start out empty")
accumulator.push("one")
Expand Down
24 changes: 12 additions & 12 deletions test/wait-for-regex-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { TextStreamSearch } from "../src/text-stream-search"

suite("TextStreamSearch.waitForRegex()")

test("match inside a block of text", async function() {
test("match inside a block of text", async function () {
const stream = new ReadableStream("")
const promise = new TextStreamSearch(stream).waitForRegex(/h.*o/)
stream.push("So I said hello to her")
const matched = await promise
assert.equal("hello to", matched)
})

test("match arrives in several blocks of text", async function() {
test("match arrives in several blocks of text", async function () {
const stream = new ReadableStream("")
const promise = new TextStreamSearch(stream).waitForRegex(/w.*r/)
stream.push("wo")
Expand All @@ -23,41 +23,41 @@ test("match arrives in several blocks of text", async function() {
assert.equal("wonder", matched)
})

test("match has already arrived when the search starts", async function() {
test("match has already arrived when the search starts", async function () {
const stream = new ReadableStream("")
stream.push("So I said hello to her")
const matched = await new TextStreamSearch(stream).waitForRegex(/h.*o/)
assert.equal("hello to", matched)
})

test("aborting after the given timeout", async function() {
test("aborting after the given timeout", async function () {
const stream = new ReadableStream("")
const promise = new TextStreamSearch(stream).waitForRegex(/h.*o/, 10)
assert.rejects(promise, new Error("Regex /h.*o/ not found within 10 ms. The captured text so far is:\n"))
})

test("search without timeout", async function() {
test("search without timeout", async function () {
const stream = new ReadableStream("")
const promise = new TextStreamSearch(stream).waitForRegex(/h.*o/)
let resolved = false
promise.then(function() {
promise.then(function () {
resolved = true
})
await delay(10)
assert.equal(resolved, false, "should keep searching if not timeout given")
})

test("multiple concurrent searches", async function() {
test("multiple concurrent searches", async function () {
const stream = new ReadableStream("")
const search = new TextStreamSearch(stream)
const promise1 = search.waitForRegex(/t.*1/)
let resolved1 = false
promise1.then(function() {
promise1.then(function () {
resolved1 = true
})
const promise2 = search.waitForRegex(/t.*2/)
let resolved2 = false
promise2.then(function() {
promise2.then(function () {
resolved2 = true
})
stream.push("text1")
Expand All @@ -69,12 +69,12 @@ test("multiple concurrent searches", async function() {
assert.equal(resolved2, true, "promise2 should have resolved")
})

test("multiple sequential searches", async function() {
test("multiple sequential searches", async function () {
const stream = new ReadableStream("")
const search = new TextStreamSearch(stream)
const promise1 = search.waitForRegex(/t.*1/)
let resolved1 = false
promise1.then(function() {
promise1.then(function () {
resolved1 = true
})
stream.push("text1")
Expand All @@ -83,7 +83,7 @@ test("multiple sequential searches", async function() {

const promise2 = search.waitForRegex(/t.*2/)
let resolved2 = false
promise2.then(function() {
promise2.then(function () {
resolved2 = true
})
stream.push("text2")
Expand Down
24 changes: 12 additions & 12 deletions test/wait-for-text-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { TextStreamSearch } from "../src/text-stream-search"

suite("TextStreamSearch.waitForText()")

test("match inside a block of text", async function() {
test("match inside a block of text", async function () {
const stream = new ReadableStream("")
const promise = new TextStreamSearch(stream).waitForText("hello")
stream.push("So I said hello to her")
const matched = await promise
assert.equal(matched, "hello")
})

test("matches arrives in several blocks of text", async function() {
test("matches arrives in several blocks of text", async function () {
const stream = new ReadableStream("")
const promise = new TextStreamSearch(stream).waitForText("wonderland")
stream.push("won")
Expand All @@ -23,41 +23,41 @@ test("matches arrives in several blocks of text", async function() {
assert.equal(matched, "wonderland")
})

test("match has already arrived when the search starts", async function() {
test("match has already arrived when the search starts", async function () {
const stream = new ReadableStream("")
stream.push("So I said hello to her")
const matched = await new TextStreamSearch(stream).waitForText("hello")
assert.equal(matched, "hello")
})

test("the given timeout expires", async function() {
test("the given timeout expires", async function () {
const stream = new ReadableStream("")
const promise = new TextStreamSearch(stream).waitForText("hello", 10)
assert.rejects(promise, new Error('Text "hello" not found within 10 ms. The captured text so far is:\n'))
})

test("search without timeout", async function() {
test("search without timeout", async function () {
const stream = new ReadableStream("")
const promise = new TextStreamSearch(stream).waitForText("hello")
let resolved = false
promise.then(function() {
promise.then(function () {
resolved = true
})
await delay(10)
assert.equal(resolved, false)
})

test("multiple concurrent searches", async function() {
test("multiple concurrent searches", async function () {
const stream = new ReadableStream("")
const search = new TextStreamSearch(stream)
const promise1 = search.waitForText("text1")
let resolved1 = false
promise1.then(function() {
promise1.then(function () {
resolved1 = true
})
const promise2 = search.waitForText("text2")
let resolved2 = false
promise2.then(function() {
promise2.then(function () {
resolved2 = true
})
stream.push("text1")
Expand All @@ -69,12 +69,12 @@ test("multiple concurrent searches", async function() {
assert.equal(resolved2, true, "promise2 should have resolved")
})

test("multiple sequential searches", async function() {
test("multiple sequential searches", async function () {
const stream = new ReadableStream("")
const search = new TextStreamSearch(stream)
const promise1 = search.waitForText("text1")
let resolved1 = false
promise1.then(function() {
promise1.then(function () {
resolved1 = true
})
stream.push("text1")
Expand All @@ -83,7 +83,7 @@ test("multiple sequential searches", async function() {

const promise2 = search.waitForText("text2")
let resolved2 = false
promise2.then(function() {
promise2.then(function () {
resolved2 = true
})
stream.push("text2")
Expand Down
Loading

0 comments on commit 335472e

Please sign in to comment.