Skip to content

Commit

Permalink
Use mocha-steps for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dex4er committed Oct 7, 2019
1 parent adfcd8d commit 3b98432
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ package: ./package.json
require:
- ts-node/register
- source-map-support/register
- mocha-steps
timeout: 90000
ui: bdd
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v5.0.3 2019-10-07

- Use `mocha-steps` for testing.

## v5.0.2 2019-10-07

- Updated dependencies.
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "promise-readable",
"version": "5.0.2",
"version": "5.0.3",
"description": "Return promise for readable stream",
"main": "lib/promise-readable.js",
"typings": "lib/promise-readable.d.ts",
Expand Down Expand Up @@ -42,6 +42,7 @@
"eslint-plugin-node": "^10.0.0",
"markdownlint-cli": "^0.18.0",
"mocha": "^6.2.1",
"mocha-steps": "^1.3.0",
"nyc": "^14.1.1",
"prettier": "^1.18.2",
"semver": "^6.3.0",
Expand All @@ -62,8 +63,7 @@
"prepublishOnly": "npm run test",
"pretest": "npm run lint",
"test": "npm run test:spec",
"test:spec": "npm run ts-mocha -- \"test/*.ts\"",
"test:coverage": "npm run clean:coverage && cross-env NYC=\"nyc --no-clean --reporter=lcov\" npm run test:spec && nyc report --reporter=text-summary --color",
"ts-mocha": "$NYC mocha --use_strict --throw-deprecation --require source-map-support/register --require ts-node/register --timeout 90000"
"test:spec": "$NYC mocha \"test/*.ts\"",
"test:coverage": "npm run clean:coverage && cross-env NYC=\"nyc --no-clean --reporter=lcov\" npm run test:spec && nyc report --reporter=text-summary --color"
}
}
13 changes: 7 additions & 6 deletions test/lib/steps.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import Mocha from "mocha"
import * as MochaSteps from "mocha-steps"

export function Feature(what: string, how: () => void): Mocha.Suite {
return describe("Feature: " + what, how)
return Mocha.describe("Feature: " + what, how)
}
export function Scenario(what: string, how: () => void): Mocha.Suite {
return describe("Scenario: " + what, how)
return Mocha.describe("Scenario: " + what, how)
}
export function Given(what: string, how: (done: Mocha.Done) => void): Mocha.Test {
return it("Given " + what, how)
return MochaSteps.step("Given " + what, how)
}
export function When(what: string, how: (done: Mocha.Done) => void): Mocha.Test {
return it("When " + what, how)
return MochaSteps.step("When " + what, how)
}
export function Then(what: string, how: (done: Mocha.Done) => void): Mocha.Test {
return it("Then " + what, how)
return MochaSteps.step("Then " + what, how)
}
export function And(what: string, how: (done: Mocha.Done) => void): Mocha.Test {
return it("And " + what, how)
return MochaSteps.step("And " + what, how)
}

0 comments on commit 3b98432

Please sign in to comment.