Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting env var assignments on Windows #316

Merged
merged 8 commits into from
Jul 3, 2016

Conversation

joshuazmiller
Copy link
Contributor

@joshuazmiller joshuazmiller commented Jun 29, 2016

Trying to resolve #313

@joshuazmiller
Copy link
Contributor Author

Can we ignore the failed coverage test? You can't write coverage to the best of my knowledge.

"release:major": "ta-script npm/release.sh major",
"release:minor": "ta-script npm/release.sh minor",
"release:patch": "ta-script npm/release.sh patch",
"start": "npm run docs",
"start:local-modules": "npm run docs -- --local-modules",
"pretest": "gulp dll",
"test": "NODE_ENV=test babel-node $(npm bin)/karma start build/karma.conf.babel.js",
"test": "cross-env NODE_ENV=test babel-node node_modules/karma start build/karma.conf.babel.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be node_modules/.bin/karma.

Details:
When you npm install packages that come with executables, they are placed in node_modules/.bin. You can get the absolute path to the npm bin with the command npm bin. NPM also adds this directory to your $PATH when you npm run ... scripts. This way you can execute scripts that you have installed. The $(npm bin) syntax is command substitution. It places the output of that command inline in another command. So, we were placing the absolute path to the npm bin directory just before /karma.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for explaining that to me. I learned something new!

@levithomason
Copy link
Member

Thanks for the PR. Please reference the related issue in the description in order to close the issue when the PR is merged.

Coverage will not fail for this PR. Coverage is calculated by lines of code covered by tests. Since this PR touches no code, the coverage will not be affected. CircleCI seems to have blown up for some random reason. It should run on the next commit.

@levithomason
Copy link
Member

@joshuazmiller it looks like tests are failing because they are never running in the first place. Pretty sure this is due to the karma path issue I noted here https://github.com/TechnologyAdvice/stardust/pull/316#discussion_r68971089

@codecov-io
Copy link

codecov-io commented Jun 30, 2016

Current coverage is 88.30%

Merging #316 into master will not change coverage

@@             master       #316   diff @@
==========================================
  Files            62         62          
  Lines           821        821          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits            725        725          
  Misses           96         96          
  Partials          0          0          

Powered by Codecov. Last updated by 8cad5a9...731d91d

@joshuazmiller
Copy link
Contributor Author

It doesn't seem I have permission to manually close #313 , however I added it to my description and perhaps it will work now. I'll keep in mind to mark those in for future pull-requests.

When I run test with the .bin I get the following error:

C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules.bin\karma:2
basedir=$(dirname "$(echo "$0" | sed -e 's,,/,g')")
^^^^^^^

SyntaxError: missing ) after argument list
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Module._extensions..js (module.js:416:10)
at Object.require.extensions.(anonymous function) as .js
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\babel-cli\lib_babel-node.js:160:24
at Object. (C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\babel-cli\lib_babel-node.js:161:7)
at Module._compile (module.js:409:26)

I haven't written bash scripts in years, and I pretty much can't make sense of the file to understand what's wrong.

@levithomason
Copy link
Member

Ah, yes. The karma script that is running is not compatible with Windows. You would likely need to run the "karma.cmd" version instead.

We can't hard code the test script to that or it won't work on Unix machines. We'll need to figure out how to support Windows here.

Any help appreciated as I so not have a Windows machine available. I will do some digging on this though.

@levithomason
Copy link
Member

It doesn't seem I have permission to manually close #313

Indeed, even if you did have permissions the best practice is to leave the issue open until the fix is merged. The description you have in this PR should take care of it!

@levithomason
Copy link
Member

@joshuazmiller I just merged #320 which removes babel-node entirely. This means we no longer need any special paths to karma on the test script. I am hoping by running karma directly like this that npm runs the correct version for Windows and also for Unix.

Please update this PR with the latest master and set the test script to:

"test": "cross-env NODE_ENV=test karma start build/karma.conf.babel.js",

Let's see if tests then pass, and also if it runs locally for you.

@joshuazmiller
Copy link
Contributor Author

Unfortunately, I still get errors after the merge and adding that line:

cross-env NODE_ENV=test karma start build/karma.conf.babel.js

30 06 2016 21:55:48.509:ERROR [config]: Invalid config file!
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.parseConfig (C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\karma\lib\config.js:284:22)
at new Server (C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\karma\lib\server.js:57:20)
at Object.exports.run (C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\karma\lib\cli.js:243:7)
at requireCliAndRun (C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\karma-cli\bin\karma:44:16)
at C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\karma-cli\bin\karma:54:12
at C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\resolve\lib\async.js:44:21
at ondir (C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\resolve\lib\async.js:187:31)
at C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\resolve\lib\async.js:153:39
at onex (C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\resolve\lib\async.js:93:22)
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\Joshua\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "test"
npm ERR! node v4.4.7
npm ERR! npm v3.10.2
npm ERR! code ELIFECYCLE
npm ERR! stardust@0.16.4 test: cross-env NODE_ENV=test karma start build/karma.conf.babel.js
npm ERR! Exit status 1

@levithomason
Copy link
Member

levithomason commented Jul 1, 2016

I see in your error output you are running:

npm ERR! node v4.4.7
npm ERR! npm v3.10.2

This project requires Node 6. I just added a note about this in the contributing guide last night.

Please install Node 6 and give it another go. Thanks for hanging in there through all this! I think we're close to a solution.

@levithomason
Copy link
Member

@joshuazmiller did updating Node help at all?

@joshuazmiller
Copy link
Contributor Author

It works now! Thanks!

@levithomason
Copy link
Member

Awesome! 😸 Very glad we finally got it.

Just one last tweak and we can merge this PR. It looks like the package description got set wrong (probably after a conflict fix). It should be:

"description": "The official Semantic-UI-React integration."

Once that is updated, we can get this PR in. Thank you very much for hanging in there.

@joshuazmiller
Copy link
Contributor Author

This should do it. Thank you. I am going to get back to the List Item and Item API as soon as I can

@levithomason levithomason merged commit 54eb236 into Semantic-Org:master Jul 3, 2016
jhchill666 pushed a commit to jhchill666/stardust that referenced this pull request Jul 5, 2016
* Supporting env var assignments on Windows

* fix: change package.json to have cross-env

* fix: correct the description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Windows env var assignments
3 participants