Skip to content

Commit

Permalink
fix: polling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed May 31, 2021
1 parent ac61c7c commit 152ebb5
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 169 deletions.
150 changes: 66 additions & 84 deletions test/server/__snapshots__/watchFiles-option.test.js.snap.webpack4
Original file line number Diff line number Diff line change
@@ -1,103 +1,85 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`'watchFiles' option should work with options {"poll":200} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": 200,
"persistent": true,
"usePolling": true,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": 200,
"persistent": true,
"usePolling": true,
}
`;

exports[`'watchFiles' option should work with options {"poll":true} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": true,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": true,
}
`;

exports[`'watchFiles' option should work with options {"usePolling":false,"poll":true} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": false,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": false,
}
`;

exports[`'watchFiles' option should work with options {"usePolling":false} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": false,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": false,
}
`;

exports[`'watchFiles' option should work with options {"usePolling":true,"interval":200,"poll":400} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": 200,
"persistent": true,
"usePolling": true,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": 200,
"persistent": true,
"usePolling": true,
}
`;

exports[`'watchFiles' option should work with options {"usePolling":true} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": true,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": true,
}
`;
150 changes: 66 additions & 84 deletions test/server/__snapshots__/watchFiles-option.test.js.snap.webpack5
Original file line number Diff line number Diff line change
@@ -1,103 +1,85 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`'watchFiles' option should work with options {"poll":200} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": 200,
"persistent": true,
"usePolling": true,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": 200,
"persistent": true,
"usePolling": true,
}
`;

exports[`'watchFiles' option should work with options {"poll":true} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": true,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": true,
}
`;

exports[`'watchFiles' option should work with options {"usePolling":false,"poll":true} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": false,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": false,
}
`;

exports[`'watchFiles' option should work with options {"usePolling":false} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": false,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": false,
}
`;

exports[`'watchFiles' option should work with options {"usePolling":true,"interval":200,"poll":400} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": 200,
"persistent": true,
"usePolling": true,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": 200,
"persistent": true,
"usePolling": true,
}
`;

exports[`'watchFiles' option should work with options {"usePolling":true} should pass correct options to chokidar config 1`] = `
Array [
"/Users/anshumanv/Code/GitHub/webpack-dev-server/test/fixtures/contentbase-config/public/assets/example.txt",
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": true,
},
]
Object {
"alwaysStat": true,
"atomic": false,
"followSymlinks": false,
"ignoreInitial": true,
"ignorePermissionErrors": true,
"ignored": undefined,
"interval": undefined,
"persistent": true,
"usePolling": true,
}
`;
2 changes: 1 addition & 1 deletion test/server/watchFiles-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ describe("'watchFiles' option", () => {
});

it('should pass correct options to chokidar config', () => {
expect(chokidarMock.mock.calls[0]).toMatchSnapshot();
expect(chokidarMock.mock.calls[0][1]).toMatchSnapshot();
});

it('should reload on file content changed', (done) => {
Expand Down

0 comments on commit 152ebb5

Please sign in to comment.