diff --git a/bin/elm-app-cli.js b/bin/elm-app-cli.js index a9e4d5c9..b4b3bb97 100755 --- a/bin/elm-app-cli.js +++ b/bin/elm-app-cli.js @@ -46,8 +46,10 @@ switch (script) { } }); - args = args.concat(['--compiler', elmExecutable]); - + args = args.concat([ + '--compiler', + path.join(path.dirname(require.resolve('elm')), '/unpacked_bin/elm') + ]); const cp = spawn.sync(require.resolve('elm-test/bin/elm-test'), args, { stdio: 'inherit' }); diff --git a/package.json b/package.json index 3f9660f8..a4261967 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "dotenv": "^5.0.0", "elm": "0.19.0-bugfix6", "elm-hot-webpack-loader": "^1.0.2", - "elm-test": "^0.19.0-rev3", + "elm-test": "^0.19.0-rev5", "elm-webpack-loader": "^5.0.0", "file-loader": "^1.1.6", "fs-extra": "^6.0.1", @@ -65,6 +65,7 @@ "@commitlint/config-conventional": "^7.5.0", "babel-eslint": "^8.2.1", "commitizen": "^3.0.5", + "cross-env": "^5.2.0", "cz-conventional-changelog": "^2.1.0", "dir-compare": "^1.4.0", "eslint": "^4.18.0", @@ -76,6 +77,7 @@ "prettier": "^1.10.2", "rimraf": "^2.6.2", "semantic-release": "15.12.4", + "shelljs": "^0.8.3", "unexpected": "^10.37.2" }, "engines": { @@ -111,7 +113,7 @@ "semantic-release": "semantic-release", "test": "npm run test:cli && npm run test:functional", "test:cli": "mocha tests/cliAccessibility.js --reporter spec --timeout 15000", - "test:functional": "UNEXPECTED_FULL_TRACE=true mocha tests/*.spec.js --reporter spec --timeout 15000", + "test:functional": "cross-env UNEXPECTED_FULL_TRACE=true mocha tests/*.spec.js --reporter spec --timeout 15000", "app:build": "cd template && node ../bin/elm-app-cli.js build", "app:start": "cd template && node ../bin/elm-app-cli.js start", "app:test": "cd template && node ../bin/elm-app-cli.js test" diff --git a/tests/elm-app.test.spec.js b/tests/elm-app.test.spec.js index f203e544..c5d13e31 100644 --- a/tests/elm-app.test.spec.js +++ b/tests/elm-app.test.spec.js @@ -3,7 +3,7 @@ const spawn = require('cross-spawn'); const rimraf = require('rimraf'); const expect = require('unexpected'); -const testAppName = 'test-app'; +const testAppName = 'test-app-eject'; const rootDir = path.resolve(__dirname, '..'); const testAppDir = path.join(rootDir, testAppName); const createElmAppCmd = path.join(rootDir, 'bin/create-elm-app-cli.js'); @@ -11,10 +11,14 @@ const elmAppCmd = path.join(rootDir, 'bin/elm-app-cli.js'); describe('Testing Elm application with `elm-app test` (Please wait...)', () => { before(done => { - const { status } = spawn.sync('node', [createElmAppCmd, testAppName]); + const { status, stderr } = spawn.sync('node', [ + createElmAppCmd, + testAppName + ]); if (status === 0) { done(); } else { + console.log(stderr.toString()); done(false); } }); @@ -31,8 +35,8 @@ describe('Testing Elm application with `elm-app test` (Please wait...)', () => { .map(out => (out !== null ? out.toString() : '')) .join(''); - expect(status, 'to be', 2); expect(outputString, 'to contain', 'This test should fail'); expect(outputString, 'to contain', 'failed as expected!'); + expect(status, 'to be', 2); }).timeout(2 * 60 * 1000); });