node-elm-compiler
Advanced tools
Comparing version 2.3.2 to 2.3.3
@@ -167,2 +167,6 @@ 'use strict'; | ||
fs.readFile(info.path, function(err, data){ | ||
if (exitCode !== 0) { | ||
err = "Compiler process exited with code " + exitCode; | ||
} | ||
temp.cleanupSync(); | ||
@@ -169,0 +173,0 @@ |
{ | ||
"name": "node-elm-compiler", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "A Node.js interface to the Elm compiler binaries. Supports Elm versions 0.15 - 0.16.", | ||
@@ -35,4 +35,5 @@ "main": "index.js", | ||
"chai": "3.4.1", | ||
"chai-spies": "0.7.1", | ||
"mocha": "2.3.4" | ||
} | ||
} |
@@ -17,2 +17,6 @@ # node-elm-compiler [![Version](https://img.shields.io/npm/v/node-elm-compiler.svg)](https://www.npmjs.com/package/node-elm-compiler) [![Travis build Status](https://travis-ci.org/rtfeldman/node-elm-compiler.svg?branch=master)](http://travis-ci.org/rtfeldman/node-elm-compiler) [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/xv83jcomgb81i1iu/branch/master?svg=true)](https://ci.appveyor.com/project/rtfeldman/node-elm-compiler/branch/master) | ||
## 2.3.3 | ||
Fix bug where nonzero exit codes were not rejecting promises. | ||
## 2.3.2 | ||
@@ -19,0 +23,0 @@ |
@@ -1,2 +0,3 @@ | ||
var assert = require("chai").assert; | ||
var chai = require("chai") | ||
var spies = require("chai-spies"); | ||
var path = require("path"); | ||
@@ -7,2 +8,6 @@ var compiler = require(path.join(__dirname, "..")); | ||
chai.use(spies); | ||
var expect = chai.expect; | ||
var fixturesDir = path.join(__dirname, "fixtures"); | ||
@@ -15,6 +20,6 @@ | ||
describe("#compile", function() { | ||
// Use a timeout of 5 minutes because Travis on Linux can be SUPER slow. | ||
this.timeout(300000); | ||
it("works with --yes", function (done) { | ||
// Use a timeout of 5 minutes because Travis on Linux can be SUPER slow. | ||
this.timeout(300000); | ||
var opts = {yes: true, output: "/dev/null", verbose: true, cwd: fixturesDir}; | ||
@@ -24,6 +29,91 @@ var compileProcess = compiler.compile(prependFixturesDir("Parent.elm"), opts); | ||
compileProcess.on("exit", function(exitCode) { | ||
assert.equal(exitCode, 0, "Expected elm-make to have exit code 0"); | ||
expect(exitCode, "Expected elm-make to have exit code 0").to.equal(0); | ||
done(); | ||
}); | ||
}); | ||
it("reports errors on bad source", function (done) { | ||
var opts = { | ||
yes: true, | ||
verbose: true, | ||
cwd: fixturesDir | ||
}; | ||
var compileProcess = compiler.compile(prependFixturesDir("Bad.elm"), opts); | ||
compileProcess.on("exit", function(exitCode) { | ||
var desc = "Expected elm-make to have exit code 1"; | ||
expect(exitCode, desc).to.equal(1); | ||
done(); | ||
}); | ||
}); | ||
it("invokes custom `warn`", function (done) { | ||
var opts = { | ||
foo: "bar", | ||
warn: chai.spy(), | ||
yes: true, | ||
output: "/dev/null", | ||
verbose: true, | ||
cwd: fixturesDir | ||
}; | ||
var compileProcess = compiler.compile(prependFixturesDir("Parent.elm"), opts); | ||
compileProcess.on("exit", function(exitCode) { | ||
var desc = "Expected warn to have been called"; | ||
expect(opts.warn, desc).to.have.been.called(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe("#compileToString", function() { | ||
// Use a timeout of 5 minutes because Travis on Linux can be SUPER slow. | ||
this.timeout(3000); | ||
it("works with --yes", function (done) { | ||
var opts = { | ||
yes: true, | ||
verbose: true, | ||
cwd: fixturesDir | ||
}; | ||
var compilePromise = compiler.compileToString(prependFixturesDir("Parent.elm"), opts); | ||
compilePromise.then(function(result) { | ||
var desc = "Expected elm-make to return the result of the compilation"; | ||
expect(result.toString(), desc).to.be.a('string'); | ||
done(); | ||
}); | ||
}); | ||
it("reports errors on bad source", function (done) { | ||
var opts = { | ||
yes: true, | ||
verbose: true, | ||
cwd: fixturesDir | ||
}; | ||
var compilePromise = compiler.compileToString(prependFixturesDir("Bad.elm"), opts); | ||
compilePromise.catch(function(err) { | ||
var desc = "Expected elm-make to have exit code 1"; | ||
expect(err, desc).to.equal("Compiler process exited with code 1"); | ||
done(); | ||
}); | ||
}); | ||
it("invokes custom `warn`", function (done) { | ||
var opts = { | ||
foo: "bar", | ||
warn: chai.spy(), | ||
yes: true, | ||
verbose: true, | ||
cwd: fixturesDir | ||
}; | ||
var compilePromise = compiler.compileToString(prependFixturesDir("Parent.elm"), opts); | ||
compilePromise.then(function(err) { | ||
var desc = "Expected warn to have been called"; | ||
expect(opts.warn, desc).to.have.been.called(); | ||
done(); | ||
}); | ||
}); | ||
}); |
@@ -1,2 +0,2 @@ | ||
var assert = require("chai").assert; | ||
var expect = require("chai").expect; | ||
var path = require("path"); | ||
@@ -14,4 +14,3 @@ var compiler = require(path.join(__dirname, "..")); | ||
return compiler.findAllDependencies(prependFixturesDir("Parent.elm")).then(function(results) { | ||
assert.deepEqual( | ||
results, | ||
expect(results).to.deep.equal( | ||
[ "Test/ChildA.elm", "Test/ChildB.elm", "Native/Child.js" ].map(prependFixturesDir) | ||
@@ -24,4 +23,3 @@ ); | ||
return compiler.findAllDependencies(prependFixturesDir("ParentWithNestedDeps.elm")).then(function(results) { | ||
assert.deepEqual( | ||
results, | ||
expect(results).to.deep.equal( | ||
[ "Test/ChildA.elm", "Test/Sample/NestedChild.elm", "Test/ChildB.elm", "Native/Child.js" ].map(prependFixturesDir) | ||
@@ -28,0 +26,0 @@ ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19540
22
357
50
3