Skip to content

Commit 82962c7

Browse files
committed
test: update tests for compatibility with windows
1 parent 9023cd2 commit 82962c7

12 files changed

+97
-64
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"@commitlint/config-conventional": "^8.3.4",
7373
"@mdx-js/mdx": "^1.5.8",
7474
"@types/babel__code-frame": "^7.0.1",
75+
"@types/cross-spawn": "^6.0.2",
7576
"@types/eslint": "^6.8.0",
7677
"@types/fs-extra": "^8.1.0",
7778
"@types/jest": "^25.2.1",
@@ -85,6 +86,7 @@
8586
"@typescript-eslint/eslint-plugin": "^2.27.0",
8687
"@typescript-eslint/parser": "^2.27.0",
8788
"commitlint": "^8.3.5",
89+
"cross-spawn": "^7.0.2",
8890
"eslint": "^6.8.0",
8991
"eslint-config-prettier": "^6.10.1",
9092
"eslint-plugin-node": "^11.1.0",
@@ -101,6 +103,7 @@
101103
"ts-jest": "^25.3.1",
102104
"ts-loader": "^6.2.2",
103105
"typescript": "^3.8.3",
106+
"unixify": "^1.0.0",
104107
"vue": "^2.6.11",
105108
"vue-class-component": "^7.2.3",
106109
"vue-loader": "^15.9.1",

