Skip to content

Commit

Permalink
Merge pull request #1824 from loadimpact/dropCoreJS
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov authored Feb 2, 2021
2 parents 5619259 + 10cb583 commit 96ffb48
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 162 deletions.
7 changes: 0 additions & 7 deletions js/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (

"github.com/loadimpact/k6/js/common"
"github.com/loadimpact/k6/js/compiler"
jslib "github.com/loadimpact/k6/js/lib"
"github.com/loadimpact/k6/lib"
"github.com/loadimpact/k6/lib/consts"
"github.com/loadimpact/k6/loader"
Expand Down Expand Up @@ -282,12 +281,6 @@ func (b *Bundle) instantiate(logger logrus.FieldLogger, rt *goja.Runtime, init *
rt.SetFieldNameMapper(common.FieldNameMapper{})
rt.SetRandSource(common.NewRandSource())

if init.compatibilityMode == lib.CompatibilityModeExtended {
if _, err := rt.RunProgram(jslib.GetCoreJS()); err != nil {
return err
}
}

exports := rt.NewObject()
rt.Set("exports", exports)
module := rt.NewObject()
Expand Down
13 changes: 2 additions & 11 deletions js/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,6 @@ func TestNewBundle(t *testing.T) {
}
})
t.Run("CompatibilityMode", func(t *testing.T) {
t.Run("Extended/ok/CoreJS", func(t *testing.T) {
rtOpts := lib.RuntimeOptions{
CompatibilityMode: null.StringFrom(lib.CompatibilityModeExtended.String()),
}
_, err := getSimpleBundle(t, "/script.js",
`module.exports.default = function() {}; new Promise(function(resolve, reject){});`, rtOpts)

assert.NoError(t, err)
})
t.Run("Base/ok/Minimal", func(t *testing.T) {
rtOpts := lib.RuntimeOptions{
CompatibilityMode: null.StringFrom(lib.CompatibilityModeBase.String()),
Expand Down Expand Up @@ -153,9 +144,9 @@ func TestNewBundle(t *testing.T) {
`module.exports.default = function() {}; () => {};`,
"file:///script.js: Line 1:42 Unexpected token ) (and 1 more errors)",
},
// some ES2015 objects polyfilled by core.js are not supported
// Promises are not supported
{
"CoreJS", "base",
"Promise", "base",
`module.exports.default = function() {}; new Promise(function(resolve, reject){});`,
"ReferenceError: Promise is not defined at file:///script.js:1:45(5)",
},
Expand Down
10 changes: 0 additions & 10 deletions js/lib/core-js/shim.min.js

This file was deleted.

55 changes: 0 additions & 55 deletions js/lib/lib.go

This file was deleted.

41 changes: 0 additions & 41 deletions js/lib/rice-box.go

This file was deleted.

96 changes: 62 additions & 34 deletions js/tc39/breaking_test_errors.json

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions js/tc39/tc39_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/dop251/goja"
"github.com/dop251/goja/parser"
"github.com/loadimpact/k6/js/compiler"
jslib "github.com/loadimpact/k6/js/lib"
"github.com/loadimpact/k6/lib"
"github.com/loadimpact/k6/lib/testutils"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -254,9 +253,6 @@ func (ctx *tc39TestCtx) runTC39Test(t testing.TB, name, src string, meta *tc39Me
})
vm.Set("$262", _262)
vm.Set("print", t.Log)
if _, err := vm.RunProgram(jslib.GetCoreJS()); err != nil {
panic(err)
}
_, err := vm.RunProgram(sabStub)
if err != nil {
panic(err)
Expand Down

0 comments on commit 96ffb48

Please sign in to comment.