Skip to content

Instantly share code, notes, and snippets.

@turboMaCk turboMaCk/.nvmrc
Last active Sep 16, 2017

What would you like to do?
Elm-test with gulp

Running elm-test via Gulp

Example of using Gulp for running elm-test with watch.

Expecting node.js with ES2015 support. Node 5.5.0 for example!

There are few things hardcoded inside this config. At first expected test location is tests/ and your source should be in src/ directory. The main test file name is Main.elm by default. You can change this setting in gulpfile.js

// Import packages
const gulp = require('gulp')
const elm = require('gulp-elm')
const watch = require('gulp-watch')
const shell = require('gulp-shell')
// Initialize gulp-elm
gulp.task('elm-init', elm.init)
// Make elm task
gulp.task('make', ['elm-init'], () => {
return gulp.src('src/*.elm')
// Test
gulp.task('test', ['elm-init'], () => {
return gulp.src('tests/*.elm')
[ 'echo start elm-test build'
, 'sh ./elm-stuff/packages/laszlopandy/elm-console/1.1.0/ tmp/Main.js tmp/test.js'
, 'node tmp/test.js' ]
// Watch for changes and run test automatically
gulp.task('watch', function() {
gulp.start('test')'src/**', ['make'])'tests/**', ['test'])
// By default run tests and then starts
// watching for changes
gulp.task('default', ['test', 'watch'])
"name": "elm-test-gulp",
"version": "0.0.1",
"description": "Testing el",
"main": "tmp/test.js",
"directories": {
"test": "test"
"author": "Marek Fajkus",
"license": "BSD-3-Clause",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-elm": "^0.2.0",
"gulp-shell": "^0.5.2",
"gulp-watch": "^4.3.5"
$ gulp

to run tests and start wathing

$ gulp test

to run tests

$ gulp make

to build elm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.