Skip to content

Commit 427f9f7

Browse files
zertoshphated
authored andcommitted
New: Add test and note for jsx support (closes #1)
1 parent aaa18e5 commit 427f9f7

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This module can find, require and register any file type the npm ecosystem has a
99

1010
**Currently supported extensions:**
1111

12-
`.co, .coffee, .csv, .iced, .ini, .js, .json, .litcoffee, .ls, .toml, .xml, .yaml, .yml`
12+
`.co, .coffee, .csv, .iced, .ini, .js, .json, .jsx, .litcoffee, .ls, .toml, .xml, .yaml, .yml`
1313

1414
**Note:** If you'd like to add a new extension, please make a PR for [interpret](https://github.com/tkellen/node-interpret).
1515

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,18 @@
3232
"interpret": "^0.3.0"
3333
},
3434
"devDependencies": {
35-
"mocha": "^1.17.1",
35+
"LiveScript": "^1.2.0",
3636
"chai": "^1.9.0",
3737
"coco": "^0.9.1",
3838
"coffee-script": "^1.7.1",
39-
"require-csv": "0.0.1",
4039
"iced-coffee-script": "^1.7.1-b",
40+
"mocha": "^1.17.1",
41+
"node-jsx": "^0.10.0",
42+
"require-csv": "0.0.1",
4143
"require-ini": "0.0.1",
42-
"toml-require": "^1.0.1",
4344
"require-xml": "0.0.1",
4445
"require-yaml": "0.0.1",
45-
"LiveScript": "^1.2.0"
46+
"toml-require": "^1.0.1"
4647
},
4748
"keywords": [
4849
"require",

test/fixtures/test.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** @jsx React.DOM */
2+
3+
// Test harmony arrow functions
4+
Component = () => {
5+
var trueKey = true;
6+
var falseKey = false;
7+
var subKey = { subProp: 1 };
8+
// Test harmony object short notation
9+
return { data: { trueKey, falseKey, subKey}};
10+
};
11+
12+
// Test JSX syntax
13+
module.exports = <Component />;

test/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ describe('registerFor', function () {
4646
rechoir.registerFor('./test/fixtures/test.json');
4747
expect(require('./fixtures/test.json')).to.deep.equal(expected);
4848
});
49+
it('should know jsx', function () {
50+
rechoir.registerFor('./test/fixtures/test.jsx');
51+
expect(require('./fixtures/test.jsx')).to.deep.equal(expected);
52+
});
4953
it('should know livescript', function () {
5054
rechoir.registerFor('./test/fixtures/test.ls');
5155
expect(require('./fixtures/test.ls')).to.deep.equal(expected);
@@ -70,7 +74,7 @@ describe('registerFor', function () {
7074

7175
describe('load', function () {
7276
it('should automatically register a loader and require', function () {
73-
delete require.extensions['.coffee']
77+
delete require.extensions['.coffee'];
7478
expect(rechoir.load('./test/fixtures/test.json')).to.deep.equal(expected);
7579
});
7680
});

0 commit comments

Comments
 (0)