Skip to content

Commit aa950cc

Browse files
committed
test: add regression tests for #267, #299, #300
1 parent b34ef36 commit aa950cc

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"@types/babel-code-frame": "^6.20.1",
115115
"@types/chokidar": "^1.7.5",
116116
"@types/jest": "^24.0.11",
117+
"@types/lodash": "^4.14.134",
117118
"@types/micromatch": "^3.1.0",
118119
"@types/minimatch": "^3.0.1",
119120
"@types/mock-require": "^2.0.0",
@@ -130,6 +131,7 @@
130131
"istanbul": "^0.4.5",
131132
"jest": "^24.7.1",
132133
"lint-staged": "^8.0.5",
134+
"lodash": "^4.17.11",
133135
"mock-fs": "^4.3.0",
134136
"mock-require": "^3.0.2",
135137
"prettier": "^1.14.3",

test/integration/general.spec.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// tslint:disable: no-implicit-dependencies - tests might also use devDependencies
12
import fs from 'fs';
23
import path from 'path';
34
import ForkTsCheckerWebpackPlugin from '../../lib/index';
45
import * as helpers from './helpers';
6+
import { cloneDeep } from 'lodash';
57

68
describe.each([[true], [false]])(
79
'[INTEGRATION] common tests - useTypescriptIncrementalApi: %s',
@@ -473,5 +475,49 @@ describe.each([[true], [false]])(
473475
callback();
474476
});
475477
});
478+
479+
/**
480+
* regression test for #267, #299
481+
*/
482+
it('should work even when the plugin has been deep-cloned', callback => {
483+
const compiler = createCompiler({
484+
pluginOptions: {
485+
tsconfig: 'tsconfig-semantic-error-only.json'
486+
},
487+
prepareWebpackConfig({ plugins, ...config }) {
488+
return { ...config, plugins: cloneDeep(plugins) };
489+
}
490+
});
491+
492+
compiler.run((err, stats) => {
493+
expect(stats.compilation.errors).toEqual([
494+
expect.objectContaining({
495+
message: expect.stringContaining('TS2322')
496+
})
497+
]);
498+
callback();
499+
});
500+
});
501+
502+
/**
503+
* regression test for #300
504+
*/
505+
it('should work when `path` is set with relative paths', callback => {
506+
const compiler = createCompiler({
507+
pluginOptions: {
508+
tsconfig: 'tsconfig-semantic-error-only.json',
509+
watch: ['./test1', './test2']
510+
}
511+
});
512+
513+
compiler.run((err, stats) => {
514+
expect(stats.compilation.errors).toEqual([
515+
expect.objectContaining({
516+
message: expect.stringContaining('TS2322')
517+
})
518+
]);
519+
callback();
520+
});
521+
});
476522
}
477523
);

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,11 @@
11591159
dependencies:
11601160
"@types/jest-diff" "*"
11611161

1162+
"@types/lodash@^4.14.134":
1163+
version "4.14.134"
1164+
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.134.tgz#9032b440122db3a2a56200e91191996161dde5b9"
1165+
integrity sha512-2/O0khFUCFeDlbi7sZ7ZFRCcT812fAeOLm7Ev4KbwASkZ575TDrDcY7YyaoHdTOzKcNbfiwLYZqPmoC4wadrsw==
1166+
11621167
"@types/micromatch@^3.1.0":
11631168
version "3.1.0"
11641169
resolved "https://registry.yarnpkg.com/@types/micromatch/-/micromatch-3.1.0.tgz#514c8a3d24b2680a9b838eeb80e6d7d724545433"

0 commit comments

Comments
 (0)