Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ CHANGELOG.md
config.js

# Built asset files
/core/built
/core/built

# Coverage reports
coverage_integration.html
coverage_unit.html
17 changes: 17 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ var path = require('path'),
shell: {
bourbon: {
command: 'bourbon install --path <%= paths.adminAssets %>/sass/modules/'
},
jscoverage: {
command: 'jscoverage core core-cov'
},
mocha_unit_coverage: {
command: 'NODE_ENV=testing APP_COVERAGE=1 ./node_modules/.bin/mocha --timeout 15000 --reporter html-cov > coverage_unit.html ./core-cov/test/unit'
},
mocha_integration_coverage: {
command: 'NODE_ENV=testing APP_COVERAGE=1 ./node_modules/.bin/mocha --timeout 15000 --reporter html-cov > coverage_integration.html ./core-cov/test/integration'
}
},

Expand Down Expand Up @@ -296,6 +305,9 @@ var path = require('path'),
},
test: {
src: ['content/data/ghost-test.db']
},
jscoverage: {
src: ['core-cov']
}
},

Expand Down Expand Up @@ -865,6 +877,11 @@ var path = require('path'),
grunt.registerTask('validate', 'Run tests and lint code', ['jslint', 'test-unit', 'test-integration', 'test-functional']);


// ## Coverage report for Unit and Integration Tests

grunt.registerTask('test-coverage', 'Generate unit and integration tests coverage report', ['clean:test', 'setTestEnv', 'loadConfig', 'express:test', 'shell:jscoverage', 'shell:mocha_unit_coverage', 'shell:mocha_integration_coverage', 'clean:jscoverage']);


// ## Documentation

grunt.registerTask('docs', 'Generate Docs', ['groc']);
Expand Down
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// # Ghost bootloader
// Orchestrates the loading of Ghost

var configLoader = require('./core/config-loader.js'),
error = require('./core/server/errorHandling');
var core_path = process.env.APP_COVERAGE
? './core-cov'
: './core',
configLoader = require(core_path + '/config-loader.js'),
error = require(core_path + '/server/errorHandling');

// If no env is set, default to development
process.env.NODE_ENV = process.env.NODE_ENV || 'development';

configLoader.loadConfig().then(function () {
// The server and its dependencies require a populated config
require('./core/server');
require(core_path + '/server');
}).otherwise(error.logAndThrowError);