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

[test] Enhance testcases to be run on windows #1320

Merged
merged 9 commits into from
May 22, 2018
Merged

Conversation

ChrisAlderson
Copy link
Member

I had a few issues when running the test cases on Windows.

  • [test] Windows systems do not have gid or uid
  • [test] Adjust assumption of filesize for Windows eol
  • [test-refactor] Use rimraf to remove test fixtures on all systems

The rest of the commits were for adding AppVeyor CI. If we don't want AppVeyor to test against Windows I can create a new PR.

@DABH
Copy link
Contributor

DABH commented May 22, 2018

Awesome! I gave this a shot on Windows and am seeing one of the tests failing

  1) Logger, ExceptionHandler Custom exitOnError function does not exit:
     Uncaught Unknown assertation failure occured, assumed `[]` to deeply equal `[ 'Ignore this error' ]`
  C:\winston\test\log-exception.test.js
                                    v
      66.       assume(child.killed).false();
      67.       assume(stdout).deep.equals(['Ignore this error']);
      68.       child.kill();

but this seems likely unrelated to your change. Are you also seeing this test fail?

@ChrisAlderson
Copy link
Member Author

Sometimes I do, I'm unsure where this error comes from because when I run the tests a second time the error is gone. This is also why I added the appveyor.yml configuration.


test_script:
- .\node_modules\.bin\tsc --version
- .\node_modules\.bin\tsc -p test
Copy link
Member

Choose a reason for hiding this comment

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

iirc npx is cross-platform. Either approach is 🆗with me.

Copy link
Member Author

@ChrisAlderson ChrisAlderson May 22, 2018

Choose a reason for hiding this comment

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

Could be, but npx was introduced with [email protected] so this won't work with node@6.

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes the "fun" of test matricies ^_^ ... technically we could do npm i -g [email protected], but it's a lot of time to add to each test run for little-to-no gain. Carry on 👍 🙏

assume(stats.size).equals(4096);
// Either 4096 on Unix or 4100 on Windows
// because of the eol.
assume(stats.size).either([4096, 4100]);
Copy link
Member

Choose a reason for hiding this comment

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

Can we get the value based on the platform then assert it? If we get 4096 on Windows it's a bug and if we get 4100 on *nix it's a bug. e.g.:

// Either 4096 on Unix or 4100 on Windows because of the eol
const expected = process.platform === 'win32' ? 4100 : 4096;
assume(stats.size).equals(expected);

Copy link
Member

@indexzero indexzero left a comment

Choose a reason for hiding this comment

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

Would like to see the stat change suggested implemented before merge, but once that's done you have my 👍

... thanks for taking the time to add this @ChrisAlderson!

@ChrisAlderson
Copy link
Member Author

Added the change you suggested @indexzero, also merged with master to fix the testcases in #1318.

@ChrisAlderson
Copy link
Member Author

@DABH Think the error from log-exception was introduced by me in #1286, because of the handleExceptions and unhandleExceptions methods not being refactored correctly.

I'll open another PR to solve this issue.

@indexzero indexzero merged commit 0d62001 into master May 22, 2018
@indexzero indexzero deleted the test/windows branch May 22, 2018 22:04
Mizumaki pushed a commit to Mizumaki/winston that referenced this pull request Jun 11, 2020
* [test] Windows systems do not have gid or uid

* [test] Adjust assumtion of filesize for Windows eol

* [test-refactor] Use rimraf to remove test fixtures on all systems

* [dist] Add appveyor config to test against Windows

* [dist] Disable build section for appveyor

* [dist fix] Use tsc in node_modules

* [test] Assume size based on platform, requested by @indexzero

* [test] close logger to remove log-file on windows
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.

3 participants