Skip to content

Commit 8bd7870

Browse files
committed
fix(server): revert #1794
related #1934
1 parent 53f4253 commit 8bd7870

File tree

3 files changed

+2
-75
lines changed

3 files changed

+2
-75
lines changed

lib/Server.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,8 @@ class Server {
105105
if (!this.options.watchOptions) {
106106
this.options.watchOptions = {};
107107
}
108-
// Ignoring node_modules folder by default
109-
this.options.watchOptions.ignored = this.options.watchOptions.ignored || [
110-
/node_modules/,
111-
];
112-
this.watchOptions = this.options.watchOptions;
108+
109+
this.watchOptions = options.watchOptions || {};
113110

114111
// Replace leading and trailing slashes to normalize path
115112
this.sockPath = `/${

test/ContentBase.test.js

-70
Original file line numberDiff line numberDiff line change
@@ -63,76 +63,6 @@ describe('ContentBase', () => {
6363
});
6464
});
6565

66-
describe('test ignoring node_modules folder by Default', () => {
67-
beforeAll((done) => {
68-
server = testServer.start(config, {
69-
contentBase: contentBasePublic,
70-
watchContentBase: true,
71-
});
72-
// making sure that chokidar has read all the files
73-
server.contentBaseWatchers[0].on('ready', () => {
74-
done();
75-
});
76-
req = request(server.app);
77-
});
78-
79-
afterAll((done) => {
80-
testServer.close(() => {
81-
done();
82-
});
83-
});
84-
85-
it('Should ignore node_modules & watch bar', (done) => {
86-
const watchedPaths = server.contentBaseWatchers[0].getWatched();
87-
// check if node_modules folder is not in watched list
88-
const folderWatched = !!watchedPaths[
89-
path.join(contentBasePublic, 'node_modules')
90-
];
91-
expect(folderWatched).toEqual(false);
92-
// check if bar folder is in watched list
93-
expect(watchedPaths[path.join(contentBasePublic, 'bar')]).toEqual([
94-
'index.html',
95-
]);
96-
97-
done();
98-
});
99-
});
100-
101-
describe('test not ignoring node_modules folder', () => {
102-
beforeAll((done) => {
103-
server = testServer.start(config, {
104-
contentBase: contentBasePublic,
105-
watchContentBase: true,
106-
watchOptions: {
107-
ignored: /bar/,
108-
},
109-
});
110-
// making sure that chokidar has read all the files
111-
server.contentBaseWatchers[0].on('ready', () => {
112-
done();
113-
});
114-
req = request(server.app);
115-
});
116-
117-
afterAll((done) => {
118-
testServer.close(() => {
119-
done();
120-
});
121-
});
122-
123-
it('Should watch node_modules & ignore bar', (done) => {
124-
const watchedPaths = server.contentBaseWatchers[0].getWatched();
125-
// check if node_modules folder is in watched list
126-
expect(
127-
watchedPaths[path.join(contentBasePublic, 'node_modules')]
128-
).toEqual(['index.html']);
129-
// check if bar folder is not in watched list
130-
const folderWatched = !!watchedPaths[path.join(contentBasePublic, 'bar')];
131-
expect(folderWatched).toEqual(false);
132-
done();
133-
});
134-
});
135-
13666
describe('test listing files in folders without index.html using the option serveIndex:false', () => {
13767
beforeAll((done) => {
13868
server = testServer.start(

test/fixtures/contentbase-config/public/node_modules/index.html

Whitespace-only changes.

0 commit comments

Comments
 (0)