Skip to content

Commit dca8ec9

Browse files
committed
Merge pull request #62 from NogsMPLS/passTestsOnWindows
Pass tests on Windows
2 parents 9042c91 + 8b971db commit dca8ec9

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

bin/__tests__/react-docgen-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ jasmine.getEnv().defaultTimeoutInterval = 10000;
1515

1616
jest.autoMockOff();
1717

18-
var child_process = require('child_process'); // eslint-disable-line camelcase
1918
var fs = require('fs');
2019
var path = require('path');
2120
var rimraf = require('rimraf');
2221
var temp = require('temp');
22+
var spawn = require('cross-spawn-async');
2323

2424
function run(args, stdin) {
2525
return new Promise(resolve => {
26-
var docgen = child_process.spawn( // eslint-disable-line camelcase
26+
var docgen = spawn( // eslint-disable-line camelcase
2727
path.join(__dirname, '../react-docgen.js'),
2828
args
2929
);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"babel-jest": "^5.3.0",
3737
"jest-cli": "^0.8.0",
3838
"rimraf": "^2.3.2",
39-
"temp": "^0.8.1"
39+
"temp": "^0.8.1",
40+
"cross-spawn-async": "^2.1.9"
4041
},
4142
"jest": {
4243
"preprocessCachingDisabled": true,

src/handlers/__tests__/propDocblockHandler-test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
/*global jest, describe, beforeEach, it, expect*/
1212

13+
var os = require('os');
14+
var EOL = os.EOL;
15+
1316
jest.autoMockOff();
1417
jest.mock('../../Documentation');
1518

@@ -67,7 +70,7 @@ describe('propDocBlockHandler', () => {
6770
expect(documentation.descriptors).toEqual({
6871
foo: {
6972
description:
70-
'Foo comment with\nmany lines!\n\neven with empty lines in between',
73+
'Foo comment with'+EOL+'many lines!'+EOL+'\neven with empty lines in between',
7174
},
7275
});
7376
});

src/utils/__tests__/docblock-test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*/
1010

1111
/*global jest, describe, beforeEach, it, expect*/
12+
var os = require('os');
13+
var EOL = os.EOL;
1214

1315
jest
1416
.dontMock('../docblock');
@@ -57,8 +59,8 @@ describe('docblock', () => {
5759
});
5860

5961
it('gets the closest docblock of the given node', () => {
60-
let node = statement(source.join('\n'));
61-
expect(getDocblock(node)).toEqual(comment.join('\n'));
62+
let node = statement(source.join(EOL));
63+
expect(getDocblock(node)).toEqual(comment.join(EOL));
6264
});
6365

6466
let terminators = [
@@ -71,7 +73,7 @@ describe('docblock', () => {
7173
terminators.forEach(t => {
7274
it('can handle ' + escape(t) + ' as line terminator', () => {
7375
let node = statement(source.join(t));
74-
expect(getDocblock(node)).toEqual(comment.join('\n'));
76+
expect(getDocblock(node)).toEqual(comment.join(EOL));
7577
});
7678
});
7779

@@ -80,7 +82,7 @@ describe('docblock', () => {
8082
'/** bar */',
8183
'foo;',
8284
];
83-
let node = statement(source.join('\n'));
85+
let node = statement(source.join(EOL));
8486
expect(getDocblock(node)).toEqual('bar');
8587
});
8688
});

0 commit comments

Comments
 (0)