-
-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fixes #336. Add happypack compatibility mode * Update README.md * Made happypack a devDependency - In the longer term move this into test itself. Need to rejig test framework a little first. * Don't call registerWebpackErrors in happyPackMode
- Loading branch information
1 parent
19c7a6f
commit 70f0595
Showing
16 changed files
with
158 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ npm-debug.log | |
!/test/**/expectedOutput-*/** | ||
/**/node_modules | ||
/**/dist | ||
/**/.happypack | ||
!build.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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-disable no-var, strict */ | ||
'use strict'; | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
var webpackConfig = require('./webpack.config.js'); | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
browsers: [ 'PhantomJS' ], | ||
|
||
files: [ | ||
// This loads all the tests | ||
'main.js' | ||
], | ||
|
||
port: 9876, | ||
|
||
frameworks: [ 'jasmine' ], | ||
|
||
logLevel: config.LOG_INFO, //config.LOG_DEBUG | ||
|
||
preprocessors: { | ||
'main.js': [ 'webpack', 'sourcemap' ] | ||
}, | ||
|
||
webpack: { | ||
devtool: 'inline-source-map', | ||
module: webpackConfig.module, | ||
resolve: webpackConfig.resolve, | ||
plugins: webpackConfig.plugins, | ||
|
||
// for test harness purposes only, you would not need this in a normal project | ||
resolveLoader: webpackConfig.resolveLoader | ||
}, | ||
|
||
webpackMiddleware: { | ||
quiet: true, | ||
stats: { | ||
colors: true | ||
} | ||
}, | ||
|
||
// reporter options | ||
mochaReporter: { | ||
colors: { | ||
success: 'bgGreen', | ||
info: 'cyan', | ||
warning: 'bgBlue', | ||
error: 'bgRed' | ||
} | ||
} | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare module externalLib { | ||
export function doSomething(arg: any): void; | ||
} | ||
|
||
declare module 'externalLib' { | ||
export = externalLib | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
doSomething: function() { } | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const testsContext = require.context('./', true, /\.tests\.ts(x?)$/); | ||
testsContext.keys().forEach(testsContext); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import submodule = require('./submodule/submodule'); | ||
import externalLib = require('externalLib'); | ||
externalLib.doSomething(submodule); |
5 changes: 5 additions & 0 deletions
5
test/execution-tests/basic-happypack/src/submodule/submodule.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import externalLib = require('externalLib'); | ||
|
||
externalLib.doSomething(""); | ||
var message = "Hello from submodule" | ||
export = message |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import submodule = require('../src/submodule/submodule'); | ||
import externalLib = require('externalLib'); | ||
|
||
describe("app", () => { | ||
it("externalLib can be called", () => { | ||
expect(externalLib.doSomething(submodule)).toBeUndefined(); | ||
}); | ||
|
||
it("submodule return value can be reached", () => { | ||
expect(submodule).toBe("Hello from submodule"); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"compilerOptions": { | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "simple", | ||
"version": false, | ||
"globalDependencies": { | ||
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#fe563dff3428bac1260d1794e2c2ecf8f097535a" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var path = require('path'); | ||
var HappyPack = require('happypack'); | ||
|
||
module.exports = { | ||
entry: './src/app.ts', | ||
output: { | ||
filename: 'bundle.js' | ||
}, | ||
resolve: { | ||
alias: { externalLib: path.join(__dirname, "./lib/externalLib.js") }, | ||
extensions: ['.ts', '.js'] | ||
}, | ||
module: { | ||
rules: [ | ||
{ test: /\.ts$/, loader: 'happypack/loader?id=ts'} | ||
] | ||
}, | ||
plugins: [ | ||
new HappyPack({ | ||
id: 'ts', | ||
threads : 2, | ||
loaders: [ "ts-loader?" + JSON.stringify({happyPackMode: true}) ] | ||
}) | ||
] | ||
}; | ||
|
||
// for test harness purposes only, you would not need this in a normal project | ||
module.exports.resolveLoader = { alias: { 'ts-loader': require('path').join(__dirname, "../../../index.js") } } |