Created
September 2, 2016 11:04
-
-
Save zemlanin/608c7e636c48c1e6064d7fd1efa13816 to your computer and use it in GitHub Desktop.
wallaby transform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": ["es2015", "react"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
index-ts.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
const JSX = () => <div /> | |
export default JSX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
const TSX = () => <div /> | |
export default TSX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "wallaby-transform", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"@types/react": "^0.14.33", | |
"babel-core": "^6.14.0", | |
"babel-preset-es2015": "^6.14.0", | |
"babel-preset-react": "^6.11.1", | |
"mocha": "^3.0.2", | |
"react": "^15.3.1", | |
"react-dom": "^15.3.1", | |
"typescript": "^2.0.2", | |
"wallaby-webpack": "^0.0.23" | |
}, | |
"devDependencies": {}, | |
"scripts": { | |
"build": "tsc && babel index-js.jsx index-ts.js", | |
"test": "tsc && mocha test.js --compilers js:babel-core/register" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import ReactDOMServer from 'react-dom/server' | |
import assert from 'assert' | |
import JSX from './index-js' | |
import TSX from './index-ts' | |
describe('JSX', () => { | |
it('should have correct component name', () => { | |
assert.equal(JSX.name, 'JSX') | |
}) | |
}) | |
describe('TSX', () => { | |
it('should have correct component name', () => { | |
assert.equal(TSX.name, 'TSX') | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"target": "es5", | |
"jsx": "react", | |
"module": "commonjs" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (wallaby) { | |
// comment next line to break component names | |
wallaby.defaults.files.instrument = false | |
return { | |
files: [ | |
'./index*.jsx', | |
'./index*.tsx', | |
], | |
tests: [ | |
'./test.js' | |
], | |
compilers: { | |
'**/*.js*': wallaby.compilers.babel({ babelrc: true }), | |
'**/*.ts*': wallaby.compilers.typeScript(), | |
}, | |
preprocessors: { | |
'**/*.js*': (file) => require('babel-core').transform(file.content, { | |
"presets": ["es2015", "react"] | |
}) | |
}, | |
testFramework: 'mocha', | |
env: { | |
type: 'node' | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment