-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove depth limit from chokidar options #1697
Remove depth limit from chokidar options #1697
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1697 +/- ##
==========================================
+ Coverage 83.85% 86.08% +2.22%
==========================================
Files 8 8
Lines 539 539
Branches 162 162
==========================================
+ Hits 452 464 +12
+ Misses 70 62 -8
+ Partials 17 13 -4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but need tests for this
@evilebottnawi Could you give me more directions? |
No need check is browser refreshed, anyway if you do this will be great (example e2e tests https://github.com/webpack/webpack-dev-server/blob/master/test/Client.test.js). Main test is mocking webpack-dev-server/lib/Server.js Line 954 in 21687c3
|
6da3535
to
f2156a3
Compare
@evilebottnawi alright I wrote some code that should work, however I am having some troubles with connecting puppeteer to the server, am I doing something wrong? |
maybe you already have app on 9001 port? Or you we need run test in serial |
@evilebottnawi jest is already being run with the Also no, I don't have anything on the 9001 port, it still gives the error even if I change the port. |
@marcofugaro This test code should be fixed like below. diff --git a/test/ContentBase.test.js b/test/ContentBase.test.js
index 4813372..70b57eb 100644
--- a/test/ContentBase.test.js
+++ b/test/ContentBase.test.js
@@ -20,7 +20,6 @@ const contentBaseOther = path.join(
describe('ContentBase', () => {
let server;
let req;
- afterEach(helper.close);
describe('to directory', () => {
beforeAll((done) => {
@@ -32,15 +31,21 @@ describe('ContentBase', () => {
addEntries(config, options);
server = helper.start(
config,
- {
+ Object.assign({}, options, {
contentBase: contentBasePublic,
watchContentBase: true,
- },
+ }),
done
);
req = request(server.app);
});
it('Request to index', (done) => {
req.get('/').expect(200, /Heyo/, done);
});
@@ -54,7 +59,8 @@ describe('ContentBase', () => {
runBrowser().then(({ page, browser }) => {
// wait for first load
- page.goto('http://localhost:9001').then(() => {
+ page.goto('http://0.0.0.0:9001').then(() => {
+ done(); // TODO: change this
// page reloaded after the first load,
// meaning it watched the file correctly
page.on('load', () => {
@@ -82,6 +88,12 @@ describe('ContentBase', () => {
req = request(server.app);
});
+ afterAll((done) => {
+ helper.close(() => {
+ done();
+ });
+ });
+
it('Request to first directory', (done) => {
req.get('/').expect(200, /Heyo/, done);
});
@@ -103,6 +115,12 @@ describe('ContentBase', () => {
req = request(server.app);
});
+ afterAll((done) => {
+ helper.close(() => {
+ done();
+ });
+ });
+
it('Request to page', (done) => {
req
.get('/other.html')
@@ -123,6 +141,12 @@ describe('ContentBase', () => {
req = request(server.app);
});
+ afterAll((done) => {
+ helper.close(() => {
+ done();
+ });
+ });
+
it('Request to page', (done) => {
req
.get('/foo.html')
@@ -147,6 +171,12 @@ describe('ContentBase', () => {
req = request(server.app);
});
+ afterAll((done) => {
+ helper.close(() => {
+ done();
+ });
+ });
+
it('Request to page', (done) => {
req.get('/other.html').expect(200, done);
});
@@ -167,6 +197,12 @@ describe('ContentBase', () => {
req = request(server.app);
});
+ afterAll((done) => {
+ helper.close(() => {
+ done();
+ });
+ });
+
it('Request to page', (done) => {
req.get('/other.html').expect(404, done);
});
@@ -184,6 +220,12 @@ describe('ContentBase', () => {
req = request(server.app);
});
+ afterAll((done) => {
+ helper.close(() => {
+ done();
+ });
+ });
+
it('Request foo.wasm', (done) => {
req.get('/foo.wasm').expect('Content-Type', 'application/wasm', done);
});
|
Thank you @hiroppy that fixed my problem, however i could not get Now the test works @evilebottnawi! |
This reverts commit cbf11ab.
15ee190
to
aabc562
Compare
/cc @evilebottnawi PTAL |
Motivation / Use-Case
The
watchContentBase
option would only watch only the root folder, this PR removes that limitation.Discussion in #1694
The
watchContentBase
option will now watch the folder recursively