Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Nov 20, 2020
1 parent fedce73 commit 1d0812c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions js/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,17 @@ func TestNewBundle(t *testing.T) {
}
})
t.Run("CompatibilityMode", func(t *testing.T) {
compatibilityTestSrc := `
module.exports.default = function() {};
if ([[1,2],[3,4]].flatten()[4] == 4) {
throw Error("Array.flatten doesn't work")
}
`
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)
_, err := getSimpleBundle(t, "/script.js", compatibilityTestSrc, rtOpts)

assert.NoError(t, err)
})
Expand Down Expand Up @@ -156,8 +161,8 @@ func TestNewBundle(t *testing.T) {
// some ES2015 objects polyfilled by core.js are not supported
{
"CoreJS", "base",
`module.exports.default = function() {}; new Promise(function(resolve, reject){});`,
"ReferenceError: Promise is not defined at file:///script.js:1:45(5)",
compatibilityTestSrc,
"TypeError: Object has no member 'flatten' at file:///script.js:3:28(14)",
},
}

Expand Down

0 comments on commit 1d0812c

Please sign in to comment.