Skip to content

Commit

Permalink
jasmine tests running in grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
bence.demko committed Apr 28, 2017
1 parent 7fbc2da commit 682cd87
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
15 changes: 6 additions & 9 deletions gruntfile.js
Expand Up @@ -44,25 +44,22 @@ module.exports = function (grunt) {
target: [
'index.js',
'src/file-util.js',
'test/file-util.spec.js',
'test/spec/file-util.spec.js',
'gruntfile.js'
]
},
karma: {
jasmine_nodejs: {
unit: {
options: {
files: ['test/file-util.spec.js'],
singleRun: true,
browsers: ['PhantomJS'],
frameworks: ['jasmine']
}
specs: [
'test/spec/**/*.spec.js'
]
}
}
})

require('load-grunt-tasks')(grunt)

grunt.registerTask('default', ['eslint', 'karma:unit'])
grunt.registerTask('default', ['eslint', 'jasmine_nodejs'])

grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) {
grunt.task.run([
Expand Down
14 changes: 5 additions & 9 deletions package.json
Expand Up @@ -6,7 +6,7 @@
"files": [
"index.js",
"src/file-util.js",
"test/file-util.spec.js"
"test/spec/file-util.spec.js"
],
"scripts": {
"test": "grunt"
Expand All @@ -33,19 +33,15 @@
"eslint": "^1.2.1",
"eslint-config-standard": "^4.1.0",
"eslint-plugin-standard": "^1.3.1",
"eslint-plugin-jasmine": "2.2.0",
"grunt": "^0.4.1",
"grunt-bump": "^0.5.0",
"grunt-conventional-changelog": "^4.1.0",
"grunt-conventional-github-releaser": "^0.4.0",
"grunt-eslint": "^17.1.0",
"grunt-karma": "2.0.0",
"grunt-jasmine-nodejs": "1.6.0",
"grunt-npm": "^0.0.2",
"jasmine": "2.5.2",
"jasmine-core": "2.5.2",
"eslint-plugin-jasmine": "2.2.0",
"karma-jasmine": "1.1.0",
"karma-phantomjs-launcher": "1.0.4",
"load-grunt-tasks": "^3.2.0",
"phantomjs": "2.1.7"
"jasmine-node": "1.14.5",
"load-grunt-tasks": "^3.2.0"
}
}
Empty file.
11 changes: 7 additions & 4 deletions test/file-util.spec.js → test/spec/file-util.spec.js
@@ -1,10 +1,13 @@
var path = require('path')

describe('create description - file name map from test sources', function () {
var fileUtil = require('../src/file-util.js')
var fileUtil = require('../../src/file-util.js')

it('one test file, one description', function () {
var filesForDescriptions = fileUtil.getFilesForDescriptions('resources/one_file_one_description', '.spec.js')
var expected = {'test description': 'resources/one_file_one_description.spec.js'}
expect(filesForDescriptions).toBe(expected)
var filesForDescriptions = fileUtil.getFilesForDescriptions('test/resources/one_file_one_description', '.spec.js')
var expectedPath = path.join('test', 'resources', 'one_file_one_description', 'test.spec.js')
var expected = {'test description': expectedPath}
expect(filesForDescriptions).toEqual(expected)
})

it('multiple test files, one description', function () {
Expand Down

0 comments on commit 682cd87

Please sign in to comment.