Skip to content

Commit 6da7b67

Browse files
committed
[Tests] switch from mocha to tape
1 parent 6a22a78 commit 6da7b67

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
"parse-github-url": "./cli.js"
2929
},
3030
"engines": {
31-
"node": ">=0.10.0"
31+
"node": ">= 0.10"
3232
},
3333
"scripts": {
34-
"test": "mocha"
34+
"tests-only": "tape 'test/**/*.js'",
35+
"test": "npm run tests-only"
3536
},
3637
"devDependencies": {
3738
"gulp-format-md": "^1.0.0",
38-
"mocha": "^3.2.0",
39+
"tape": "^5.8.1",
3940
"verb-generate-readme": "^0.6.0"
4041
},
4142
"keywords": [

test.js renamed to test/index.js

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
22

3-
require('mocha');
4-
var assert = require('assert');
5-
var gh = require('./');
3+
var test = require('tape');
64

7-
describe('parse-github-url', function() {
8-
it('should get the user:', function() {
5+
var gh = require('../');
6+
7+
test('parse-github-url', function (t) {
8+
t.test('gets the user:', function (assert) {
99
assert.equal(gh(''), null);
1010
assert.equal(gh('https://github.com/jonschlinkert/micromatch').owner, 'jonschlinkert');
1111
assert.equal(gh('[email protected]:assemble/verb.git').owner, 'assemble');
@@ -51,9 +51,11 @@ describe('parse-github-url', function() {
5151
assert.equal(gh(), null);
5252
assert.equal(gh(null), null);
5353
assert.equal(gh(undefined), null);
54+
55+
assert.end();
5456
});
5557

56-
it('should get the branch:', function() {
58+
t.test('gets the branch:', function (assert) {
5759
assert.equal(gh('assemble/verb#branch').branch, 'branch');
5860
assert.equal(gh('assemble/verb#dev').branch, 'dev');
5961
assert.equal(gh('[email protected]:assemble/verb.git#0.6.0').branch, '0.6.0');
@@ -67,9 +69,11 @@ describe('parse-github-url', function() {
6769
assert.equal(gh('https://raw.githubusercontent.com/assemble/verb/4d0ebde055557a0d1d988c01e0f070df8cc8fa07/README.md').branch, '4d0ebde055557a0d1d988c01e0f070df8cc8fa07');
6870
assert.equal(gh('https://raw.githubusercontent.com/assemble/verb/dev/README.md').branch, 'dev');
6971
assert.equal(gh('https://github.com/contentful/extensions/blob/master/samples/content-tree/extension.json').branch, 'master');
72+
73+
assert.end();
7074
});
7175

72-
it('should get the filepath:', function() {
76+
t.test('gets the filepath:', function (assert) {
7377
assert.equal(gh('assemble/verb#branch').filepath, null);
7478
assert.equal(gh('[email protected]:assemble/verb.git#0.6.0').filepath, null);
7579
assert.equal(gh('https://github.com/assemble/verb/blob/foo/README.md').filepath, 'README.md');
@@ -87,9 +91,11 @@ describe('parse-github-url', function() {
8791
assert.equal(gh('https://raw.githubusercontent.com/tree/project/dev/README.md').filepath, 'README.md');
8892
assert.equal(gh('https://raw.githubusercontent.com/owner/blob/dev/README.md').filepath, 'README.md');
8993
assert.equal(gh('https://raw.githubusercontent.com/blob/project/dev/README.md').filepath, 'README.md');
94+
95+
assert.end();
9096
});
9197

92-
it('should use master branch when another branch is not defined:', function() {
98+
t.test('uses master branch when another branch is not defined:', function (assert) {
9399
assert.equal(gh('assemble/verb').branch, 'master');
94100
assert.equal(gh('git://github.com/foo/bar.git').branch, 'master');
95101
assert.equal(gh('[email protected]:assemble/verb.git').branch, 'master');
@@ -99,9 +105,11 @@ describe('parse-github-url', function() {
99105
assert.equal(gh('https://github.com/assemble/verb').branch, 'master');
100106
assert.equal(gh('https://raw.githubusercontent.com/assemble/verb').branch, 'master');
101107
assert.equal(gh('https://github.com/assemble/verb/blob/master/foo/index.js').branch, 'master');
108+
109+
assert.end();
102110
});
103111

104-
it('should get a full repo path:', function() {
112+
t.test('gets a full repo path:', function (assert) {
105113
assert.equal(gh('assemble/verb#dev').repo, 'assemble/verb');
106114
assert.equal(gh('assemble/verb').repo, 'assemble/verb');
107115
assert.equal(gh('git+https://github.com/assemble/verb.git').repo, 'assemble/verb');
@@ -110,9 +118,11 @@ describe('parse-github-url', function() {
110118
assert.equal(gh('git://github.com/assemble/verb.git').repo, 'assemble/verb');
111119
assert.equal(gh('git://github.one.com/assemble/verb.git').repo, 'assemble/verb');
112120
assert.equal(gh('git://github.one.two.com/assemble/verb.git').repo, 'assemble/verb');
121+
122+
assert.end();
113123
});
114124

115-
it('should know when repo is not defined:', function() {
125+
t.test('knows when repo is not defined:', function (assert) {
116126
assert.equal(gh('git+https://github.com/assemble').name, null);
117127
assert.equal(gh('git+https://github.com/assemble').repo, null);
118128
assert.equal(gh('git+https://github.com/assemble').owner, 'assemble');
@@ -136,9 +146,11 @@ describe('parse-github-url', function() {
136146
assert.equal(gh('https://github.com').repo, null);
137147
assert.equal(gh('http://github.com/assemble').owner, 'assemble');
138148
assert.equal(gh('https://github.com').owner, null);
149+
150+
assert.end();
139151
});
140152

141-
it('should get the repo:', function() {
153+
t.test('gets the repo:', function (assert) {
142154
assert.equal(gh('assemble/verb#branch').name, 'verb');
143155
assert.equal(gh('assemble/dot.repo#branch').name, 'dot.repo');
144156
assert.equal(gh('assemble/verb#dev').name, 'verb');
@@ -202,9 +214,11 @@ describe('parse-github-url', function() {
202214
assert.equal(gh('https://github.com/repos/assemble/verb/zipball').name, 'verb');
203215
assert.equal(gh('https://github.com/repos/assemble/dot.repo/zipball').name, 'dot.repo');
204216
assert.equal(gh('SocialGouv/.kontinuous').name, '.kontinuous');
217+
218+
assert.end();
205219
});
206220

207-
it('should get the host:', function() {
221+
t.test('gets the host:', function (assert) {
208222
assert.equal(gh('git+https://github.com/assemble/verb.git').host, 'github.com');
209223
assert.equal(gh('git+ssh://github.com/assemble/verb.git').host, 'github.com');
210224
assert.equal(gh('git://github.com/assemble/verb').host, 'github.com');
@@ -218,9 +232,13 @@ describe('parse-github-url', function() {
218232
assert.equal(gh('[email protected]:assemble/dot.repo.git').host, 'gh.pages.com');
219233
assert.equal(gh('[email protected]:atlassian/atlaskit.git').host, 'bitbucket.org');
220234
assert.equal(gh('[email protected]:gitlab-org/gitlab-ce.git').host, 'gitlab.com');
235+
236+
assert.end();
221237
});
222238

223-
it('should assume github.com is the host when not provided:', function() {
239+
t.test('assumes github.com is the host when not provided:', function (assert) {
224240
assert.equal(gh('assemble/verb').host, 'github.com');
241+
242+
assert.end();
225243
});
226244
});

0 commit comments

Comments
 (0)