Skip to content

Commit

Permalink
Merge 72ad6d3 into 34dc9b8
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuste committed May 17, 2017
2 parents 34dc9b8 + 72ad6d3 commit 70aa7cd
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 16 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service_name: travis-ci
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
Expand All @@ -24,10 +23,8 @@ coverage
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history
/test-compiled
/coverage
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: node_js
node_js:
- "0.12"
- "1"
- "2"
- "4.1.2"
- "6.10.0"
- "7.0.0"
- "7.7.1"
script: npm test
sudo: false
after_success: 'npm run cover'
25 changes: 21 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,29 @@ COFFEE = ./node_modules/coffee-script/bin/coffee
usage:
@echo ''
@echo 'make compile: Compile sources'
@echo 'make compile-tests: Compile test sources'
@echo ''

# --

# Compile Assets
.PHONY: compile
# Compile sources
.PHONY: compile compile-tests
compile:
[ -d ./lib ] && rm -r ./lib || 0
@$(COFFEE) --no-header -cbo ./lib ./src
@$(COFFEE) --output ./lib --no-header --compile -b ./src

# Compile tests
compile-tests: compile
@$(COFFEE) --output ./test-compiled --no-header --compile -b ./test

# Run lint for coffeescript
run-coffee-lint:
./node_modules/coffeelint/bin/coffeelint src/ test/

test: compile-tests run-coffee-lint
./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha ./test-compiled/**/*.js

test-debug: compile-tests
./node_modules/mocha/bin/mocha --debug-brk ./test-compiled/**/*.js

cover:
cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "jaune-tasks",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "make compile"
"test": "make test",
"prepublish": "make compile",
"cover": "make cover"
},
"repository": {
"type": "git",
Expand All @@ -28,7 +29,15 @@
"require-linked-peer": "^0.1.0"
},
"devDependencies": {
"coffee-script": "^1.10.0",
"jaune-tasks": "git+ssh://github.com/ajuste/jaune-tasks.git#master"
"assert": "^1.3.0",
"coffee-script": "^1.12.5",
"coffeelint": "^1.16.0",
"coveralls": "^2.13.0",
"gulp-stylus": "^2.6.0",
"gulp-uglify": "^2.1.2",
"gulp-webpack": "^1.5.0",
"istanbul": "^0.4.5",
"mocha": "^2.4.5",
"mock-require": "^2.0.2"
}
}
3 changes: 2 additions & 1 deletion src/tasks/webpack.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module.exports = (settings, task, gulp) ->

# if there are loaders then parse regex
if loaders?
args.module.loaders = loaders.map (l) -> loader: l.loader, test: new RegExp l.test
args.module.loaders = loaders.map (l) ->
loader: l.loader, test: new RegExp l.test

if plugins?
args.plugins = plugins.map (l) -> Reflection.evaluateName l
Expand Down
80 changes: 80 additions & 0 deletions test/index.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
mock = require 'mock-require'

{
create
} = require '../'

{
equal
ok
} = require 'assert'

SettingsPath = 'the-path'
EnvConfig = {}
Settings =
doMyStuff: [
{name: 'stylus', prop1: 'a'}
{name: 'uglify', prop2: 'b'}
]
doThatThing: [
{name: 'webpack', propb: 'z'}
]

TaskStylus = (settings, conf, gulp) ->
assert settings, Settings
assert Settings.doMyStuff[0]

TaskUglify = (settings, conf, gulp) ->
assert settings, Settings
assert Settings.doMyStuff[1]

TaskDoThatThing = (settings, conf, gulp) ->
assert settings, Settings
assert Settings.doThatThing[0]

describe 'exports', ->

@timeout 5000

before ->

mock 'jaune-util',
Reflection:
evaluateName: (settingsPath) ->
equal settingsPath, SettingsPath
EnvConfig

mock 'jaune-env',
class
constructor: (config) ->
equal config, EnvConfig
getEnvProperty: (configName) ->
equal 'jaune.build_tasks', configName
Settings

mock './tasks/stylus', TaskStylus

mock './tasks/uglify', TaskUglify

mock './tasks/webpack', TaskDoThatThing

after ->
mock.stopAll()
@gulp = null

it 'creates gulp on export', ->
@gulp = require('../') SettingsPath
ok @gulp
ok @gulp.tasks

it 'contains default task', ->
ok @gulp.tasks.default

it 'contains help task', ->
ok @gulp.tasks.help

it 'contains doMyStuff task', ->
ok @gulp.tasks.doMyStuff

it 'contains doThatThing task', ->
ok @gulp.tasks.doThatThing

0 comments on commit 70aa7cd

Please sign in to comment.