Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create importsWatch test based on @jbrantly's PR #334

Merged
merged 2 commits into from
Oct 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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") } }