Skip to content

Commit 5f4ab63

Browse files
committed
chore(ci): add node versions and say git version in ci
1 parent fd51001 commit 5f4ab63

File tree

5 files changed

+118
-106
lines changed

5 files changed

+118
-106
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ branches:
99
notifications:
1010
email: false
1111
node_js:
12+
- '7'
13+
- '6'
14+
- '5'
1215
- '4'
1316
- '0.12'
1417
before_install:
1518
- git config --global user.name "TravisCI"
1619
- npm i -g npm@^2.0.0
1720
before_script:
1821
- npm prune
22+
- git version
1923
- curl -Lo travis_after_all.py https://git.io/vLSON
2024
script:
2125
- npm run test

test/tests/adapter.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ beforeEach(function() {
2525
});
2626

2727
describe('adapter', function() {
28-
28+
2929
it('resolves adapter paths', function() {
30-
30+
3131
this.timeout(config.maxTimeout); // this could take a while
32-
32+
3333
// SETUP
34-
34+
3535
// Describe a repo and some files to add and commit
3636
let repoConfig = {
3737
path: config.paths.endUserRepo,
@@ -46,29 +46,29 @@ describe('adapter', function() {
4646
}
4747
}
4848
};
49-
49+
5050
// Describe an adapter
5151
let adapterConfig = {
5252
path: path.join(repoConfig.path, '/node_modules/cz-conventional-changelog'),
5353
npmName: 'cz-conventional-changelog'
5454
};
55-
55+
5656
// Install an adapter
5757
commitizenInit(sh, config.paths.endUserRepo, 'cz-conventional-changelog');
58-
59-
// TEST
58+
59+
// TEST
6060
expect(function() {adapter.resolveAdapterPath('IAMANIMPOSSIBLEPATH'); }).to.throw(Error);
6161
expect(function() {adapter.resolveAdapterPath(adapterConfig.path); }).not.to.throw(Error);
6262
expect(function() {adapter.resolveAdapterPath(path.join(adapterConfig.path, 'index.js')); }).not.to.throw(Error);
6363
expect(function() {adapter.resolveAdapterPath('cz-conventional-changelog'); }).not.to.throw(Error);
6464
});
65-
65+
6666
it('gets adapter prompter functions', function(){
67-
67+
6868
this.timeout(config.maxTimeout); // this could take a while
69-
69+
7070
// SETUP
71-
71+
7272
// Describe a repo and some files to add and commit
7373
let repoConfig = {
7474
path: config.paths.endUserRepo,
@@ -83,31 +83,33 @@ describe('adapter', function() {
8383
}
8484
}
8585
};
86-
86+
8787
// Describe an adapter
8888
let adapterConfig = {
8989
path: path.join(repoConfig.path, '/node_modules/cz-conventional-changelog'),
9090
npmName: 'cz-conventional-changelog'
9191
};
92-
92+
9393
// Install an adapter
9494
commitizenInit(sh, config.paths.endUserRepo, 'cz-conventional-changelog');
95-
96-
// TEST
95+
96+
// TEST
9797
expect(function() {adapter.getPrompter('IAMANIMPOSSIBLEPATH'); }).to.throw(Error);
9898
expect(function() {adapter.getPrompter(adapterConfig.path); }).not.to.throw(Error);
99-
expect(isFunction(adapter.getPrompter(adapterConfig.path))).to.be.true;
99+
expect(isFunction(adapter.getPrompter(adapterConfig.path))).to.be.true;
100100
});
101101

102102
});
103103

104104
afterEach(function() {
105+
this.timeout(config.maxTimeout); // this could take a while
105106
// All this should do is archive the tmp path to the artifacts
106107
clean.afterEach(sh, config.paths.tmp, config.preserve);
107-
});
108+
});
108109

109110
after(function() {
110-
// Once everything is done, the artifacts should be cleaned up based on
111+
this.timeout(config.maxTimeout); // this could take a while
112+
// Once everything is done, the artifacts should be cleaned up based on
111113
// the preserve setting in the config
112114
clean.after(sh, config.paths.tmp, config.preserve);
113-
});
115+
});

test/tests/commit.js

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ beforeEach(function() {
2929
});
3030

