Skip to content

Commit

Permalink
fix(test): use mocha instead of japa
Browse files Browse the repository at this point in the history
japa does not support node4.0
  • Loading branch information
thetutlage committed Jan 31, 2017
1 parent 0918cb5 commit 8bf7039
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Binary file removed .package.json.swp
Binary file not shown.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install:
test_script:
- node --version
- npm --version
- npm run test:win
- npm run test

build: off
clone_depth: 1
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
"example": "examples"
},
"scripts": {
"test": "npm run lint && node test/youch.spec.js",
"test": "npm run lint && _mocha test/*.spec.js",
"lint": "standard src/Youch"
},
"author": "amanvirk",
"license": "MIT",
"devDependencies": {
"japa": "^1.0.0",
"chai": "^3.5.0",
"mocha": "^3.2.0",
"standard": "^8.6.0",
"supertest": "^3.0.0"
},
Expand Down
Binary file removed test/.youch.spec.js.swp
Binary file not shown.
21 changes: 10 additions & 11 deletions test/youch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

const http = require('http')
const supertest = require('supertest')
const test = require('japa')
const Youch = require('../src/Youch')
const assert = require('chai').assert

const DEFAULT_PORT=8000

test.group('Youch', () => {
describe('Youch', () => {

test('initiate a new instance by passing error object', (assert) => {
it('initiate a new instance by passing error object', () => {
const error = new Error('foo')
const youch = new Youch(error, {})
assert.equal(youch.error.message, 'foo')
assert.deepEqual(youch.request, {})
})

test('parse the error into frames', (assert, done) => {
assert.plan(2)
it('parse the error into frames', (done) => {
const error = new Error('foo')
const youch = new Youch(error, {})
youch
Expand All @@ -29,7 +28,7 @@ test.group('Youch', () => {
}).catch(done)
})

test('parse stack frame context to tokens', (assert, done) => {
it('parse stack frame context to tokens', (done) => {
const error = new Error('this is bar')
const youch = new Youch(error, {})

Expand All @@ -43,7 +42,7 @@ test.group('Youch', () => {
.catch(done)
})

test('return active class when index is 0', (assert) => {
it('return active class when index is 0', () => {
const error = new Error('this is bar')
const youch = new Youch(error, {})
const frame = {
Expand All @@ -55,7 +54,7 @@ test.group('Youch', () => {
assert.equal(classes, 'active')
})

test('return native frame class when frame is native', (assert) => {
it('return native frame class when frame is native', () => {
const error = new Error('this is bar')
const youch = new Youch(error, {})
const frame = {
Expand All @@ -67,7 +66,7 @@ test.group('Youch', () => {
assert.equal(classes, 'active native-frame')
})

test('return native frame class when frame is from node_modules', (assert) => {
it('return native frame class when frame is from node_modules', () => {
const error = new Error('this is bar')
const youch = new Youch(error, {})
const frame = {
Expand All @@ -79,7 +78,7 @@ test.group('Youch', () => {
assert.equal(classes, 'active native-frame')
})

test('serialize http request', (assert, done) => {
it('serialize http request', (done) => {
const server = http.createServer((req, res) => {
const youch = new Youch({}, req)
res.writeHead(200, {'content-type': 'application/json'})
Expand All @@ -102,7 +101,7 @@ test.group('Youch', () => {
})
})

test('serialize http request and return cookies from it', (assert, done) => {
it('serialize http request and return cookies from it', (done) => {
const server = http.createServer((req, res) => {
const youch = new Youch({}, req)
res.writeHead(200, {'content-type': 'application/json'})
Expand Down

0 comments on commit 8bf7039

Please sign in to comment.