Skip to content

Commit

Permalink
Added ".jsx" test and to README
Browse files Browse the repository at this point in the history
Closes gh-1.
  • Loading branch information
zertosh authored and Tyler Kellen committed Jul 3, 2014
1 parent e0559f3 commit 3fe1ead
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This module can find, require and register any file type the npm ecosystem has a

**Currently supported extensions:**

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

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

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@
"interpret": "^0.3.0"
},
"devDependencies": {
"mocha": "^1.17.1",
"LiveScript": "^1.2.0",
"chai": "^1.9.0",
"coco": "^0.9.1",
"coffee-script": "^1.7.1",
"require-csv": "0.0.1",
"iced-coffee-script": "^1.7.1-b",
"mocha": "^1.17.1",
"node-jsx": "^0.10.0",
"require-csv": "0.0.1",
"require-ini": "0.0.1",
"toml-require": "^1.0.1",
"require-xml": "0.0.1",
"require-yaml": "0.0.1",
"LiveScript": "^1.2.0"
"toml-require": "^1.0.1"
},
"keywords": [
"require",
Expand Down
13 changes: 13 additions & 0 deletions test/fixtures/test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @jsx React.DOM */

// Test harmony arrow functions
Component = () => {
var trueKey = true;
var falseKey = false;
var subKey = { subProp: 1 };
// Test harmony object short notation
return { data: { trueKey, falseKey, subKey}};
};

// Test JSX syntax
module.exports = <Component />;
6 changes: 5 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ describe('registerFor', function () {
rechoir.registerFor('./test/fixtures/test.json');
expect(require('./fixtures/test.json')).to.deep.equal(expected);
});
it('should know jsx', function () {
rechoir.registerFor('./test/fixtures/test.jsx');
expect(require('./fixtures/test.jsx')).to.deep.equal(expected);
});
it('should know livescript', function () {
rechoir.registerFor('./test/fixtures/test.ls');
expect(require('./fixtures/test.ls')).to.deep.equal(expected);
Expand All @@ -70,7 +74,7 @@ describe('registerFor', function () {

describe('load', function () {
it('should automatically register a loader and require', function () {
delete require.extensions['.coffee']
delete require.extensions['.coffee'];
expect(rechoir.load('./test/fixtures/test.json')).to.deep.equal(expected);
});
});

0 comments on commit 3fe1ead

Please sign in to comment.