-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mock packages for commonjs/esmodule tests
- Loading branch information
Showing
7 changed files
with
70 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,3 @@ npm-debug.log | |
package-lock.json | ||
tmp | ||
.idea | ||
tests/**/*.js |
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
10 changes: 9 additions & 1 deletion
10
tests/integration-latest/src/exports/commonjs-tester.spec.ts
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 |
---|---|---|
@@ -1,10 +1,18 @@ | ||
import A from "./commonjs-a" | ||
import A2 from "kt-commonjs-a"; | ||
|
||
describe("CommonJS", () => { | ||
|
||
it("should extend class", () => { | ||
it("should extend class B, Typescript", () => { | ||
|
||
const a = new A(); | ||
expect(A.name).toEqual("A"); | ||
expect(a.hello()).toEqual("Hello from A! Hello from B!"); | ||
}); | ||
|
||
it("should extend class B, commonjs", () => { | ||
|
||
expect(A2.name).toEqual("A"); | ||
expect(new (A2 as any)().hello()).toEqual("Hello from A! Hello from B!"); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
tests/integration-latest/src/exports/kt-commonjs-a/index.js
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,30 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) | ||
if (b.hasOwnProperty(p)) | ||
d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
// tslint:disable-next-line:no-var-requires | ||
var B = require("kt-commonjs-b"); | ||
var A = /** @class */ (function (_super) { | ||
__extends(A, _super); | ||
function A() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
A.prototype.hello = function () { | ||
return "Hello from A! " + _super.prototype.hello.call(this); | ||
}; | ||
return A; | ||
}(B)); | ||
module.exports = A; |
10 changes: 10 additions & 0 deletions
10
tests/integration-latest/src/exports/kt-commonjs-a/package.json
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,10 @@ | ||
{ | ||
"name": "kt-commonjs-a", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"author": "", | ||
"license": "MIT", | ||
"private": true | ||
} | ||
|
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,9 @@ | ||
var B = /** @class */ (function () { | ||
function B() { | ||
} | ||
B.prototype.hello = function () { | ||
return "Hello from B!"; | ||
}; | ||
return B; | ||
}()); | ||
module.exports = B; |
10 changes: 10 additions & 0 deletions
10
tests/integration-latest/src/exports/kt-commonjs-b/package.json
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,10 @@ | ||
{ | ||
"name": "kt-commonjs-b", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"author": "", | ||
"license": "MIT", | ||
"private": true | ||
} | ||
|