Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Switch to npm scripts #405

Merged
merged 3 commits into from
Nov 22, 2017
Merged

Switch to npm scripts #405

merged 3 commits into from
Nov 22, 2017

Conversation

XhmikosR
Copy link
Member

@XhmikosR XhmikosR commented Aug 9, 2017

This is far from ready.

TODO:

  • Test script on CI should run all + coverage
  • Fix nodeunit
  • Fix ESLint on Travis (glob related?)
  • Update docs
  • Fix qunit
  • Make sure coverage works

Fixes #403, fixes #404.

/CC @bardiharborow @Johann-S for any help

@XhmikosR XhmikosR force-pushed the npm-scripts branch 4 times, most recently from cf4e109 to b3d0852 Compare August 10, 2017 20:20
@XhmikosR
Copy link
Member Author

So, nodeunit fails for me silently on Windows when running the cli_test.js

C:\Users\xmr\Desktop\bootlint>npm run nodeunit --verbose
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'run',
npm verb cli   'nodeunit',
npm verb cli   '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb run-script [ 'prenodeunit', 'nodeunit', 'postnodeunit' ]
npm info lifecycle [email protected]~prenodeunit: [email protected]
npm info lifecycle [email protected]~nodeunit: [email protected]

> [email protected] nodeunit C:\Users\xmr\Desktop\bootlint
> nodeunit test


bootlint_test
√ bootlint - HTML5 DOCTYPE
√ bootlint - disabling lint checks
√ bootlint - UTF-8 charset meta tag
√ bootlint - X-UA-Compatible
√ bootlint - Bootstrap v2
√ bootlint - rows outside containers
√ bootlint - nested containers
√ bootlint - viewport meta tag
√ bootlint - row and column classes on same element
√ bootlint - row and container classes on same element
√ bootlint - remote modals
√ bootlint - jQuery
√ bootlint - bootstrap[.min].js
√ bootlint - input groups with impermissible kind of form control
√ bootlint - tooltips and popovers on disabled elements
√ bootlint - tooltips and popovers within button groups should have their container set to body
√ bootlint - btn/input sizing used without input-group-* size
√ bootlint - input groups with multiple form controls
√ bootlint - mixing input groups with form groups
√ bootlint - mixing input groups with grid columns
√ bootlint - input groups missing controls and addons
√ bootlint - non-column children of rows
√ bootlint - multiple columns on the same side of an input group
√ bootlint - dropdown-toggle comes before btn
√ bootlint - buttons should set type
√ bootlint - use disabled attribute on button.btn and input.btn instead of .disabled
√ bootlint - inputs should set type
√ bootlint - incorrect markup for .checkbox, .radio, .checkbox-inline, and .radio-inline classes
√ bootlint - .active class and checked attribute for buttons plugin do not match
√ bootlint - modals within other components
√ bootlint - panel structure
√ bootlint - columns outside of rows and form groups
√ bootlint - .table-responsive on the table itself
√ bootlint - redundant grid column classes
√ bootlint - empty spacer grid columns
√ bootlint - .form-control-feedback without a .has-feedback ancestor
√ bootlint - Glyphicons on non-empty elements
√ bootlint - Glyphicons missing the .glyphicon class
√ bootlint - modal structure
√ bootlint - form classes used directly on form groups
√ bootlint - incorrect alerts with dismiss/close buttons
√ bootlint - pull classes inside media
√ bootlint - invalid nonexistent .col-*-0 classes
√ bootlint - outdated version of Bootstrap
√ bootlint - version 4 of Bootstrap
√ bootlint - carousel control target
√ bootlint - media pulls outside of media objects
√ bootlint - navbar pulls outside of navbars
√ bootlint - modal with .hide class
√ bootlint - carousel structure
√ bootlint - container inside navbar
√ bootlint - .form-control on wrong element or input type
√ bootlint - .img-responsive not on image
√ bootlint - btn classes on anchors within .navbar-nav
√ bootlint - modal missing tabindex
√ bootlint - .btn not on <a>/<button>/<input>/<label>
√ bootlint - modal missing role dialog
√ bootlint - modal-dialog missing role document
√ bootlint - nested form groups

cli_test
npm verb lifecycle [email protected]~nodeunit: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~nodeunit: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\xmr\Desktop\bootlint\node_modules\.bin;C:\Ruby24-x64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\curl\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\TortoiseSVN\bin;C:\Users\xmr\AppData\Roaming\npm
npm verb lifecycle [email protected]~nodeunit: CWD: C:\Users\xmr\Desktop\bootlint
npm info lifecycle [email protected]~postnodeunit: [email protected]
npm verb exit [ 0, true ]
npm info ok

@hnrch02 @kkirsche: any ideas?

@XhmikosR XhmikosR mentioned this pull request Aug 11, 2017
@tclindner
Copy link
Contributor

Hi @XhmikosR I spent some time looking at this issue. I have a couple of thoughts that might be helpful.

  1. I think this is failing quietly because the console.log stub is not getting restored. This can be resolved by adding the following code to the rAfter function.
