Skip to content

Commit

Permalink
create importsWatch test based on @jbrantly's PR (#334)
Browse files Browse the repository at this point in the history
* Added importsWatch test based on @jbrantly's PR

* regenerated test data
  • Loading branch information
johnnyreilly committed Oct 22, 2016
1 parent c50a766 commit 2d380b0
Show file tree
Hide file tree
Showing 13 changed files with 214 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/comparison-tests/create-and-execute-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ if (fs.statSync(testPath).isDirectory() &&
describe(testToRun, function () {
it('should have the correct output', createTest(testToRun, testPath, {}));

if (testToRun === 'declarationOutput') { return; }
if (testToRun === 'declarationWatch') { return; }
if (testToRun === 'issue71') { return; }
if (testToRun === 'declarationOutput' ||
testToRun === 'importsWatch' ||
testToRun === 'declarationWatch' ||
testToRun === 'issue71') { return; }

it('should work with transpile', createTest(testToRun, testPath, { transpile: true }));
});
}
Expand Down
4 changes: 4 additions & 0 deletions test/comparison-tests/importsWatch/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {IFoo} from './foo'

var foo: IFoo;
foo.bar = 'foobar'
53 changes: 53 additions & 0 deletions test/comparison-tests/importsWatch/expectedOutput-2.0/bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};

/******/ // The require function
/******/ function __webpack_require__(moduleId) {

/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;

/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };

/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ // Flag the module as loaded
/******/ module.loaded = true;

/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }


/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;

/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;

/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";

/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {

"use strict";
var foo;
foo.bar = 'foobar';


/***/ }
/******/ ]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Asset Size Chunks Chunk Names
bundle.js 1.43 kB 0 [emitted] main
chunk {0} bundle.js (main) 43 bytes [rendered]
[0] ./.test/importsWatch/app.ts 43 bytes {0} [built]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};

/******/ // The require function
/******/ function __webpack_require__(moduleId) {

/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;

/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };

/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ // Flag the module as loaded
/******/ module.loaded = true;

/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }


/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;

/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;

/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";

/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {

"use strict";
var foo;
foo.bar = 'foobar';


/***/ }
/******/ ]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Asset Size Chunks Chunk Names
bundle.js 1.43 kB 0 [emitted] main
chunk {0} bundle.js (main) 43 bytes [rendered]
[0] ./.test/importsWatch/app.ts 43 bytes {0} [built]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};

/******/ // The require function
/******/ function __webpack_require__(moduleId) {

/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;

/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };

/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ // Flag the module as loaded
/******/ module.loaded = true;

/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }


/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;

/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;

/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";

/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {

"use strict";
var foo;
foo.bar = 'foobar';


/***/ }
/******/ ]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Asset Size Chunks Chunk Names
bundle.js 1.43 kB 0 [emitted] main
chunk {0} bundle.js (main) 43 bytes [rendered]
[0] ./.test/importsWatch/app.ts 43 bytes {0} [built] [1 error]

ERROR in ./.test/importsWatch/app.ts
(4,1): error TS2322: Type 'string' is not assignable to type 'boolean'.
3 changes: 3 additions & 0 deletions test/comparison-tests/importsWatch/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface IFoo {
bar: string;
}
3 changes: 3 additions & 0 deletions test/comparison-tests/importsWatch/patch0/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface IFoo {
bar: string;
}
3 changes: 3 additions & 0 deletions test/comparison-tests/importsWatch/patch1/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface IFoo {
bar: boolean;
}
5 changes: 5 additions & 0 deletions test/comparison-tests/importsWatch/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
},
"files": []
}
17 changes: 17 additions & 0 deletions test/comparison-tests/importsWatch/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
entry: './app.ts',
output: {
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.ts', '.js']
},
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
}
}

// 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") } }

0 comments on commit 2d380b0

Please sign in to comment.