3131
describe('commit', function() {
32-
32+
3333
it('should commit simple messages', function(done) {
34-
34+
3535
this.timeout(config.maxTimeout); // this could take a while
36-
36+
3737
// SETUP
38-
38+
3939
let dummyCommitMessage = `sip sip sippin on some sizzurp`;
40-
40+
4141
// Describe a repo and some files to add and commit
4242
let repoConfig = {
4343
path: config.paths.endUserRepo,
@@ -52,17 +52,17 @@ describe('commit', function() {
5252
}
5353
}
5454
};
55-
55+
5656
// Describe an adapter
5757
let adapterConfig = {
5858
path: path.join(repoConfig.path, '/node_modules/cz-jira-smart-commit'),
5959
npmName: 'cz-jira-smart-commit'
6060
};
61-
61+
6262
// Quick setup the repos, adapter, and grab a simple prompter
6363
let prompter = quickPrompterSetup(sh, repoConfig, adapterConfig, dummyCommitMessage);
6464
// TEST
65-
65+
6666
// Pass in inquirer but it never gets used since we've mocked out a different
6767
// version of prompter.
6868
commitizenCommit(sh, inquirer, repoConfig.path, prompter, {disableAppendPaths:true, quiet:true, emitData:true}, function() {
@@ -73,7 +73,7 @@ describe('commit', function() {
7373
});
7474

7575
});
76-
76+
7777
it('should commit message with quotes', function(done) {
7878

7979
this.timeout(config.maxTimeout); // this could take a while
@@ -120,29 +120,29 @@ describe('commit', function() {
120120

121121

122122
it('should commit multiline messages', function(done) {
123-
123+
124124
this.timeout(config.maxTimeout); // this could take a while
125-
125+
126126
// SETUP
127-
127+
128128
// Don't trim or delete the spacing in this commit message!
129-
129+
130130
// Git on *nix retains spaces on lines with only spaces
131131
// The blank line of this block should have 4 spaces.
132132
let nixCommitMessage =
133133
`sip sip sippin on jnkjnkjn
134134
135135
some sizzurp`;
136-
136+
137137
// Git on win32 removes spaces from lines with only spaces
138138
// The blank line of this block should have no spaces
139139
let windowsCommitMessage =
140140
`sip sip sippin on jnkjnkjn
141141
142142
some sizzurp`;
143-
143+
144144
let dummyCommitMessage = (os.platform == 'win32') ? windowsCommitMessage : nixCommitMessage;
145-
145+
146146
// Describe a repo and some files to add and commit
147147
let repoConfig = {
148148
path: config.paths.endUserRepo,
@@ -157,17 +157,17 @@ describe('commit', function() {
157157
}
158158
}
159159
};
160-
160+
161161
// Describe an adapter
162162
let adapterConfig = {
163163
path: path.join(repoConfig.path, '/node_modules/cz-conventional-changelog'),
164164
npmName: 'cz-conventional-changelog'
165165
};
166-
166+
167167
// Quick setup the repos, adapter, and grab a simple prompter
168168
let prompter = quickPrompterSetup(sh, repoConfig, adapterConfig, dummyCommitMessage);
169169
// TEST
170-
170+
171171
// Pass in inquirer but it never gets used since we've mocked out a different
172172
// version of prompter.
173173
commitizenCommit(sh, inquirer, repoConfig.path, prompter, {disableAppendPaths:true, quiet:true}, function() {
@@ -180,14 +180,14 @@ describe('commit', function() {
180180
});
181181

182182
it('should allow to override git commit options', function(done) {
183-
183+
184184
this.timeout(config.maxTimeout); // this could take a while
185-
185+
186186
// SETUP
187-
187+
188188
let dummyCommitMessage = `sip sip sippin on some sizzurp`;
189189
let author = `A U Thor <[email protected]>`;
190-
190+
191191
// Describe a repo and some files to add and commit
192192
let repoConfig = {
193193
path: config.paths.endUserRepo,
@@ -202,21 +202,21 @@ describe('commit', function() {
202202
}
203203
}
204204
};
205-
205+
206206
// Describe an adapter
207207
let adapterConfig = {
208208
path: path.join(repoConfig.path, '/node_modules/cz-jira-smart-commit'),
209209
npmName: 'cz-jira-smart-commit'
210210
};
211-
211+
212212
let options = {
213213
args: `--author="${author}" --no-edit`
214214
};
215-
215+
216216
// Quick setup the repos, adapter, and grab a simple prompter
217217
let prompter = quickPrompterSetup(sh, repoConfig, adapterConfig, dummyCommitMessage, options);
218218
// TEST
219-
219+
220220
// Pass in inquirer but it never gets used since we've mocked out a different
221221
// version of prompter.
222222
commitizenCommit(sh, inquirer, repoConfig.path, prompter, {disableAppendPaths:true, quiet:true, emitData:true}, function() {
@@ -228,15 +228,17 @@ describe('commit', function() {
228228
});
229229

230230
});
231-
231+
232232
});
233233

234234
afterEach(function() {
235+
this.timeout(config.maxTimeout); // this could take a while
235236
// All this should do is archive the tmp path to the artifacts
236237
clean.afterEach(sh, config.paths.tmp, config.preserve);
237238
});
238239

239240
after(function() {
241+
this.timeout(config.maxTimeout); // this could take a while
240242
// Once everything is done, the artifacts should be cleaned up based on
241243
// the preserve setting in the config
242244
clean.after(sh, config.paths.tmp, config.preserve);
@@ -247,23 +249,23 @@ after(function() {
247249
* prompter is overriden for testing purposes.
248250
*/
249251
function quickPrompterSetup(sh, repoConfig, adapterConfig, commitMessage, options={}) {
250-
252+
251253
commitizenInit(sh, repoConfig.path, adapterConfig.npmName);
252-
254+
253255
// NOTE:
254256
// In our real code we'd use this here but since we're testing,
255257
// we'll provide prompter. We'd normally use:
256258
// let prompter = getPrompter(adapterConfig.path);
257259
let prompter = function(cz, commit) {
258260
commit(commitMessage, options);
259261
}
260-
262+
261263
gitInit(sh, repoConfig.path);
262-
264+
263265
writeFilesToPath(repoConfig.files, repoConfig.path);
264-
266+
265267
gitAdd(sh, repoConfig.path);
266-
268+
267269
// NOTE: In the real world we would not be returning
268270
// this we would instead be just making the commented
269271
// out getPrompter() call to get user input (above).

0 commit comments

Comments
 (0)