-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(serve-static): Added option
serveStatic
to allow proxy/snippet…
… mode to easily serve local files
- Loading branch information
1 parent
ec57fcf
commit 0e60a7c
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"use strict"; | ||
|
||
var browserSync = require("../../../index"); | ||
|
||
var request = require("supertest"); | ||
var assert = require("chai").assert; | ||
var page = require("fs").readFileSync("test/fixtures/index.html", "utf-8"); | ||
|
||
describe("E2E `serveStatic` option", function () { | ||
|
||
var bs; | ||
|
||
before(function (done) { | ||
browserSync.reset(); | ||
var config = { | ||
logLevel: "silent", | ||
online: false, | ||
serveStatic: ["test/fixtures"] | ||
}; | ||
bs = browserSync(config, done).instance; | ||
}); | ||
|
||
after(function () { | ||
bs.cleanup(); | ||
}); | ||
|
||
it("can serve static files regardless of running mode", function (done) { | ||
request(bs.server) | ||
.get("/index.html") | ||
.expect(200) | ||
.end(function (err, res) { | ||
assert.equal(res.text, page); | ||
done(); | ||
}); | ||
}); | ||
}); |