Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit b9eb997

Browse files
committed
feat: add ci
fix: update lock fix: ignore packages fix: fix deps and add lock fix: fix deps 2 fix: ignore packages 2 fix: add mocha reporter to karma fix: remove unused cmd chore: update lock feat: add gitattributes feat: test attributes feat: test attributes 2 fix: fix stderr match fix: fix more files line endings fix: fix line ending chore: remove lock chore: fix win test run chore: ignore lock chore: change to yarn chore: fix cov chore: fix cov
1 parent ce4ff3e commit b9eb997

File tree

5 files changed

+140
-2
lines changed

5 files changed

+140
-2
lines changed

.aegir.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const path = require('path')
34
const IPFSFactory = require('ipfsd-ctl')
45
const parallel = require('async/parallel')
56
const MockPreloadNode = require('./test/utils/mock-preload-node')
@@ -21,6 +22,39 @@ module.exports = {
2122
included: false
2223
}],
2324
browserNoActivityTimeout: 100 * 1000,
25+
reporters: ['mocha-own', 'coverage-istanbul'],
26+
coverageIstanbulReporter: {
27+
reports: ['json'],
28+
dir: path.join(__dirname, 'coverage'),
29+
combineBrowserReports: true,
30+
fixWebpackSourcePaths: true,
31+
},
32+
preprocessors: { 'node_modules/aegir/src/config/karma-entry.js': [ 'webpack', 'sourcemap' ] },
33+
webpack: {
34+
module: {
35+
rules: [
36+
// instrument only testing sources with Istanbul
37+
{
38+
test: /\.js$/,
39+
use: { loader: 'istanbul-instrumenter-loader' },
40+
include: path.resolve('src/')
41+
}
42+
]
43+
}
44+
},
45+
customLaunchers: {
46+
ChromeDocker: {
47+
base: 'ChromeHeadless',
48+
// We must disable the Chrome sandbox when running Chrome inside Docker (Chrome's sandbox needs
49+
// more permissions than Docker allows by default)
50+
flags: ['--no-sandbox']
51+
}
52+
},
53+
client: {
54+
mocha: {
55+
bail: true,
56+
}
57+
},
2458
singleRun: true
2559
},
2660
hooks: {

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
test/** text eol=lf
3+
src/init-files/** text eol=lf

.gitlab-ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
image: hugomrdias/node-alpine:test
2+
stages:
3+
- check
4+
- test
5+
- cov
6+
- pre-release
7+
- release
8+
9+
variables:
10+
DOCKER_DRIVER: overlay2
11+
12+
before_script:
13+
- yarn
14+
15+
check:
16+
stage: check
17+
script:
18+
- yarn lint
19+
- yarn dep-check
20+
# - npm install --no-lockfile @commitlint/config-conventional @commitlint/cli --save-dev
21+
# - npx commitlint --extends=@commitlint/config-conventional --from=$CI_COMMIT_BEFORE_SHA --to=$CI_COMMIT_SHA
22+
- yarn build
23+
artifacts:
24+
paths:
25+
- dist/
26+
27+
linux-node-10:
28+
image: node:10
29+
stage: test
30+
script:
31+
- npx nyc -s npm run test:node -- --bail
32+
artifacts:
33+
paths:
34+
- .nyc_output/
35+
36+
linux-node-11:
37+
allow_failure: true
38+
image: node:11
39+
stage: test
40+
script:
41+
- npx nyc -s npm run test:node -- --bail
42+
artifacts:
43+
paths:
44+
- .nyc_output/
45+
46+
macos-node-10:
47+
stage: test
48+
script:
49+
- npx nyc -s npm run test:node -- --bail
50+
tags:
51+
- mac
52+
artifacts:
53+
paths:
54+
- .nyc_output/
55+
56+
win-node-10:
57+
stage: test
58+
script:
59+
- npx nyc -s npm run test:node -- --bail
60+
tags:
61+
- win
62+
artifacts:
63+
paths:
64+
- .nyc_output/
65+
66+
test-browser-chrome:
67+
image: hugomrdias/node-chrome:test
68+
stage: test
69+
script:
70+
- AEGIR_BROWSERS=ChromeDocker yarn test:browser
71+
artifacts:
72+
paths:
73+
- coverage/
74+
75+
test-browser-firefox:
76+
allow_failure: true
77+
image: hugomrdias/node-firefox:test
78+
stage: test
79+
script:
80+
- AEGIR_BROWSERS=FirefoxHeadless yarn test:browser
81+
artifacts:
82+
paths:
83+
- coverage/
84+
85+
cov:
86+
stage: cov
87+
before_script: []
88+
script:
89+
- cp coverage/coverage-final.json .nyc_output/browser.json
90+
- npx nyc report --reporter text-summary --reporter html
91+
dependencies:
92+
- linux-node-10
93+
- win-node-10
94+
- macos-node-10
95+
- test-browser-chrome
96+
artifacts:
97+
paths:
98+
- coverage/
99+
coverage: '/Lines : \d+\.\d+/'

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"release-major": "aegir release --type major -t node -t browser",
4646
"coverage": "aegir coverage",
4747
"coverage-publish": "aegir-coverage publish",
48-
"dep-check": "npx dependency-check package.json './test/**/*.js' './src/**/*.js'"
48+
"dep-check": "npx dependency-check package.json './test/**/*.js' './src/**/*.js' -i electron-webrtc -i wrtc"
4949
},
5050
"repository": {
5151
"type": "git",
@@ -71,6 +71,8 @@
7171
"hat": "0.0.3",
7272
"interface-ipfs-core": "~0.88.0",
7373
"ipfsd-ctl": "~0.40.1",
74+
"istanbul-instrumenter-loader": "^3.0.1",
75+
"karma-coverage-istanbul-reporter": "^2.0.4",
7476
"ncp": "^2.0.0",
7577
"qs": "^6.5.2",
7678
"rimraf": "^2.6.2",

test/cli/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('config', () => runOnAndOff((thing) => {
6969

7070
it('call config with no arguments', () => {
7171
return ipfs('config')
72-
.then(out => expect(out).to.include('bin.js config <key> [value]'))
72+
.then(out => expect(out).to.include('Not enough non-option arguments: got 0, need at least 1'))
7373
})
7474
})
7575

0 commit comments

Comments
 (0)