ccampbell / luna-testing

Simple, modern, opinionated JavaScript unit testing
https://craig.is/testing/code
MIT License
151 stars 6 forks source link

not work on windows #3

Closed zsytssk closed 6 years ago

zsytssk commented 6 years ago

image

ccampbell commented 6 years ago

Thanks for the report! It looks like the path replacement to find the test file is not working correctly for some reason. I have an idea of what might be the issue, but I am not sure it will fix it.

I can publish a new version with the fix or you can try making the change directly in node_modules/luna/bin/luna.js to see if it fixes your problem:

diff --git a/bin/luna.js b/bin/luna.js
index 592f6c4..89f5556 100755
--- a/bin/luna.js
+++ b/bin/luna.js
@@ -282,7 +282,7 @@ async function getBundle(filePath, options) {
         try {
             const plugins = [
                 replace({
-                    TEST_FILE_PATH: `${process.cwd()}/${filePath}`,
+                    TEST_FILE_PATH: path.join(process.cwd(), filePath),
                     TEST_TIMEOUT: options.timeout
                 }),
                 buble({