Skip to content

Commit 45618f4

Browse files
hiroppyalexander-akait
authored andcommitted
chore: fix tests (#1997)
1 parent 2603042 commit 45618f4

File tree

3 files changed

+131
-15
lines changed

3 files changed

+131
-15
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Server addEntries add hot option 1`] = `
4+
Array [
5+
Array [
6+
"client",
7+
"index.js?http:",
8+
"localhost",
9+
],
10+
Array [
11+
"node_modules",
12+
"webpack",
13+
"hot",
14+
"dev-server.js",
15+
],
16+
Array [
17+
"foo.js",
18+
],
19+
]
20+
`;
21+
22+
exports[`Server addEntries add hot option 2`] = `
23+
Array [
24+
HotModuleReplacementPlugin {
25+
"fullBuildTimeout": 200,
26+
"multiStep": undefined,
27+
"options": Object {},
28+
"requestTimeout": 10000,
29+
},
30+
]
31+
`;
32+
33+
exports[`Server addEntries add hotOnly option 1`] = `
34+
Array [
35+
Array [
36+
"client",
37+
"index.js?http:",
38+
"localhost",
39+
],
40+
Array [
41+
"node_modules",
42+
"webpack",
43+
"hot",
44+
"only-dev-server.js",
45+
],
46+
Array [
47+
"foo.js",
48+
],
49+
]
50+
`;
51+
52+
exports[`Server addEntries add hotOnly option 2`] = `
53+
Array [
54+
HotModuleReplacementPlugin {
55+
"fullBuildTimeout": 200,
56+
"multiStep": undefined,
57+
"options": Object {},
58+
"requestTimeout": 10000,
59+
},
60+
]
61+
`;
62+
63+
exports[`Server stats should works with difference stats values (contains 'hash', 'assets', 'warnings' and 'errors') 1`] = `
64+
Array [
65+
"errors",
66+
"warnings",
67+
"hash",
68+
"assetsByChunkName",
69+
"assets",
70+
"filteredAssets",
71+
]
72+
`;
73+
74+
exports[`Server stats should works with difference stats values (contains 'hash', 'assets', 'warnings' and 'errors') 2`] = `
75+
Array [
76+
"errors",
77+
"warnings",
78+
"hash",
79+
"assetsByChunkName",
80+
"assets",
81+
"filteredAssets",
82+
]
83+
`;
84+
85+
exports[`Server stats should works with difference stats values (contains 'hash', 'assets', 'warnings' and 'errors') 3`] = `
86+
Array [
87+
"errors",
88+
"warnings",
89+
"hash",
90+
"assetsByChunkName",
91+
"assets",
92+
"filteredAssets",
93+
]
94+
`;
95+
96+
exports[`Server stats should works with difference stats values (contains 'hash', 'assets', 'warnings' and 'errors') 4`] = `
97+
Array [
98+
"errors",
99+
"warnings",
100+
"hash",
101+
"assetsByChunkName",
102+
"assets",
103+
"filteredAssets",
104+
]
105+
`;
106+
107+
exports[`Server stats should works with difference stats values (contains 'hash', 'assets', 'warnings' and 'errors') 5`] = `
108+
Array [
109+
"errors",
110+
"warnings",
111+
"hash",
112+
"assetsByChunkName",
113+
"assets",
114+
"filteredAssets",
115+
]
116+
`;

test/server/open-option.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
22

3-
jest.mock('opn');
3+
jest.mock('open');
44

55
const webpack = require('webpack');
6-
const open = require('opn');
6+
const open = require('open');
77
const Server = require('../../lib/Server');
88
const config = require('../fixtures/simple-config/webpack.config');
99
const port = require('../ports-map')['open-option'];

test/server/utils/runOpen.test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
'use strict';
22

3-
const opn = require('opn');
3+
const open = require('open');
44
const runOpen = require('../../../lib/utils/runOpen');
55

6-
jest.mock('opn');
6+
jest.mock('open');
77

88
describe('runOpen util', () => {
99
afterEach(() => {
10-
opn.mockClear();
10+
open.mockClear();
1111
});
1212

1313
describe('should open browser', () => {
1414
beforeEach(() => {
15-
opn.mockImplementation(() => Promise.resolve());
15+
open.mockImplementation(() => Promise.resolve());
1616
});
1717

1818
it('on specify URL', () => {
1919
return runOpen('https://example.com', {}, console).then(() => {
20-
expect(opn.mock.calls[0]).toMatchInlineSnapshot(`
20+
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
2121
Array [
2222
"https://example.com",
2323
Object {
@@ -34,7 +34,7 @@ describe('runOpen util', () => {
3434
{ openPage: '/index.html' },
3535
console
3636
).then(() => {
37-
expect(opn.mock.calls[0]).toMatchInlineSnapshot(`
37+
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
3838
Array [
3939
"https://example.com/index.html",
4040
Object {
@@ -72,7 +72,7 @@ describe('runOpen util', () => {
7272
{ open: 'Google Chrome' },
7373
console
7474
).then(() => {
75-
expect(opn.mock.calls[0]).toMatchInlineSnapshot(`
75+
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
7676
Array [
7777
"https://example.com",
7878
Object {
@@ -90,7 +90,7 @@ describe('runOpen util', () => {
9090
{ open: 'Google Chrome', openPage: '/index.html' },
9191
console
9292
).then(() => {
93-
expect(opn.mock.calls[0]).toMatchInlineSnapshot(`
93+
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
9494
Array [
9595
"https://example.com/index.html",
9696
Object {
@@ -171,7 +171,7 @@ describe('runOpen util', () => {
171171
const logMock = { warn: jest.fn() };
172172

173173
beforeEach(() => {
174-
opn.mockImplementation(() => Promise.reject());
174+
open.mockImplementation(() => Promise.reject());
175175
});
176176

177177
afterEach(() => {
@@ -183,7 +183,7 @@ describe('runOpen util', () => {
183183
expect(logMock.warn.mock.calls[0][0]).toMatchInlineSnapshot(
184184
`"Unable to open \\"https://example.com\\" in browser. If you are running in a headless environment, please do not use the --open flag"`
185185
);
186-
expect(opn.mock.calls[0]).toMatchInlineSnapshot(`
186+
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
187187
Array [
188188
"https://example.com",
189189
Object {
@@ -203,7 +203,7 @@ describe('runOpen util', () => {
203203
expect(logMock.warn.mock.calls[0][0]).toMatchInlineSnapshot(
204204
`"Unable to open \\"https://example.com/index.html\\" in browser. If you are running in a headless environment, please do not use the --open flag"`
205205
);
206-
expect(opn.mock.calls[0]).toMatchInlineSnapshot(`
206+
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
207207
Array [
208208
"https://example.com/index.html",
209209
Object {
@@ -223,7 +223,7 @@ describe('runOpen util', () => {
223223
expect(logMock.warn.mock.calls[0][0]).toMatchInlineSnapshot(
224224
`"Unable to open \\"https://example.com\\" in browser: \\"Google Chrome\\". If you are running in a headless environment, please do not use the --open flag"`
225225
);
226-
expect(opn.mock.calls[0]).toMatchInlineSnapshot(`
226+
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
227227
Array [
228228
"https://example.com",
229229
Object {
@@ -244,7 +244,7 @@ describe('runOpen util', () => {
244244
expect(logMock.warn.mock.calls[0][0]).toMatchInlineSnapshot(
245245
`"Unable to open \\"https://example.com/index.html\\" in browser: \\"Google Chrome\\". If you are running in a headless environment, please do not use the --open flag"`
246246
);
247-
expect(opn.mock.calls[0]).toMatchInlineSnapshot(`
247+
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
248248
Array [
249249
"https://example.com/index.html",
250250
Object {

0 commit comments

Comments
 (0)