Skip to content
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

test: enum in ts #97

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 58 additions & 2 deletions test/__snapshots__/loader.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,25 @@ exports[`Webpack 4 Loader ts 1`] = `
/*!***************!*\\\\
!*** /foo.ts ***!
\\\\***************/
/*! exports provided: foo */
/*! exports provided: a, b, foo */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"a\\", function() { return a; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"b\\", function() { return b; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"foo\\", function() { return foo; });
var BasicEnum;
(function(BasicEnum2) {
BasicEnum2[BasicEnum2[\\"Left\\"] = 0] = \\"Left\\";
BasicEnum2[BasicEnum2[\\"Right\\"] = 1] = \\"Right\\";
})(BasicEnum || (BasicEnum = {}));
var NamedEnum;
(function(NamedEnum2) {
NamedEnum2[\\"SomeEnum\\"] = \\"some-value\\";
})(NamedEnum || (NamedEnum = {}));
const a = 0;
const b = NamedEnum.SomeEnum;
function foo() {
return \\"foo\\";
}
Expand Down Expand Up @@ -494,12 +507,25 @@ exports[`Webpack 4 Loader ts as tsx 1`] = `
/*!***************!*\\\\
!*** /foo.ts ***!
\\\\***************/
/*! exports provided: foo */
/*! exports provided: a, b, foo */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"a\\", function() { return a; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"b\\", function() { return b; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"foo\\", function() { return foo; });
var BasicEnum;
(function(BasicEnum2) {
BasicEnum2[BasicEnum2[\\"Left\\"] = 0] = \\"Left\\";
BasicEnum2[BasicEnum2[\\"Right\\"] = 1] = \\"Right\\";
})(BasicEnum || (BasicEnum = {}));
var NamedEnum;
(function(NamedEnum2) {
NamedEnum2[\\"SomeEnum\\"] = \\"some-value\\";
})(NamedEnum || (NamedEnum = {}));
const a = 0;
const b = NamedEnum.SomeEnum;
function foo() {
return \\"foo\\";
}
Expand Down Expand Up @@ -2650,15 +2676,30 @@ __webpack_require__.r(__webpack_exports__);
!*** ./foo.ts ***!
\\\\****************/
/*! namespace exports */
/*! export a [provided] [no usage info] [missing usage info prevents renaming] */
/*! export b [provided] [no usage info] [missing usage info prevents renaming] */
/*! export foo [provided] [no usage info] [missing usage info prevents renaming] */
/*! other exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ \\"a\\": () => /* binding */ a,
/* harmony export */ \\"b\\": () => /* binding */ b,
/* harmony export */ \\"foo\\": () => /* binding */ foo
/* harmony export */ });
var BasicEnum;
(function(BasicEnum2) {
BasicEnum2[BasicEnum2[\\"Left\\"] = 0] = \\"Left\\";
BasicEnum2[BasicEnum2[\\"Right\\"] = 1] = \\"Right\\";
})(BasicEnum || (BasicEnum = {}));
var NamedEnum;
(function(NamedEnum2) {
NamedEnum2[\\"SomeEnum\\"] = \\"some-value\\";
})(NamedEnum || (NamedEnum = {}));
const a = 0;
const b = NamedEnum.SomeEnum;
function foo() {
return \\"foo\\";
}
Expand Down Expand Up @@ -2768,15 +2809,30 @@ __webpack_require__.r(__webpack_exports__);
!*** ./foo.ts ***!
\\\\****************/
/*! namespace exports */
/*! export a [provided] [no usage info] [missing usage info prevents renaming] */
/*! export b [provided] [no usage info] [missing usage info prevents renaming] */
/*! export foo [provided] [no usage info] [missing usage info prevents renaming] */
/*! other exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ \\"a\\": () => /* binding */ a,
/* harmony export */ \\"b\\": () => /* binding */ b,
/* harmony export */ \\"foo\\": () => /* binding */ foo
/* harmony export */ });
var BasicEnum;
(function(BasicEnum2) {
BasicEnum2[BasicEnum2[\\"Left\\"] = 0] = \\"Left\\";
BasicEnum2[BasicEnum2[\\"Right\\"] = 1] = \\"Right\\";
})(BasicEnum || (BasicEnum = {}));
var NamedEnum;
(function(NamedEnum2) {
NamedEnum2[\\"SomeEnum\\"] = \\"some-value\\";
})(NamedEnum || (NamedEnum = {}));
const a = 0;
const b = NamedEnum.SomeEnum;
function foo() {
return \\"foo\\";
}
Expand Down
13 changes: 13 additions & 0 deletions test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ const ts = {

declare module 'foo' {}

enum BasicEnum {
Left,
Right,
}

enum NamedEnum {
SomeEnum = 'some-value',
}

export const a = BasicEnum.Left;

export const b = NamedEnum.SomeEnum;

export function foo(): string {
return 'foo'
}
Expand Down