if (console.log.restore) {
  console.log.restore();
}
  1. After I added that I saw in the output that 0 assertions appeared to be getting run. I added test.expect(2) to the top of the Disable tags test. When I reran nodeunit it failed 1/1 assertions saying, Expected 2 assertions, 0 ran. I'm not sure why the callsFake assertions aren't running. I tried reverting to an older version of sinon, but that didn't seem to help.

I'll let you know if I come up with anything else.

@XhmikosR
Copy link
Member Author

Thanks @tclindner! I already committed your solution for the silent failure. Let me know if you make any more progress on this or phantom tests.

@tclindner
Copy link
Contributor

tclindner commented Aug 11, 2017

Hi @XhmikosR I think I might be on to something. It looks like callsFake doesn't take arguments. The CLI is also not running synchronously. The assertions pass for me if I modify the code to look like this:

'Disable tags': function (test) {
    test.expect(2);
 
    var stub = sinon.stub(console, 'log');
 
    cli.__set__('process', {
    argv: [''],
    stdin: {
      isTTY: process.stdin.isTTY
    }
  });
 
  cli();
 
  setTimeout(function() {
    test.strictEqual(stub.getCall(0).args[0], '');
    test.strictEqual(stub.getCall(1).args[0], '0 lint error(s) found across 0 file(s).');
    test.done();
  }, 500);
}

Let me know what you think! 😄

@XhmikosR
Copy link
Member Author

I have no idea about this at all... Can you do git fetch upstream && git reset --hard upstream/npm-scripts then rm -rf ./node_modules && npm i?

I updated the deps and it fixed an issue with nyc we were getting before.

@tclindner
Copy link
Contributor

I need to run. I will try that out later and report back!

@XhmikosR XhmikosR force-pushed the npm-scripts branch 2 times, most recently from f9b22ad to 861bc85 Compare August 12, 2017 07:11
@tclindner
Copy link
Contributor

Hey @XhmikosR - I did the steps you outlined above. Nodeunit runs successfully, but neither of the two cli assertions are executing. I verified this by running each of the *_test.js files separately. The sum of successful assertions is 199 with and without cli_test.js running. If I update the format to use setTimeout, nodeunit tells me that 201 assertions have passed. Would you be open to altering the cli test file?

@tclindner
Copy link
Contributor

Hey @Herst did you end up going down the route of adding setTimeout? I think that is the way to go.

@Herst
Copy link
Collaborator

Herst commented Sep 9, 2017

@tclindner Seeing how the tooling stuff is work-in-progress I didn't touch it at all.

@Johann-S
Copy link
Member

Johann-S commented Nov 20, 2017

Good catch for the engine @XhmikosR 👍

EDIT :
it seems node-qunit-phantomjs do not allow wildcard 🤔

@XhmikosR
Copy link
Member Author

Yeah, I made an issue.

Do you know of any alternative?

@Johann-S
Copy link
Member

karma could be an alternative to that issue

@XhmikosR
Copy link
Member Author

If you could make that change, then only covergae would be left :)

@Johann-S
Copy link
Member

Hmm seems more complex than I thought 😟 I think we should made a NodeJS script which use node-qunit-phantomjs to run each of our .html files

@XhmikosR
Copy link
Member Author

@Johann-S: sounds good, please make a patch :)

@XhmikosR XhmikosR force-pushed the npm-scripts branch 5 times, most recently from 6715f6c to 97c71ed Compare November 20, 2017 16:25
@XhmikosR XhmikosR requested review from cvrebert, bardiharborow and Johann-S and removed request for cvrebert November 20, 2017 20:29
@twbs twbs deleted a comment from coveralls Nov 20, 2017
@twbs twbs deleted a comment from coveralls Nov 20, 2017
@twbs twbs deleted a comment from coveralls Nov 20, 2017
@twbs twbs deleted a comment from coveralls Nov 20, 2017
@XhmikosR XhmikosR force-pushed the npm-scripts branch 2 times, most recently from ed12614 to e6e5b71 Compare November 20, 2017 21:34
@twbs twbs deleted a comment from coveralls Nov 20, 2017
@twbs twbs deleted a comment from coveralls Nov 21, 2017
@twbs twbs deleted a comment from coveralls Nov 21, 2017
@twbs twbs deleted a comment from coveralls Nov 21, 2017
@twbs twbs deleted a comment from coveralls Nov 21, 2017
@twbs twbs deleted a comment from coveralls Nov 21, 2017
@twbs twbs deleted a comment from coveralls Nov 22, 2017
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 25c14e0 on npm-scripts into ** on master**.

@XhmikosR XhmikosR merged commit f62a1fb into master Nov 22, 2017
@XhmikosR XhmikosR deleted the npm-scripts branch November 22, 2017 11:35
@twbs twbs deleted a comment from coveralls Nov 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix coverage Switch to npm scripts
5 participants