Skip to content

Commit b5dad13

Browse files
authored
type check comparison test pack (#834)
* type check comparison test pack
1 parent 1cc576d commit b5dad13

File tree

8 files changed

+34
-22
lines changed

8 files changed

+34
-22
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"types": "dist/types/index.d.ts",
77
"scripts": {
88
"build": "tsc --version && tsc --project \"./src\"",
9-
"comparison-tests": "npm link ./test/comparison-tests/testLib && node test/comparison-tests/run-tests.js",
9+
"comparison-tests": "tsc --project \"./test/comparison-tests\" && npm link ./test/comparison-tests/testLib && node test/comparison-tests/run-tests.js",
1010
"comparison-tests-generate": "node test/comparison-tests/stub-new-version.js",
1111
"execution-tests": "npm i -g pnpm && node test/execution-tests/run-tests.js",
1212
"test": "node test/run-tests.js",
@@ -52,7 +52,7 @@
5252
},
5353
"devDependencies": {
5454
"@types/micromatch": "^3.1.0",
55-
"@types/node": "^9.6.2",
55+
"@types/node": "^10.0.0",
5656
"@types/semver": "^5.4.0",
5757
"babel": "^6.0.0",
5858
"babel-core": "^6.0.0",
@@ -62,7 +62,7 @@
6262
"babel-preset-es2016": "^6.16.0",
6363
"babel-preset-react": "^6.0.0",
6464
"escape-string-regexp": "^1.0.3",
65-
"fs-extra": "^6.0.0",
65+
"fs-extra": "^7.0.0",
6666
"glob": "^7.1.1",
6767
"html-webpack-plugin": "^3.2.0",
6868
"husky": "^0.14.3",

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var path = require('path');
44
var mkdirp = require('mkdirp');
55
var rimraf = require('rimraf');
66
var webpack = require('webpack');
7+
// @ts-ignore
78
var webpackVersion = require('webpack/package.json').version;
89
var regexEscape = require('escape-string-regexp');
910
var typescript = require('typescript');
@@ -44,7 +45,9 @@ if (fs.statSync(testPath).isDirectory() &&
4445
testToRun !== 'testLib' &&
4546
!testIsIgnored) {
4647

48+
// @ts-ignore
4749
describe(testToRun, function () {
50+
// @ts-ignore
4851
it('should have the correct output', createTest(testToRun, testPath, {}));
4952

5053
if (testToRun === 'declarationOutput' ||
@@ -54,6 +57,7 @@ if (fs.statSync(testPath).isDirectory() &&
5457
testToRun === 'issue71' ||
5558
testToRun === 'appendSuffixToWatch') { return; }
5659

60+
// @ts-ignore
5761
it('should work with transpile', createTest(testToRun, testPath, { transpile: true }));
5862
});
5963
}
@@ -210,7 +214,7 @@ function saveOutputIfRequired(saveOutputMode, paths, outputs, options, patch) {
210214
}
211215
});
212216

213-
fs.copySync(paths.webpackOutput, paths.originalExpectedOutput, { clobber: true });
217+
fs.copySync(paths.webpackOutput, paths.originalExpectedOutput, { overwrite: true });
214218
}
215219
}
216220

@@ -323,7 +327,7 @@ function copyPatchOrEndTest(testStagingPath, watcher, testState, done) {
323327

324328
// can get inconsistent results if copying right away
325329
setTimeout(function () {
326-
fs.copySync(patchPath, testStagingPath, { clobber: true });
330+
fs.copySync(patchPath, testStagingPath, { overwrite: true });
327331
}, 1000);
328332
}
329333
else {

test/comparison-tests/jsconfig.json

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = function(contents) {
2+
// @ts-ignore
23
this.cacheable();
34
return contents.replace(/\r\n/g, '\n');
45
}

test/comparison-tests/run-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var execSync = require('child_process').execSync;
77

88
// We only want to run comparison tests for the latest released version
99
var typescriptVersion = parseFloat(semver.major(typescript.version) + '.' + semver.minor(typescript.version));
10+
// @ts-ignore
1011
if (typescriptVersion < 3.0 || typescriptVersion > 3.0) return;
1112

1213
// Parse command line arguments

test/comparison-tests/tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true,
4+
"checkJs": true,
5+
"module": "commonjs",
6+
"noEmit": true,
7+
"lib":[
8+
"es2015"
9+
]
10+
},
11+
"files": [
12+
"create-and-execute-test.js",
13+
"run-tests.js",
14+
"newline.loader.js"
15+
]
16+
}

test/pathExists.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var fs = require('fs');
33
module.exports = function pathExists(path) {
44
var pathExists = true;
55
try {
6-
fs.accessSync(path, fs.F_OK);
6+
fs.accessSync(path, fs.constants.F_OK);
77
} catch (e) {
88
pathExists = false;
99
}

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
dependencies:
3434
"@types/braces" "*"
3535

36-
"@types/node@^9.6.2":
37-
version "9.6.20"
38-
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.20.tgz#b59a1bd357ae2df7d44d5ac98e9b64eb96ea1fef"
36+
"@types/node@^10.0.0":
37+
version "10.9.4"
38+
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.4.tgz#0f4cb2dc7c1de6096055357f70179043c33e9897"
3939

4040
"@types/semver@^5.4.0":
4141
version "5.5.0"
@@ -2836,9 +2836,9 @@ fs-access@^1.0.0:
28362836
dependencies:
28372837
null-check "^1.0.0"
28382838

2839-
fs-extra@^6.0.0:
2840-
version "6.0.1"
2841-
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-6.0.1.tgz#8abc128f7946e310135ddc93b98bddb410e7a34b"
2839+
fs-extra@^7.0.0:
2840+
version "7.0.0"
2841+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.0.tgz#8cc3f47ce07ef7b3593a11b9fb245f7e34c041d6"
28422842
dependencies:
28432843
graceful-fs "^4.1.2"
28442844
jsonfile "^4.0.0"

0 commit comments

Comments
 (0)