webpack/test/configCases/code-generation/use-strict/index.js

27 lines
827 B
JavaScript
Raw Normal View History

2016-12-14 19:03:24 +08:00
"use strict";
it("should include only one use strict per module", function() {
require("./harmony-with-strict");
require("./harmony-without-strict");
require("./harmony-with-strict2");
var fs = require("fs");
var source = fs.readFileSync(__filename, "utf-8");
var regExp = /\"use strict\";?\s*(.*)/g
var match = regExp.exec(source);
var matches = [];
while(match) {
matches.push(match[1]);
match = regExp.exec(source);
}
matches.should.be.eql([
"__webpack_require__.r(__webpack_exports__);",
"it(\"should include only one use strict per module\", function() {",
"__webpack_require__.r(__webpack_exports__);",
"__webpack_require__.r(__webpack_exports__);",
"__webpack_require__.r(__webpack_exports__);",
2017-06-01 21:42:57 +08:00
"/* unused harmony default export */ var _unused_webpack_default_export = (\"a\");",
2016-12-14 19:03:24 +08:00
]);
});