Skip to content

Commit

Permalink
* Changed the test and src .js files to .ts
Browse files Browse the repository at this point in the history
* Added configuration to wallaby webpack postprocessor to resolve and load .ts files
* Added a rudimentary tsconfig.json
  • Loading branch information
slikts committed Sep 22, 2015
1 parent 9703231 commit dd96092
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 16 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"babel": "^4.7.16",
"chai": "^2.1.2",
"wallaby-webpack": "^0.0.3",
"webpack": "^1.7.3"
"webpack": "^1.7.3",
"ts-loader": "^0.5.5",
"typescript": "^1.6.2"
}
}
3 changes: 2 additions & 1 deletion src/Person.js → src/Person.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default class Person {
name: string
constructor(name) {
this.name = name;
}
};
};
10 changes: 0 additions & 10 deletions test/personSpec.js

This file was deleted.

12 changes: 12 additions & 0 deletions test/personSpec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Person from '../src/Person';

console.log(Person);

// var chai = require('chai');
// var expect = chai.expect;
//
// describe('Person', () => {
// it('should report name', () => {
// expect(new Person('John').name).to.equal('John');
// });
// }
10 changes: 10 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noEmit": true
},
"exclude": [
"node_modules"
]
}
20 changes: 16 additions & 4 deletions wallaby.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
var babel = require('babel');
var wallabyWebpack = require('wallaby-webpack');

var webpackPostprocessor = wallabyWebpack({});
var webpackPostprocessor = wallabyWebpack({
resolve: {
extensions: ['', '.ts', '.js']
},
module: {
loaders: [
{
test: /\.ts$/,
loader: 'ts-loader'
}
]
}
});

module.exports = function () {

return {
files: [
{ pattern: 'src/*.js', load: false }
{ pattern: 'src/*.ts', load: false }
],

tests: [
{ pattern: 'test/*Spec.js', load: false }
{ pattern: 'test/*Spec.ts', load: false }
],

preprocessors: {
Expand All @@ -24,4 +36,4 @@ module.exports = function () {
window.__moduleBundler.loadTests();
}
};
};
};

0 comments on commit dd96092

Please sign in to comment.