Skip to content

Commit

Permalink
3.6 was missing from Travis / AppVeyor build matrices. (#1011)
Browse files Browse the repository at this point in the history
* Update .travis.yml

* Update appveyor.yml

* update comparison tests

* update to TS 3.6.3

* make comparison test tolerant of different spaces

* Fix when config includes referenced project sources and outputs as well

* Always run comparison test without transpile

* ignore case when matching file paths

* Update CHANGELOG.md
  • Loading branch information
johnnyreilly committed Sep 20, 2019
1 parent 9a83912 commit e9ef049
Show file tree
Hide file tree
Showing 36 changed files with 351 additions and 59 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -14,9 +14,10 @@ install:
- yarn lint
- yarn add $TYPESCRIPT
env:
- TYPESCRIPT=typescript@3.6.3
- TYPESCRIPT=typescript@next
- TYPESCRIPT=typescript@3.5.1
- TYPESCRIPT=typescript@3.4.4
- TYPESCRIPT=typescript@next
- TYPESCRIPT=typescript@3.3.3
- TYPESCRIPT=typescript@3.2.1
- TYPESCRIPT=typescript@3.1.1
Expand All @@ -27,4 +28,4 @@ env:
- TYPESCRIPT=typescript@2.6.1
- TYPESCRIPT=typescript@2.5.2
- TYPESCRIPT=typescript@2.4.1


2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,7 +1,7 @@
# Changelog

## v6.1.1
* [Fix SolutionBuilder watches](https://github.com/TypeStrong/ts-loader/pull/1003) (#998) - thanks @sheetalkamat!
* [Fix SolutionBuilder watches](https://github.com/TypeStrong/ts-loader/pull/1003) and [related fixes](https://github.com/TypeStrong/ts-loader/pull/1011) (#998) - thanks @sheetalkamat!
* [fix: no errors reported if flagged with @ts-check](https://github.com/TypeStrong/ts-loader/pull/1008) (#1004) - thanks @reinholdk!

## v6.1.0
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Expand Up @@ -3,9 +3,10 @@ environment:
FORCE_COLOR: 1
nodejs_version: "10"
matrix:
- TYPESCRIPT: typescript@3.6.3
- TYPESCRIPT: typescript@next
- TYPESCRIPT: typescript@3.5.1
- TYPESCRIPT: typescript@3.4.4
- TYPESCRIPT: typescript@next
- TYPESCRIPT: typescript@3.3.3
- TYPESCRIPT: typescript@3.2.1
- TYPESCRIPT: typescript@3.1.1
Expand Down
4 changes: 1 addition & 3 deletions src/after-compile.ts
Expand Up @@ -72,9 +72,8 @@ export function makeAfterCompile(
provideTsBuildInfoFilesToWebpack(instance, compilation);

instance.filesWithErrors = filesWithErrors;
instance.modifiedFiles = null;
instance.modifiedFiles = undefined;
instance.projectsMissingSourceMaps = new Set();

callback();
};
}
Expand All @@ -90,7 +89,6 @@ function provideCompilerOptionDiagnosticErrorsToWebpack(
) {
if (getCompilerOptionDiagnostics) {
const { languageService, loaderOptions, compiler, program } = instance;

const errorsToAdd = formatErrors(
program === undefined
? languageService!.getCompilerOptionsDiagnostics()
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -432,7 +432,7 @@ function updateFileInCache(
}

// push this file to modified files hash.
if (instance.modifiedFiles === null || instance.modifiedFiles === undefined) {
if (!instance.modifiedFiles) {
instance.modifiedFiles = new Map<string, TSFile>();
}
instance.modifiedFiles.set(filePath, file);
Expand Down
1 change: 0 additions & 1 deletion src/instances.ts
Expand Up @@ -276,7 +276,6 @@ function successfulTypeScriptInstance(
transformers: {} as typescript.CustomTransformers, // this is only set temporarily, custom transformers are created further down
dependencyGraph: {},
reverseDependencyGraph: {},
modifiedFiles: null,
colors
});

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces.ts
Expand Up @@ -103,7 +103,7 @@ export interface TSInstance {
/**
* contains the modified files - cleared each time after-compile is called
*/
modifiedFiles?: TSFiles | null;
modifiedFiles?: TSFiles;
/**
* Paths to project references that are missing source maps.
* Cleared each time after-compile is called. Used to dedupe
Expand Down
6 changes: 5 additions & 1 deletion src/servicesHost.ts
Expand Up @@ -13,6 +13,7 @@ import {
ResolveSync,
SolutionBuilderWithWatchHost,
SolutionDiagnostics,
TSFile,
TSInstance,
WatchCallbacks,
WatchFactory,
Expand Down Expand Up @@ -385,7 +386,10 @@ export function updateFileWithText(
file.text = newText;
file.version++;
instance.version!++;
instance.modifiedFiles!.set(nFilePath, file);
if (!instance.modifiedFiles) {
instance.modifiedFiles = new Map<string, TSFile>();
}
instance.modifiedFiles.set(nFilePath, file);
if (instance.watchHost !== undefined) {
instance.watchHost.invokeFileWatcher(
nFilePath,
Expand Down
6 changes: 1 addition & 5 deletions src/watch-run.ts
@@ -1,7 +1,7 @@
import * as webpack from 'webpack';

import * as constants from './constants';
import { TSFile, TSInstance } from './interfaces';
import { TSInstance } from './interfaces';
import { updateFileWithText } from './servicesHost';
import { readFile } from './utils';

Expand All @@ -14,10 +14,6 @@ export function makeWatchRun(instance: TSInstance) {
const startTime = 0;

return (compiler: webpack.Compiler, callback: () => void) => {
if (null === instance.modifiedFiles) {
instance.modifiedFiles = new Map<string, TSFile>();
}

const times = compiler.fileTimestamps;
for (const [filePath, date] of times) {
if (
Expand Down
21 changes: 9 additions & 12 deletions test/comparison-tests/create-and-execute-test.js
Expand Up @@ -52,10 +52,8 @@ if (fs.statSync(testPath).isDirectory() &&

// @ts-ignore
describe(`${testToRun}${extraOption ? ` - ${extraOption}: true` : ''}`, function () {
if (testToRun !== 'projectReferencesOutDir' || require('os').platform() !== 'win32') {
// @ts-ignore
it('should have the correct output', createTest(testToRun, testPath, {}));
}
// @ts-ignore
it('should have the correct output', createTest(testToRun, testPath, {}));

if (testToRun === 'declarationOutput' ||
testToRun === 'declarationOutputWithMaps' ||
Expand Down Expand Up @@ -390,7 +388,6 @@ function getNormalisedFileContent(file, location) {
/** @type {string} */
let fileContent;
const filePath = path.join(location, file);

try {
const originalContent = fs.readFileSync(filePath).toString();
fileContent = (file.indexOf('output.') === 0
Expand All @@ -402,9 +399,9 @@ function getNormalisedFileContent(file, location) {
.replace(/Module build failed \(from \//gm, 'Module build failed (from ')
.replace(/Module Warning \(from \//gm, 'Module Warning (from ')
// We don't want a difference in the number of kilobytes to fail the build
.replace(/[\d]+([.][\d]*)? KiB/g, 'A-NUMBER-OF KiB')
.replace(/\s+[\d]+([.][\d]*)? KiB\s+/g, ' A-NUMBER-OF KiB ')
// We also don't want a difference in the number of bytes to fail the build
.replace(/ \d+ bytes /g, ' A-NUMBER-OF bytes ')
.replace(/\s+\d+ bytes\s+/g, ' A-NUMBER-OF bytes ')
// Ignore whitespace between: Asset Size Chunks Chunk Names
.replace(/\s+Asset\s+Size\s+Chunks\s+Chunk Names/, ' Asset Size Chunks Chunk Names')
.replace(/ test\/comparison-tests\//,' /test/comparison-tests/')
Expand All @@ -422,11 +419,11 @@ function getNormalisedFileContent(file, location) {
return 'at ' + remainingPathAndColon + 'irrelevant-line-number' + colon + 'irrelevant-column-number';
})
// strip C:/projects/ts-loader/.test/
.replace(/(C\:\/)?[\w|\/]*\/(ts-loader|workspace)\/\.test/g, '')
.replace(/webpack:\/\/(C:\/)?[\w|\/|-]*\/comparison-tests\//g, 'webpack://comparison-tests/')
.replace(/WEBPACK FOOTER\/n\/ (C:\/)?[\w|\/|-]*\/comparison-tests\//g, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/')
.replace(/!\** (C\:\/)?[\w|\/|-]*\/comparison-tests\//g, '!*** /ts-loader/test/comparison-tests/')
.replace(/\/ (C\:\/)?[\w|\/|-]*\/comparison-tests\//g, '/ /ts-loader/test/comparison-tests/')
.replace(/(C\:\/)?[\w|\/]*\/(ts-loader|workspace)\/\.test/ig, '')
.replace(/webpack:\/\/(C:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'webpack://comparison-tests/')
.replace(/WEBPACK FOOTER\/n\/ (C:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/')
.replace(/!\** (C\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '!*** /ts-loader/test/comparison-tests/')
.replace(/\/ (C\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '/ /ts-loader/test/comparison-tests/')
// with webpack 4 there are different numbers of *s on Windows and on Linux
.replace(/\*{10}\**/g, '**********');
} catch (e) {
Expand Down
Expand Up @@ -105,7 +105,7 @@ eval("\nexports.__esModule = true;\nvar a = __webpack_require__(/*! a */ \"./nod
/*! no static exports found */
/***/ (function(module, exports) {

eval("throw new Error(\"Module build failed (from C:/source/ts-loader/index.js):/nError: TypeScript emitted no output for C://source//ts-loader//.test//nodeModulesMeaningfulErrorWhenImportingTs//node_modules//a//index.ts. By default, ts-loader will not compile .ts files in node_modules./nYou should not need to recompile .ts files there, but if you really want to, use the allowTsInNodeModules option./nSee: https://github.com/Microsoft/TypeScript/issues/12358/n at makeSourceMapAndFinish (C://source//ts-loader//dist//index.js:78:15)/n at successLoader (C://source//ts-loader//dist//index.js:68:9)/n at Object.loader (C://source//ts-loader//dist//index.js:22:12)\");\n\n//# sourceURL=webpack:///./node_modules/a/index.ts?");
eval("throw new Error(\"Module build failed (from C:/source/ts-loader/index.js):/nError: TypeScript emitted no output for C://source//ts-loader//.test//nodeModulesMeaningfulErrorWhenImportingTs//node_modules//a//index.ts. By default, ts-loader will not compile .ts files in node_modules./nYou should not need to recompile .ts files there, but if you really want to, use the allowTsInNodeModules option./nSee: https://github.com/Microsoft/TypeScript/issues/12358/n at makeSourceMapAndFinish (C://source//ts-loader//dist//index.js:80:15)/n at successLoader (C://source//ts-loader//dist//index.js:68:9)/n at Object.loader (C://source//ts-loader//dist//index.js:22:12)\");\n\n//# sourceURL=webpack:///./node_modules/a/index.ts?");

/***/ })

Expand Down
Expand Up @@ -9,7 +9,7 @@ Module build failed (from /index.js):
Error: TypeScript emitted no output for node_modules\a\index.ts. By default, ts-loader will not compile .ts files in node_modules.
You should not need to recompile .ts files there, but if you really want to, use the allowTsInNodeModules option.
See: https://github.com/Microsoft/TypeScript/issues/12358
at makeSourceMapAndFinish (dist\index.js:78:15)
at makeSourceMapAndFinish (dist\index.js:80:15)
at successLoader (dist\index.js:68:9)
at Object.loader (dist\index.js:22:12)
@ ./app.ts 3:8-20
Expand Up @@ -105,7 +105,7 @@ eval("\nexports.__esModule = true;\nvar lib_1 = __webpack_require__(/*! ./lib */
/*! no static exports found */
/***/ (function(module, exports) {

eval("throw new Error(\"Module build failed (from c:/github/ts-loader/index.js):/nError: TypeScript emitted no output for c://github//ts-loader//.test//projectReferencesNotBuilt_SemanticErrorInReference//lib//index.ts. The most common cause for this is having errors when building referenced projects./n at makeSourceMapAndFinish (c://github//ts-loader//dist//index.js:80:15)/n at successLoader (c://github//ts-loader//dist//index.js:68:9)/n at Object.loader (c://github//ts-loader//dist//index.js:22:12)\");\n\n//# sourceURL=webpack:///./lib/index.ts?");
eval("throw new Error(\"Module build failed (from C:/source/ts-loader/index.js):/nError: TypeScript emitted no output for C://source//ts-loader//.test//projectReferencesNotBuilt_SemanticErrorInReference//lib//index.ts. The most common cause for this is having errors when building referenced projects./n at makeSourceMapAndFinish (C://source//ts-loader//dist//index.js:80:15)/n at successLoader (C://source//ts-loader//dist//index.js:68:9)/n at Object.loader (C://source//ts-loader//dist//index.js:22:12)\");\n\n//# sourceURL=webpack:///./lib/index.ts?");

/***/ })

Expand Down
Expand Up @@ -105,7 +105,7 @@ eval("\nexports.__esModule = true;\nvar lib_1 = __webpack_require__(/*! ./lib */
/*! no static exports found */
/***/ (function(module, exports) {

eval("throw new Error(\"Module build failed (from c:/github/ts-loader/index.js):/nError: TypeScript emitted no output for c://github//ts-loader//.test//projectReferencesNotBuilt_SyntaxErrorInReference//lib//index.ts. The most common cause for this is having errors when building referenced projects./n at makeSourceMapAndFinish (c://github//ts-loader//dist//index.js:80:15)/n at successLoader (c://github//ts-loader//dist//index.js:68:9)/n at Object.loader (c://github//ts-loader//dist//index.js:22:12)\");\n\n//# sourceURL=webpack:///./lib/index.ts?");
eval("throw new Error(\"Module build failed (from C:/source/ts-loader/index.js):/nError: TypeScript emitted no output for C://source//ts-loader//.test//projectReferencesNotBuilt_SyntaxErrorInReference//lib//index.ts. The most common cause for this is having errors when building referenced projects./n at makeSourceMapAndFinish (C://source//ts-loader//dist//index.js:80:15)/n at successLoader (C://source//ts-loader//dist//index.js:68:9)/n at Object.loader (C://source//ts-loader//dist//index.js:22:12)\");\n\n//# sourceURL=webpack:///./lib/index.ts?");

/***/ })

Expand Down
Expand Up @@ -106,7 +106,7 @@ eval("\nexports.__esModule = true;\nvar lib_1 = __webpack_require__(/*! ./lib */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n\n\n//# sourceURL=webpack:///./lib/index.ts?");
eval("\r\nexports.__esModule = true;\r\nexports.lib = {\r\n one: 1,\r\n two: 2,\r\n three: 3\r\n};\r\n\n\n//# sourceURL=webpack:///./lib/index.ts?");

/***/ })

Expand Down
@@ -1,5 +1,7 @@
Asset Size Chunks Chunk Names
bundle.js 4.28 KiB main [emitted] main
Asset Size Chunks Chunk Names
bundle.js 4.29 KiB main [emitted] main
../lib/out/index.d.ts 89 bytes [emitted]
../lib/out/tsconfig.tsbuildinfo 71 KiB [emitted]
Entrypoint main = bundle.js
[./app.ts] 131 bytes {main} [built]
[./lib/index.ts] 97 bytes {main} [built]
[./lib/index.ts] 104 bytes {main} [built]
Expand Up @@ -4,8 +4,4 @@
../lib/tsconfig.tsbuildinfo 71.5 KiB [emitted]
Entrypoint main = bundle.js
[./app.ts] 81 bytes {main} [built]
[./lib/src/index.ts] 66 bytes {main} [built]

ERROR in tsconfig.json
[tsl] ERROR
 TS5033: Could not write file '/.test/projectReferencesRootDir/lib/out/index.d.ts': Cannot read property 'set' of null.
[./lib/src/index.ts] 66 bytes {main} [built]
3 changes: 2 additions & 1 deletion test/comparison-tests/projectReferencesRootDir/tsconfig.json
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"target": "esnext",
"target": "esnext"
},
"files": ["./app.ts"],
"references": [
{ "path": "./lib" }
]
Expand Down
@@ -0,0 +1,3 @@
import { lib } from './lib/src/index';

console.log(lib.one, lib.two, lib.three);
@@ -0,0 +1,113 @@
/******/ (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] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = 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;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./app.ts");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./app.ts":
/*!****************!*\
!*** ./app.ts ***!
\****************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _lib_src_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/src/index */ \"./lib/src/index.ts\");\n\nconsole.log(_lib_src_index__WEBPACK_IMPORTED_MODULE_0__[\"lib\"].one, _lib_src_index__WEBPACK_IMPORTED_MODULE_0__[\"lib\"].two, _lib_src_index__WEBPACK_IMPORTED_MODULE_0__[\"lib\"].three);\n\n\n//# sourceURL=webpack:///./app.ts?");

/***/ }),

/***/ "./lib/src/index.ts":
/*!**************************!*\
!*** ./lib/src/index.ts ***!
\**************************/
/*! exports provided: lib */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lib\", function() { return lib; });\nconst lib = {\r\n one: 1,\r\n two: 2,\r\n three: 3\r\n};\r\n\n\n//# sourceURL=webpack:///./lib/src/index.ts?");

/***/ })

/******/ });

0 comments on commit e9ef049

Please sign in to comment.