Skip to content
This repository has been archived by the owner on Sep 10, 2023. It is now read-only.

Commit

Permalink
feat: support new.target in arrow function
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Mar 29, 2018
1 parent 6ab8f3c commit 731ddcd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/es2015/arrow-function/new.target.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import test from "ava";
import vm from "../../../src/vm";

test("new target with new", t => {
const sandbox: any = vm.createContext({});

const { Person, target } = vm.runInContext(
`
var target;
function Person(name){
return (() => {
target = new.target;
return target;
})();
}
new Person();
module.exports = {target: target, Person: Person};
`,
sandbox
);

t.true(target === Person);
});

0 comments on commit 731ddcd

Please sign in to comment.