Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 264ebeb

Browse files
committedOct 15, 2018
Initial framework setup: karma, mocha+chai+sinon, webpack, babel, istanbul
0 parents  commit 264ebeb

File tree

9 files changed

+5818
-0
lines changed

9 files changed

+5818
-0
lines changed
 

‎.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
coverage/
3+
yarn-error.log

‎LICENSE

Lines changed: 662 additions & 0 deletions
Large diffs are not rendered by default.

‎index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./src/jsonapi-vuex')

‎karma.conf.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Karma configuration
2+
3+
const src = './src/**/*.js'
4+
const tests = './spec/**/*.spec.js'
5+
6+
module.exports = function(config) {
7+
config.set({
8+
//singleRun: true,
9+
browsers: ['FirefoxHeadless'],
10+
customLaunchers: {
11+
'FirefoxHeadless': {
12+
base: 'Firefox',
13+
flags: [
14+
'-headless',
15+
],
16+
}
17+
},
18+
frameworks: ['mocha', 'chai', 'sinon'],
19+
files: [
20+
'node_modules/babel-polyfill/dist/polyfill.js',
21+
tests
22+
],
23+
preprocessors: {
24+
[src]: ['webpack'],
25+
[tests]: ['webpack'],
26+
},
27+
webpack: require('./webpack.config'),
28+
reporters: ['verbose', 'coverage'],
29+
coverageReporter: {
30+
dir: 'coverage',
31+
reporters: [
32+
{ type: 'text' },
33+
{ type: 'text-summary' },
34+
//{ type: 'html' }
35+
]
36+
}
37+
})
38+
}

‎package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"devDependencies": {
3+
"@babel/core": "^7.1.2",
4+
"@babel/preset-env": "^7.1.0",
5+
"babel-loader": "^8.0.4",
6+
"babel-plugin-istanbul": "^5.0.1",
7+
"babel-polyfill": "^6.26.0",
8+
"chai": "^4.2.0",
9+
"karma": "^3.0.0",
10+
"karma-chai": "^0.1.0",
11+
"karma-coverage": "^1.1.2",
12+
"karma-firefox-launcher": "^1.1.0",
13+
"karma-mocha": "^1.3.0",
14+
"karma-sinon": "^1.0.5",
15+
"karma-verbose-reporter": "^0.0.6",
16+
"karma-webpack": "^4.0.0-rc.2",
17+
"mocha": "^5.2.0",
18+
"sinon": "^6.3.5",
19+
"vue": "^2.5.17",
20+
"vuex": "^3.0.1",
21+
"webpack": "^4.20.2"
22+
},
23+
"name": "jsonapi-vuex",
24+
"version": "0.0.1",
25+
"description": "Access normalized JSONAPI data from a Vuex Store.",
26+
"main": "index.js",
27+
"author": "Matthew Richardson <M.Richardson@ed.ac.uk>",
28+
"license": "AGPL-3.0",
29+
"scripts": {
30+
"test": "karma start"
31+
}
32+
}

‎spec/example/example.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { example } from '../../src/example.js';
2+
3+
describe("Test that things work", function() {
4+
5+
it("true should be true", function() {
6+
expect(true).toBe(true);
7+
});
8+
it("example should also be true", function() {
9+
expect(example).toBe(true);
10+
});
11+
});

‎src/example.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const example = true;
2+
3+
export { example }

‎webpack.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
mode: 'production',
3+
module: {
4+
rules: [
5+
{
6+
test: /\.js$/,
7+
exclude: /(node_modules|bower_components)/,
8+
use: {
9+
loader: 'babel-loader',
10+
options: {
11+
presets: ['@babel/preset-env'],
12+
plugins: [
13+
['istanbul', {
14+
"exclude": [
15+
"**/*.spec.js"
16+
]
17+
}],
18+
],
19+
}
20+
}
21+
}
22+
]
23+
}
24+
}

‎yarn.lock

Lines changed: 5044 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.