From 667d27604f4f8b2d19081ce1413e08d2b23eec1d Mon Sep 17 00:00:00 2001 From: Michael Stock Date: Wed, 18 Sep 2019 10:43:32 -0700 Subject: [PATCH] Support test files that are not in tests/ Some projects prefer to put tests files alongside the source. We can identify these files by checking that they end with "Test.elm". --- lib/elm-make-runner.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/elm-make-runner.js b/lib/elm-make-runner.js index a20f8e0..6ff21a9 100644 --- a/lib/elm-make-runner.js +++ b/lib/elm-make-runner.js @@ -136,9 +136,7 @@ export default class ElmMakeRunner { atom.config.get('elmjutsu.alwaysCompileMain') === true; const isTestFilePath = - editorFilePath.startsWith( - path.resolve(projectDirectory, 'tests') + path.sep - ) || isInsideTestDirectory; + editorFilePath.endsWith('Test.elm') || isInsideTestDirectory; let filePathsToCompile = []; if (alwaysCompileMain) { @@ -167,16 +165,15 @@ export default class ElmMakeRunner { } } } else { - if (isTestFilePath && process.platform === 'win32') { - // Workaround for https://github.com/halohalospecial/atom-elmjutsu/issues/131#issuecomment-429445645 - const relativeEditorFilePath = path.relative( - projectDirectory, - editorFilePath - ); - filePathsToCompile = [relativeEditorFilePath]; - } else { - filePathsToCompile = [editorFilePath]; - } + filePathsToCompile = [editorFilePath]; + } + + if (isTestFilePath) { + const relativeEditorFilePath = path.relative( + projectDirectory, + editorFilePath + ); + filePathsToCompile = [relativeEditorFilePath]; } let args = [