test/e2e/EsLint.spec.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@ describe('EsLint', () => {
3030
])('reports lint error for %p', async ({ async, webpack }) => {
3131
await sandbox.load(
3232
await readFixture(join(__dirname, 'fixtures/eslint-basic.fixture'), {
33-
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION,
34-
TS_LOADER_VERSION: '^5.0.0',
35-
TYPESCRIPT_VERSION: '~3.8.0',
36-
WEBPACK_VERSION: webpack,
37-
WEBPACK_CLI_VERSION,
38-
WEBPACK_DEV_SERVER_VERSION,
39-
ASYNC: async ? 'true' : 'false',
33+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION: JSON.stringify(
34+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
35+
),
36+
TS_LOADER_VERSION: JSON.stringify('^5.0.0'),
37+
TYPESCRIPT_VERSION: JSON.stringify('~3.8.0'),
38+
WEBPACK_VERSION: JSON.stringify(webpack),
39+
WEBPACK_CLI_VERSION: JSON.stringify(WEBPACK_CLI_VERSION),
40+
WEBPACK_DEV_SERVER_VERSION: JSON.stringify(WEBPACK_DEV_SERVER_VERSION),
41+
ASYNC: JSON.stringify(async),
4042
})
4143
);
4244

4345
const driver = createWebpackDevServerDriver(
44-
sandbox.spawn('yarn exec webpack-dev-server'),
46+
sandbox.spawn('./node_modules/.bin/webpack-dev-server'),
4547
async
4648
);
4749
let errors: string[];

test/e2e/PluginOutOfMemory.spec.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ describe('ForkTsCheckerWebpackPlugin Out Of Memory', () => {
2626
])('handles out of memory for %p', async ({ async, webpack }) => {
2727
await sandbox.load(
2828
await readFixture(join(__dirname, 'fixtures/typescript-basic.fixture'), {
29-
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION,
30-
TS_LOADER_VERSION: '^5.0.0',
31-
TYPESCRIPT_VERSION: '~3.8.0',
32-
WEBPACK_VERSION: webpack,
33-
WEBPACK_CLI_VERSION: '^3.3.11',
34-
WEBPACK_DEV_SERVER_VERSION: '^3.10.3',
35-
ASYNC: async ? 'true' : 'false',
29+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION: JSON.stringify(
30+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
31+
),
32+
TS_LOADER_VERSION: JSON.stringify('^5.0.0'),
33+
TYPESCRIPT_VERSION: JSON.stringify('~3.8.0'),
34+
WEBPACK_VERSION: JSON.stringify(webpack),
35+
WEBPACK_CLI_VERSION: JSON.stringify('^3.3.11'),
36+
WEBPACK_DEV_SERVER_VERSION: JSON.stringify('^3.10.3'),
37+
ASYNC: JSON.stringify(async),
3638
})
3739
);
3840

@@ -48,7 +50,9 @@ describe('ForkTsCheckerWebpackPlugin Out Of Memory', () => {
4850
].join('\n')
4951
);
5052

51-
const driver = createGenericProcessDriver(sandbox.spawn('yarn exec webpack-dev-server'));
53+
const driver = createGenericProcessDriver(
54+
sandbox.spawn('./node_modules/.bin/webpack-dev-server')
55+
);
5256

5357
// we should see an error message about out of memory
5458
await driver.waitForStderrIncludes(

test/e2e/TypeScriptSolutionBuilderApi.spec.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,20 @@ describe('TypeScript SolutionBuilder API', () => {
2828
async ({ async }) => {
2929
await sandbox.load(
3030
await readFixture(join(__dirname, 'fixtures/typescript-project-references.fixture'), {
31-
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION,
32-
TS_LOADER_VERSION: '^7.0.1',
33-
TYPESCRIPT_VERSION: '~3.8.0',
34-
WEBPACK_VERSION: '^4.0.0',
35-
WEBPACK_CLI_VERSION,
36-
WEBPACK_DEV_SERVER_VERSION,
37-
ASYNC: async ? 'true' : 'false',
31+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION: JSON.stringify(
32+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
33+
),
34+
TS_LOADER_VERSION: JSON.stringify('^7.0.1'),
35+
TYPESCRIPT_VERSION: JSON.stringify('~3.8.0'),
36+
WEBPACK_VERSION: JSON.stringify('^4.0.0'),
37+
WEBPACK_CLI_VERSION: JSON.stringify(WEBPACK_CLI_VERSION),
38+
WEBPACK_DEV_SERVER_VERSION: JSON.stringify(WEBPACK_DEV_SERVER_VERSION),
39+
ASYNC: JSON.stringify(async),
3840
})
3941
);
4042

4143
const driver = createWebpackDevServerDriver(
42-
sandbox.spawn('yarn exec webpack-dev-server'),
44+
sandbox.spawn('./node_modules/.bin/webpack-dev-server'),
4345
async
4446
);
4547
let errors: string[];

test/e2e/TypeScriptWatchApi.spec.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ describe('TypeScript Watch API', () => {
3333
async ({ async, webpack }) => {
3434
await sandbox.load(
3535
await readFixture(join(__dirname, 'fixtures/typescript-basic.fixture'), {
36-
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION,
37-
TS_LOADER_VERSION: '^5.0.0',
38-
TYPESCRIPT_VERSION: '~3.8.0',
39-
WEBPACK_VERSION: webpack,
40-
WEBPACK_CLI_VERSION,
41-
WEBPACK_DEV_SERVER_VERSION,
42-
ASYNC: async ? 'true' : 'false',
36+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION: JSON.stringify(
37+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
38+
),
39+
TS_LOADER_VERSION: JSON.stringify('^5.0.0'),
40+
TYPESCRIPT_VERSION: JSON.stringify('~3.8.0'),
41+
WEBPACK_VERSION: JSON.stringify(webpack),
42+
WEBPACK_CLI_VERSION: JSON.stringify(WEBPACK_CLI_VERSION),
43+
WEBPACK_DEV_SERVER_VERSION: JSON.stringify(WEBPACK_DEV_SERVER_VERSION),
44+
ASYNC: JSON.stringify(async),
4345
})
4446
);
4547

@@ -52,7 +54,7 @@ describe('TypeScript Watch API', () => {
5254
);
5355

5456
const driver = createWebpackDevServerDriver(
55-
sandbox.spawn('yarn exec webpack-dev-server'),
57+
sandbox.spawn('./node_modules/.bin/webpack-dev-server'),
5658
async
5759
);
5860
let errors: string[];
@@ -155,18 +157,20 @@ describe('TypeScript Watch API', () => {
155157
])('reports semantic error for %p', async ({ async, webpack, typescript, tsloader }) => {
156158
await sandbox.load(
157159
await readFixture(join(__dirname, 'fixtures/typescript-basic.fixture'), {
158-
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION,
159-
TS_LOADER_VERSION: tsloader,
160-
TYPESCRIPT_VERSION: typescript,
161-
WEBPACK_VERSION: webpack,
162-
WEBPACK_CLI_VERSION,
163-
WEBPACK_DEV_SERVER_VERSION,
164-
ASYNC: async ? 'true' : 'false',
160+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION: JSON.stringify(
161+
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
162+
),
163+
TS_LOADER_VERSION: JSON.stringify(tsloader),
164+
TYPESCRIPT_VERSION: JSON.stringify(typescript),
165+
WEBPACK_VERSION: JSON.stringify(webpack),
166+
WEBPACK_CLI_VERSION: JSON.stringify(WEBPACK_CLI_VERSION),
167+
WEBPACK_DEV_SERVER_VERSION: JSON.stringify(WEBPACK_DEV_SERVER_VERSION),
168+
ASYNC: JSON.stringify(async),
165169
})
166170
);
167171

168172
const driver = createWebpackDevServerDriver(
169-
sandbox.spawn('yarn exec webpack-dev-server'),
173+
sandbox.spawn('./node_modules/.bin/webpack-dev-server'),
170174
async
171175
);
172176
let errors: string[];

test/e2e/fixtures/eslint-basic.fixture

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
"@typescript-eslint/eslint-plugin": "^2.27.0",
1010
"@typescript-eslint/parser": "^2.27.0",
1111
"eslint": "^6.8.0",
12-
"fork-ts-checker-webpack-plugin": "${FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION}",
13-
"ts-loader": "${TS_LOADER_VERSION}",
14-
"typescript": "${TYPESCRIPT_VERSION}",
15-
"webpack": "${WEBPACK_VERSION}",
16-
"webpack-cli": "${WEBPACK_CLI_VERSION}",
17-
"webpack-dev-server": "${WEBPACK_DEV_SERVER_VERSION}"
12+
"fork-ts-checker-webpack-plugin": ${FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION},
13+
"ts-loader": ${TS_LOADER_VERSION},
14+
"typescript": ${TYPESCRIPT_VERSION},
15+
"webpack": ${WEBPACK_VERSION},
16+
"webpack-cli": ${WEBPACK_CLI_VERSION},
17+
"webpack-dev-server": ${WEBPACK_DEV_SERVER_VERSION}
1818
}
1919
}
2020
/// tsconfig.json

test/e2e/fixtures/typescript-basic.fixture

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"main": "dist/index.js",
66
"license": "MIT",
77
"devDependencies": {
8-
"fork-ts-checker-webpack-plugin": "${FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION}",
9-
"ts-loader": "${TS_LOADER_VERSION}",
10-
"typescript": "${TYPESCRIPT_VERSION}",
11-
"webpack": "${WEBPACK_VERSION}",
12-
"webpack-cli": "${WEBPACK_CLI_VERSION}",
13-
"webpack-dev-server": "${WEBPACK_DEV_SERVER_VERSION}"
8+
"fork-ts-checker-webpack-plugin": ${FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION},
9+
"ts-loader": ${TS_LOADER_VERSION},
10+
"typescript": ${TYPESCRIPT_VERSION},
11+
"webpack": ${WEBPACK_VERSION},
12+
"webpack-cli": ${WEBPACK_CLI_VERSION},
13+
"webpack-dev-server": ${WEBPACK_DEV_SERVER_VERSION}
1414
}
1515
}
1616
/// tsconfig.json

test/e2e/fixtures/typescript-project-references.fixture

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"packages/*"
99
],
1010
"devDependencies": {
11-
"fork-ts-checker-webpack-plugin": "${FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION}",
12-
"ts-loader": "${TS_LOADER_VERSION}",
13-
"typescript": "${TYPESCRIPT_VERSION}",
14-
"webpack": "${WEBPACK_VERSION}",
15-
"webpack-cli": "${WEBPACK_CLI_VERSION}",
16-
"webpack-dev-server": "${WEBPACK_DEV_SERVER_VERSION}"
11+
"fork-ts-checker-webpack-plugin": ${FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION},
12+
"ts-loader": ${TS_LOADER_VERSION},
13+
"typescript": ${TYPESCRIPT_VERSION},
14+
"webpack": ${WEBPACK_VERSION},
15+
"webpack-cli": ${WEBPACK_CLI_VERSION},
16+
"webpack-dev-server": ${WEBPACK_DEV_SERVER_VERSION}
1717
}
1818
}
1919

test/e2e/sandbox/Sandbox.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { join, resolve, dirname } from 'path';
22
import fs from 'fs-extra';
33
import os from 'os';
44
import chalk from 'chalk';
5-
import { exec, spawn, ChildProcess } from 'child_process';
5+
import { exec, ChildProcess } from 'child_process';
6+
import spawn from 'cross-spawn';
67
import { Fixture } from './Fixture';
78
import stripAnsi from 'strip-ansi';
89

test/unit/formatter/WebpackFormatter.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os from 'os';
2-
import { join } from 'path';
2+
import { join, sep } from 'path';
33
import { Issue } from 'lib/issue';
44
import { createBasicFormatter, createWebpackFormatter, Formatter } from 'lib/formatter';
55

@@ -38,7 +38,7 @@ describe('formatter/WebpackFormatter', () => {
3838
});
3939

4040
it('formats issue file', () => {
41-
expect(formatter(issue)).toContain('some/file.ts');
41+
expect(formatter(issue)).toContain(`some${sep}file.ts`);
4242
});
4343

4444
it('formats location', () => {
@@ -53,7 +53,7 @@ describe('formatter/WebpackFormatter', () => {
5353

5454
it('formats issue header like webpack', () => {
5555
expect(formatter(issue)).toEqual(
56-
['ERROR in some/file.ts 1:7-16', 'TS123: Some issue content', ''].join(os.EOL)
56+
[`ERROR in some${sep}file.ts 1:7-16`, 'TS123: Some issue content', ''].join(os.EOL)
5757
);
5858
});
5959
});

test/unit/typescript-reporter/TypeScriptReporterConfiguration.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import webpack from 'webpack';
2+
import unixify from 'unixify';
23
import { TypeScriptReporterConfiguration } from 'lib/typescript-reporter/TypeScriptReporterConfiguration';
34
import { TypeScriptReporterOptions } from 'lib/typescript-reporter/TypeScriptReporterOptions';
45

@@ -87,7 +88,9 @@ describe('typescript-reporter/TypeScriptsReporterConfiguration', () => {
8788
options as TypeScriptReporterOptions
8889
);
8990

90-
expect(configuration).toEqual(expectedConfiguration);
91+
expect({ ...configuration, tsconfig: unixify(configuration.tsconfig) }).toEqual(
92+
expectedConfiguration
93+
);
9194
});
9295

9396
it('passes vue options to the vue extension', async () => {

yarn.lock

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,13 @@
884884
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
885885
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
886886

887+
"@types/cross-spawn@^6.0.2":
888+
version "6.0.2"
889+
resolved "https://registry.yarnpkg.com/@types/cross-spawn/-/cross-spawn-6.0.2.tgz#168309de311cd30a2b8ae720de6475c2fbf33ac7"
890+
integrity sha512-KuwNhp3eza+Rhu8IFI5HUXRP0LIhqH5cAjubUvGXXthh4YYBuP2ntwEX+Cz8GJoZUHlKo247wPWOfA9LYEq4cw==
891+
dependencies:
892+
"@types/node" "*"
893+
887894
"@types/eslint-visitor-keys@^1.0.0":
888895
version "1.0.0"
889896
resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"
@@ -2369,7 +2376,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
23692376
shebang-command "^1.2.0"
23702377
which "^1.2.9"
23712378

2372-
cross-spawn@^7.0.0:
2379+
cross-spawn@^7.0.0, cross-spawn@^7.0.2:
23732380
version "7.0.2"
23742381
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.2.tgz#d0d7dcfa74e89115c7619f4f721a94e1fdb716d6"
23752382
integrity sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==
@@ -7188,6 +7195,13 @@ universalify@^1.0.0:
71887195
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"
71897196
integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==
71907197

7198+
unixify@^1.0.0:
7199+
version "1.0.0"
7200+
resolved "https://registry.yarnpkg.com/unixify/-/unixify-1.0.0.tgz#3a641c8c2ffbce4da683a5c70f03a462940c2090"
7201+
integrity sha1-OmQcjC/7zk2mg6XHDwOkYpQMIJA=
7202+
dependencies:
7203+
normalize-path "^2.1.1"
7204+
71917205
unset-value@^1.0.0:
71927206
version "1.0.0"
71937207
resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559"

0 commit comments

Comments
 (0)