spatialillusions / milsymbol

Military Symbols in JavaScript
www.spatialillusions.com/milsymbol
MIT License
544 stars 133 forks source link

Add option to remove attribution - specifically for test runs #199

Closed dougajmcdonald closed 6 years ago

dougajmcdonald commented 6 years ago

We would like the option to remove the attribution from our test runs.

At the moment our tests output hundreds of console.log messages which can cause problems with CI which is not expecting any output.

E.g.

PASS test/components/MapLayerDropdownItem.test.js ● Console

console.info node_modules/milsymbol/dist/milsymbol.js:32
  milsymbol.js 1.3.3 - Copyright (c) 2017 Måns Beckman  http://www.spatialillusions.com

I understand you want to keep attribution in, but in testing it's actively a problem.

I can edit the build src, but that feels wrong and means repeating the process as and when we update the package.

spatialillusions commented 6 years ago

I added a check if the process object https://nodejs.org/api/process.html#process_process exists, and if it does I don't log the message. This should make it log in the webbrowser but not inte node.

dougajmcdonald commented 5 years ago

Ah brilliant, we are on an old version (0.6.0), I'll try to get this updated today, thanks for the response.

I had a dig through the source, but the check doesn't seem to be working for me, even with the console & process values set correctly:

 PASS  test/components/NewUnitForm.test.js
  ● Console

    console.info node_modules/milsymbol/dist/milsymbol.js:27
      milsymbol.js 2.0.0 - Copyright (c) 2017 Måns Beckman  http://www.spatialillusions.com
    console.log test/components/NewUnitForm.test.js:52
      typeof process: object
    console.log test/components/NewUnitForm.test.js:53
      typeof process !== "object": false
    console.log test/components/NewUnitForm.test.js:54
      typeof console === "object": false
    console.log test/components/NewUnitForm.test.js:55
      typeof console === "object" && typeof process !== "object": false