-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Support test suite on Windows #2270
Conversation
a08d768
to
bc3ec87
Compare
}) | ||
}) | ||
|
||
describe('when the file does not exist', function(){ | ||
it('should fail', function(done){ | ||
// uncomment | ||
// fs.readFile('/tmp/does-not-exist', done); | ||
// fs.readFile(t('does-not-exist'), done); | ||
done(); | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: go through the test suites and find things like this that are failure-tests but either commented out or otherwise unusually handled and if possible change them to assert that the failure throws or passes an error to a callback or whatever the expectable failure mode is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES ^
Edit: I've pointed this out every now and then. Tests that we have to manually check / uncomment => please no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this into its own issue, since it's nothing to do with this PR: #2309
.have | ||
.length(2); | ||
.length(1 + (+symlinkSupported)); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the expected length, I'd rather see something like:
// at start of test
var expectedLength = 0;
//...after the .contain(t('mocha-utils.js'));
expectedLength += 1;
//...after the .contain(t('mocha-utils-link.js'));
expectedLength += 1;
//...instead of .length(1 + (+symlinkSupported));
.length(expectedLength);
This is, in my opinion, clearer than using the unary +
to cast the symlinkSupported
bool to the integer 1, and more flexible in the event this test were ever to be changed such that there would be more than one additional file added if symlinkSupported
. Although a simpler alternative that requires manual counting (instead of adding a += 1
line to everywhere the count should increase) would be to just change .length(1 + (+symlinkSupported));
to .length(1 + (symlinkSupported ? 1 : 0));
or .length(symlinkSupported ? 2 : 1);
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In agreement.
Other than that, looks good to me. |
@TimothyGu Thanks again so much for this! |
Based on work by Tyler Waters <tyler.waters@gmail.com> in mochajs#1814. This commit contains the following changes: - Add quotation marks to Makefile variables for programs. The variables use POSIX-style paths, which cannot be used on Windows to launch a program except when quoted. Using double quotation marks instead of single since the latter is not available on Windows - Use os-tmpdir module to get an acceptable directory for temporary usage instead of relying on the POSIX /tmp - Use process.execPath as an authoritative path for Node.js executable - Detect whether symbolic links are supported on the platform before testing. On Windows, creating symlinks can fail since it needs additional user permissions - Fix hook tests. The tests parse output of the "dot" reporter to separate output of individual tests. The "dot" reporter uses "·" symbol (U+2024 ONE DOT LEADER) under POSIX environments and "." symbol (U+002E FULL STOP) under Windows, which means that having "." in the echoed message makes it ambiguous to be parsed in Windows. To fix this issue, two separate changes are necessary: - Use a dynamically created regular expression to split the tests based on the specific dot character used on the platform - Replace "." with "-" in echoed messages in fixtures for hook tests to avoid ambiguity with the character output by the reporter Changes from mochajs#1814 include: - Rebasing - Use process.execPath as an authoritative path for Node.js executable - Avoid external dependencies for child_process.spawn() - Detect whether symbol links are supported on the platform before testing. On Windows, creating symlinks can fail since it needs additional user permissions Fixes mochajs#1813.
@ScottFreeCode, all comments have been fixed in the latest iteration of the patch. |
fires up virtualbox |
This is crazy. Awesome catch |
@TimothyGu This is really close, but something is killing IE8 tests--unless that's brokenness on SauceLabs' end. The browser won't "capture". Trying to find out more. Related, I'm getting this setup on AppVeyor. |
@boneskull, is there a publicly available link to look at Sauce Labs output? Either way, that sounds like a Sauce Labs problem... |
@TimothyGu I think this is public Anyway, I reported an issue to SauceLabs, hoping they can point me in the right direction. I don't know how to debug this myself--do you? |
Nope; in fact, I am totally at a loss here on how to interpret the Sauce Labs reports. Unfortunately I don't think I own a computer with IE8 either. |
I was able to get Karma's tests to trigger IE8 compatibility mode on IE11 by adding a meta tag to Karma's HTML files. Let's see, I think it was... |
I haven't tried to run it with SauceLabs yet, but preliminary check that it runs on Windows yielded just a couple other bumps:
|
going to close this PR to send a different one. @TimothyGu 's changes are in it |
:sigh: Technically, no, since
Hmm, I didn't meet this error. It's entirely possible that the Git configuration has something to do with this. I set Git's We can force Git to store those files with UNIX line endings on all systems using a |
👍 for |
@TimothyGu at any rate, I think the proof's in the pudding |
Ah, I see. I guess I probably set Looks as though the makefile being run on AppVeyor has some difficulties we don't run into using it in Cygwin-type shells, such as "find" being the unrelated Windows tool. (Also, it's getting a printout of ESLint's help options right after that, so I'm not sure what's going wrong there.) I wonder if we could configure it to run in something like Cygwin until we can replace the makefile with something more cross-platform. |
Appveyor has Cygwin and we can use its tools but I don't know if actually
|
I encountered the find.exe problem too. The only clean way to fix it is to make the MinGW or Cygwin bin path first in the env var, which the AppVeyor PR already does. |
Based on work by Tyler Waters tyler.waters@gmail.com in #1814.
This commit contains the following changes:
use POSIX-style paths, which cannot be used on Windows to launch a
program except when quoted. Using double quotation marks instead of
single since the latter is not available on Windows
usage instead of relying on the POSIX /tmp
testing. On Windows, creating symlinks can fail since it needs
additional user permissions
separate output of individual tests. The "dot" reporter uses "·"
symbol (U+2024 ONE DOT LEADER) under POSIX environments and "." symbol
(U+002E FULL STOP) under Windows, which means that having "." in the
echoed message makes it ambiguous to be parsed in Windows. To fix this
issue, two separate changes are necessary:
based on the specific dot character used on the platform
to avoid ambiguity with the character output by the reporter
Changes from #1814 include:
testing. On Windows, creating symlinks can fail since it needs
additional user permissions
Fixes #1813.