Skip to content

Commit e9ef049

Browse files
authored
3.6 was missing from Travis / AppVeyor build matrices. (#1011)
* 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
1 parent 9a83912 commit e9ef049

File tree

36 files changed

+351
-59
lines changed

36 files changed

+351
-59
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ install:
1414
- yarn lint
1515
- yarn add $TYPESCRIPT
1616
env:
17+
18+
- TYPESCRIPT=typescript@next
1719
1820
19-
- TYPESCRIPT=typescript@next
2021
2122
2223
@@ -27,4 +28,4 @@ env:
2728
2829
2930
30-
31+

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
## v6.1.1
4-
* [Fix SolutionBuilder watches](https://github.com/TypeStrong/ts-loader/pull/1003) (#998) - thanks @sheetalkamat!
4+
* [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!
55
* [fix: no errors reported if flagged with @ts-check](https://github.com/TypeStrong/ts-loader/pull/1008) (#1004) - thanks @reinholdk!
66

77
## v6.1.0

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ environment:
33
FORCE_COLOR: 1
44
nodejs_version: "10"
55
matrix:
6+
- TYPESCRIPT: [email protected]
7+
- TYPESCRIPT: typescript@next
68
- TYPESCRIPT: [email protected]
79
- TYPESCRIPT: [email protected]
8-
- TYPESCRIPT: typescript@next
910
- TYPESCRIPT: [email protected]
1011
- TYPESCRIPT: [email protected]
1112
- TYPESCRIPT: [email protected]

src/after-compile.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ export function makeAfterCompile(
7272
provideTsBuildInfoFilesToWebpack(instance, compilation);
7373

7474
instance.filesWithErrors = filesWithErrors;
75-
instance.modifiedFiles = null;
75+
instance.modifiedFiles = undefined;
7676
instance.projectsMissingSourceMaps = new Set();
77-
7877
callback();
7978
};
8079
}
@@ -90,7 +89,6 @@ function provideCompilerOptionDiagnosticErrorsToWebpack(
9089
) {
9190
if (getCompilerOptionDiagnostics) {
9291
const { languageService, loaderOptions, compiler, program } = instance;
93-
9492
const errorsToAdd = formatErrors(
9593
program === undefined
9694
? languageService!.getCompilerOptionsDiagnostics()

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ function updateFileInCache(
432432
}
433433

434434
// push this file to modified files hash.
435-
if (instance.modifiedFiles === null || instance.modifiedFiles === undefined) {
435+
if (!instance.modifiedFiles) {
436436
instance.modifiedFiles = new Map<string, TSFile>();
437437
}
438438
instance.modifiedFiles.set(filePath, file);

src/instances.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ function successfulTypeScriptInstance(
276276
transformers: {} as typescript.CustomTransformers, // this is only set temporarily, custom transformers are created further down
277277
dependencyGraph: {},
278278
reverseDependencyGraph: {},
279-
modifiedFiles: null,
280279
colors
281280
});
282281

src/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export interface TSInstance {
103103
/**
104104
* contains the modified files - cleared each time after-compile is called
105105
*/
106-
modifiedFiles?: TSFiles | null;
106+
modifiedFiles?: TSFiles;
107107
/**
108108
* Paths to project references that are missing source maps.
109109
* Cleared each time after-compile is called. Used to dedupe

src/servicesHost.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ResolveSync,
1414
SolutionBuilderWithWatchHost,
1515
SolutionDiagnostics,
16+
TSFile,
1617
TSInstance,
1718
WatchCallbacks,
1819
WatchFactory,
@@ -385,7 +386,10 @@ export function updateFileWithText(
385386
file.text = newText;
386387
file.version++;
387388
instance.version!++;
388-
instance.modifiedFiles!.set(nFilePath, file);
389+
if (!instance.modifiedFiles) {
390+
instance.modifiedFiles = new Map<string, TSFile>();
391+
}
392+
instance.modifiedFiles.set(nFilePath, file);
389393
if (instance.watchHost !== undefined) {
390394
instance.watchHost.invokeFileWatcher(
391395
nFilePath,

src/watch-run.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as webpack from 'webpack';
22

33
import * as constants from './constants';
4-
import { TSFile, TSInstance } from './interfaces';
4+
import { TSInstance } from './interfaces';
55
import { updateFileWithText } from './servicesHost';
66
import { readFile } from './utils';
77

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

1616
return (compiler: webpack.Compiler, callback: () => void) => {
17-
if (null === instance.modifiedFiles) {
18-
instance.modifiedFiles = new Map<string, TSFile>();
19-
}
20-
2117
const times = compiler.fileTimestamps;
2218
for (const [filePath, date] of times) {
2319
if (

test/comparison-tests/create-and-execute-test.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ if (fs.statSync(testPath).isDirectory() &&
5252

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

6058
if (testToRun === 'declarationOutput' ||
6159
testToRun === 'declarationOutputWithMaps' ||
@@ -390,7 +388,6 @@ function getNormalisedFileContent(file, location) {
390388
/** @type {string} */
391389
let fileContent;
392390
const filePath = path.join(location, file);
393-
394391
try {
395392
const originalContent = fs.readFileSync(filePath).toString();
396393
fileContent = (file.indexOf('output.') === 0
@@ -402,9 +399,9 @@ function getNormalisedFileContent(file, location) {
402399
.replace(/Module build failed \(from \//gm, 'Module build failed (from ')
403400
.replace(/Module Warning \(from \//gm, 'Module Warning (from ')
404401
// We don't want a difference in the number of kilobytes to fail the build
405-
.replace(/[\d]+([.][\d]*)? KiB/g, 'A-NUMBER-OF KiB')
402+
.replace(/\s+[\d]+([.][\d]*)? KiB\s+/g, ' A-NUMBER-OF KiB ')
406403
// We also don't want a difference in the number of bytes to fail the build
407-
.replace(/ \d+ bytes /g, ' A-NUMBER-OF bytes ')
404+
.replace(/\s+\d+ bytes\s+/g, ' A-NUMBER-OF bytes ')
408405
// Ignore whitespace between: Asset Size Chunks Chunk Names
409406
.replace(/\s+Asset\s+Size\s+Chunks\s+Chunk Names/, ' Asset Size Chunks Chunk Names')
410407
.replace(/ test\/comparison-tests\//,' /test/comparison-tests/')
@@ -422,11 +419,11 @@ function getNormalisedFileContent(file, location) {
422419
return 'at ' + remainingPathAndColon + 'irrelevant-line-number' + colon + 'irrelevant-column-number';
423420
})
424421
// strip C:/projects/ts-loader/.test/
425-
.replace(/(C\:\/)?[\w|\/]*\/(ts-loader|workspace)\/\.test/g, '')
426-
.replace(/webpack:\/\/(C:\/)?[\w|\/|-]*\/comparison-tests\//g, 'webpack://comparison-tests/')
427-
.replace(/WEBPACK FOOTER\/n\/ (C:\/)?[\w|\/|-]*\/comparison-tests\//g, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/')
428-
.replace(/!\** (C\:\/)?[\w|\/|-]*\/comparison-tests\//g, '!*** /ts-loader/test/comparison-tests/')
429-
.replace(/\/ (C\:\/)?[\w|\/|-]*\/comparison-tests\//g, '/ /ts-loader/test/comparison-tests/')
422+
.replace(/(C\:\/)?[\w|\/]*\/(ts-loader|workspace)\/\.test/ig, '')
423+
.replace(/webpack:\/\/(C:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'webpack://comparison-tests/')
424+
.replace(/WEBPACK FOOTER\/n\/ (C:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/')
425+
.replace(/!\** (C\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '!*** /ts-loader/test/comparison-tests/')
426+
.replace(/\/ (C\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '/ /ts-loader/test/comparison-tests/')
430427
// with webpack 4 there are different numbers of *s on Windows and on Linux
431428
.replace(/\*{10}\**/g, '**********');
432429
} catch (e) {

0 commit comments

Comments
 (0)