From af21b6ffc4dc57550895d5cede76e9c1eda55003 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Fri, 19 Apr 2024 12:37:12 +0300 Subject: [PATCH] Drop legacy require support --- js/bundle.go | 46 +++++- js/modules/require_impl.go | 154 ------------------ js/modules/resolution.go | 46 +++++- js/modulestest/runtime.go | 4 +- js/path_resolution_test.go | 87 ++++++++-- ...ing_test_errors-experimental_enhanced.json | 26 +-- js/tc39/breaking_test_errors-extended.json | 34 ++-- js/tc39/tc39_test.go | 6 +- 8 files changed, 173 insertions(+), 230 deletions(-) delete mode 100644 js/modules/require_impl.go diff --git a/js/bundle.go b/js/bundle.go index 481b24f4180..85c4a3bff78 100644 --- a/js/bundle.go +++ b/js/bundle.go @@ -280,6 +280,7 @@ func (b *Bundle) instantiate(vuImpl *moduleVUImpl, vuID uint64) (*goja.Object, e FileSystems: b.filesystems, CWD: b.pwd, } + vuImpl.initEnv = initenv modSys := modules.NewModuleSystem(b.ModuleResolver, vuImpl) b.setInitGlobals(rt, vuImpl, modSys) @@ -369,17 +370,40 @@ func (b *Bundle) setupJSRuntime(rt *goja.Runtime, vuID int64, logger logrus.Fiel return nil } -// this exists only to make the check in the init context. +// this exists to support `open` current behaviour and to check init context conformity type requireImpl struct { - inInitContext func() bool - internal *modules.LegacyRequireImpl + vu *moduleVUImpl + modSys *modules.ModuleSystem } func (r *requireImpl) require(specifier string) (*goja.Object, error) { - if !r.inInitContext() { + if r.vu.state != nil { return nil, fmt.Errorf(cantBeUsedOutsideInitContextMsg, "require") } - return r.internal.Require(specifier) + return r.modSys.Require(specifier) +} + +// getPreviousRequiringFile is a helper that is currently need for the implemnetation of `open`. +// it depends on the `require` method above +func (r *requireImpl) getPreviousRequiringFile() (*url.URL, error) { + var buf [1000]goja.StackFrame + + frames := r.vu.Runtime().CaptureCallStack(1000, buf[:0]) + + for i, frame := range frames[1:] { // first one should be the current require + // TODO have this precalculated automatically + if frame.FuncName() == "go.k6.io/k6/js.(*requireImpl).require-fm" { + // we need to get the one *before* but as we skip the first one the index matches ;) + return url.Parse(frames[i].SrcName()) + } + } + // hopefully nobody is calling `require` with 1000 big stack :crossedfingers: + if len(frames) == 1000 { + return nil, errors.New("stack too big") + } + + // fallback + return url.Parse(frames[len(frames)-1].SrcName()) } func (b *Bundle) setInitGlobals(rt *goja.Runtime, vu *moduleVUImpl, modSys *modules.ModuleSystem) { @@ -390,8 +414,8 @@ func (b *Bundle) setInitGlobals(rt *goja.Runtime, vu *moduleVUImpl, modSys *modu } impl := requireImpl{ - inInitContext: func() bool { return vu.state == nil }, - internal: modules.NewLegacyRequireImpl(vu, modSys, *b.pwd), + vu: vu, + modSys: modSys, } mustSet("require", impl.require) @@ -406,8 +430,12 @@ func (b *Bundle) setInitGlobals(rt *goja.Runtime, vu *moduleVUImpl, modSys *modu return nil, errors.New("open() can't be used with an empty filename") } // This uses the pwd from the requireImpl - pwd := impl.internal.CurrentlyRequiredModule() - return openImpl(rt, b.filesystems["file"], &pwd, filename, args...) + requiringFile, err := impl.getPreviousRequiringFile() + if err != nil { + return nil, err // TODO:wrap + } + pwd := loader.Dir(requiringFile) + return openImpl(rt, b.filesystems["file"], pwd, filename, args...) }) } diff --git a/js/modules/require_impl.go b/js/modules/require_impl.go deleted file mode 100644 index 0f0833eaaac..00000000000 --- a/js/modules/require_impl.go +++ /dev/null @@ -1,154 +0,0 @@ -package modules - -import ( - "errors" - "net/url" - "strings" - - "github.com/dop251/goja" - "go.k6.io/k6/loader" -) - -// LegacyRequireImpl is a legacy implementation of `require()` that is not compatible with -// CommonJS as it loads modules relative to the currently required file, -// instead of relative to the file the `require()` is written in. -// See https://github.com/grafana/k6/issues/2674 -type LegacyRequireImpl struct { - vu VU - modules *ModuleSystem - currentlyRequiredModule *url.URL -} - -// NewLegacyRequireImpl creates a new LegacyRequireImpl -func NewLegacyRequireImpl(vu VU, ms *ModuleSystem, pwd url.URL) *LegacyRequireImpl { - return &LegacyRequireImpl{ - vu: vu, - modules: ms, - currentlyRequiredModule: &pwd, - } -} - -const issueLink = "https://github.com/grafana/k6/issues/3534" - -// Require is the actual call that implements require -func (r *LegacyRequireImpl) Require(specifier string) (*goja.Object, error) { - // TODO remove this in the future when we address https://github.com/grafana/k6/issues/2674 - // This is currently needed as each time require is called we need to record it's new pwd - // to be used if a require *or* open is used within the file as they are relative to the - // latest call to require. - // - // This is *not* the actual require behaviour defined in commonJS as it is actually always relative - // to the file it is in. This is unlikely to be an issue but this code is here to keep backwards - // compatibility *for now*. - // - // With native ESM this won't even be possible as `require` might not be called - instead an import - // might be used in which case we won't be able to be doing this hack. In that case we either will - // need some goja specific helper or to use stack traces as goja_nodejs does. - currentPWD := r.currentlyRequiredModule - if specifier != "k6" && !strings.HasPrefix(specifier, "k6/") { - defer func() { - r.currentlyRequiredModule = currentPWD - }() - // In theory we can give that downwards, but this makes the code more tightly coupled - // plus as explained above this will be removed in the future so the code reflects more - // closely what will be needed then - if !r.modules.resolver.locked { - r.warnUserOnPathResolutionDifferences(specifier) - } - fileURL, err := loader.Resolve(r.currentlyRequiredModule, specifier) - if err != nil { - return nil, err - } - r.currentlyRequiredModule = loader.Dir(fileURL) - } - - if specifier == "" { - return nil, errors.New("require() can't be used with an empty specifier") - } - - return r.modules.Require(currentPWD, specifier) -} - -// CurrentlyRequiredModule returns the module that is currently being required. -// It is mostly used for old and somewhat buggy behaviour of the `open` call -func (r *LegacyRequireImpl) CurrentlyRequiredModule() url.URL { - return *r.currentlyRequiredModule -} - -func (r *LegacyRequireImpl) warnUserOnPathResolutionDifferences(specifier string) { - normalizePathToURL := func(path string) (*url.URL, error) { - u, err := url.Parse(path) - if err != nil { - return nil, err - } - return loader.Dir(u), nil - } - // Warn users on their require depending on the none standard k6 behaviour. - rt := r.vu.Runtime() - logger := r.vu.InitEnv().Logger - correct, err := normalizePathToURL(getCurrentModuleScript(rt)) - if err != nil { - logger.Warningf("Couldn't get the \"correct\" path to resolve specifier %q against: %q"+ - "Please report to issue %s. "+ - "This will not currently break your script but it might mean that in the future it won't work", - specifier, err, issueLink) - } else if r.currentlyRequiredModule.String() != correct.String() { - logger.Warningf("The \"wrong\" path (%q) and the path actually used by k6 (%q) to resolve %q are different. "+ - "Please report to issue %s. "+ - "This will not currently break your script but *WILL* in the future, please report this!!!", - correct, r.currentlyRequiredModule, specifier, issueLink) - } - - k6behaviourString, err := getPreviousRequiringFile(rt) - if err != nil { - logger.Warningf("Couldn't get the \"wrong\" path to resolve specifier %q against: %q"+ - "Please report to issue %s. "+ - "This will not currently break your script but it might mean that in the future it won't work", - specifier, err, issueLink) - return - } - k6behaviour, err := normalizePathToURL(k6behaviourString) - if err != nil { - logger.Warningf("Couldn't get the \"wrong\" path to resolve specifier %q against: %q"+ - "Please report to issue %s. "+ - "This will not currently break your script but it might mean that in the future it won't work", - specifier, err, issueLink) - return - } - if r.currentlyRequiredModule.String() != k6behaviour.String() { - // this should always be equal, but check anyway to be certain we won't break something - logger.Warningf("The \"wrong\" path (%q) and the path actually used by k6 (%q) to resolve %q are different. "+ - "Please report to issue %s. "+ - "This will not currently break your script but it might mean that in the future it won't work", - k6behaviour, r.currentlyRequiredModule, specifier, issueLink) - } -} - -func getCurrentModuleScript(rt *goja.Runtime) string { - var parent string - var buf [2]goja.StackFrame - frames := rt.CaptureCallStack(2, buf[:0]) - parent = frames[1].SrcName() - - return parent -} - -func getPreviousRequiringFile(rt *goja.Runtime) (string, error) { - var buf [1000]goja.StackFrame - frames := rt.CaptureCallStack(1000, buf[:0]) - - for i, frame := range frames[1:] { // first one should be the current require - // TODO have this precalculated automatically - if frame.FuncName() == "go.k6.io/k6/js.(*requireImpl).require-fm" { - // we need to get the one *before* but as we skip the first one the index matches ;) - return frames[i].SrcName(), nil - } - } - // hopefully nobody is calling `require` with 1000 big stack :crossedfingers: - if len(frames) == 1000 { - return "", errors.New("stack too big") - } - - // fallback - return frames[len(frames)-1].SrcName(), nil -} diff --git a/js/modules/resolution.go b/js/modules/resolution.go index bc7efa34710..4007a80178e 100644 --- a/js/modules/resolution.go +++ b/js/modules/resolution.go @@ -1,6 +1,7 @@ package modules import ( + "errors" "fmt" "net/url" "strings" @@ -150,6 +151,7 @@ type ModuleSystem struct { vu VU instanceCache map[module]moduleInstance resolver *ModuleResolver + backupCWD *url.URL } // NewModuleSystem returns a new ModuleSystem for the provide VU using the provided resoluter @@ -158,28 +160,59 @@ func NewModuleSystem(resolver *ModuleResolver, vu VU) *ModuleSystem { resolver: resolver, instanceCache: make(map[module]moduleInstance), vu: vu, + backupCWD: vu.InitEnv().CWD, } } // Require is called when a module/file needs to be loaded by a script -func (ms *ModuleSystem) Require(pwd *url.URL, arg string) (*goja.Object, error) { - mod, err := ms.resolver.resolve(pwd, arg) +func (ms *ModuleSystem) Require(specifier string) (*goja.Object, error) { + if specifier == "" { + return nil, errors.New("require() can't be used with an empty specifier") + } + + currentModuleURL, err := ms.getCurrentModuleScript() + if err != nil { + return nil, err + } + + dir := loader.Dir(currentModuleURL) + if currentModuleURL.String() == "file://-" { + dir = ms.backupCWD + } + + mod, err := ms.resolver.resolve(dir, specifier) if err != nil { return nil, err } + return ms.instantiate(mod) +} + +// Require is called when a module/file needs to be loaded by a script +func (ms *ModuleSystem) instantiate(mod module) (*goja.Object, error) { if instance, ok := ms.instanceCache[mod]; ok { return instance.exports(), nil } instance := mod.instantiate(ms.vu) ms.instanceCache[mod] = instance - if err = instance.execute(); err != nil { + if err := instance.execute(); err != nil { return nil, err } return instance.exports(), nil } +func (ms *ModuleSystem) getCurrentModuleScript() (*url.URL, error) { + var parent string + var buf [2]goja.StackFrame + frames := ms.vu.Runtime().CaptureCallStack(2, buf[:0]) + if len(frames) == 0 { + return &url.URL{Scheme: "file", Path: "/-"}, nil + } + parent = frames[1].SrcName() + return url.Parse(parent) +} + // RunSourceData runs the provided sourceData and adds it to the cache. // If a module with the same specifier as the source is already cached // it will be used instead of reevaluating the source from the provided SourceData. @@ -189,16 +222,17 @@ func (ms *ModuleSystem) Require(pwd *url.URL, arg string) (*goja.Object, error) func (ms *ModuleSystem) RunSourceData(source *loader.SourceData) (goja.Value, error) { specifier := source.URL.String() pwd := source.URL.JoinPath("../") - if _, err := ms.resolver.resolveLoaded(pwd, specifier, source.Data); err != nil { + mod, err := ms.resolver.resolveLoaded(pwd, specifier, source.Data) + if err != nil { return nil, err // TODO wrap as this should never happen } - return ms.Require(pwd, specifier) + return ms.instantiate(mod) } // ExportGloballyModule sets all exports of the provided module name on the globalThis. // effectively making them globally available func ExportGloballyModule(rt *goja.Runtime, modSys *ModuleSystem, moduleName string) { - t, _ := modSys.Require(nil, moduleName) + t, _ := modSys.Require(moduleName) for _, key := range t.Keys() { if err := rt.Set(key, t.Get(key)); err != nil { diff --git a/js/modulestest/runtime.go b/js/modulestest/runtime.go index 6ed91e72d57..6b791d45e34 100644 --- a/js/modulestest/runtime.go +++ b/js/modulestest/runtime.go @@ -3,7 +3,6 @@ package modulestest import ( "context" - "net/url" "testing" "github.com/dop251/goja" @@ -113,7 +112,6 @@ func (r *Runtime) RunOnEventLoop(code string) (value goja.Value, err error) { func (r *Runtime) innerSetupModuleSystem() error { ms := modules.NewModuleSystem(r.mr, r.VU) - impl := modules.NewLegacyRequireImpl(r.VU, ms, url.URL{}) modules.ExportGloballyModule(r.VU.RuntimeField, ms, "k6/timers") - return r.VU.RuntimeField.Set("require", impl.Require) + return r.VU.RuntimeField.Set("require", ms.Require) } diff --git a/js/path_resolution_test.go b/js/path_resolution_test.go index 6b6f01a89d2..52ff102dae5 100644 --- a/js/path_resolution_test.go +++ b/js/path_resolution_test.go @@ -86,8 +86,9 @@ func TestOpenPathResolution(t *testing.T) { func TestRequirePathResolution(t *testing.T) { t.Parallel() testCases := map[string]struct { - fsMap map[string]any - expectedLogs []string + fsMap map[string]any + expectedLogs []string + expectedError string }{ "simple": { fsMap: map[string]any{ @@ -120,8 +121,7 @@ func TestRequirePathResolution(t *testing.T) { fsMap: map[string]any{ "/A/B/data.js": "module.exports='export content'", "/A/C/B/script.js": ` - // Here the path is relative to this module but to the one calling - module.exports = () => require("./../data.js"); + module.exports = () => require("./../../B/data.js"); `, "/A/B/B/script.js": ` module.exports = require("./../../C/B/script.js")(); @@ -134,17 +134,33 @@ func TestRequirePathResolution(t *testing.T) { export default function() {} `, }, - expectedLogs: []string{ - `The "wrong" path ("file:///A/C/B/") and the path actually used by k6 ("file:///A/B/B/") to resolve "./../data.js" are different`, + }, + "complex wrong": { + fsMap: map[string]any{ + "/A/B/data.js": "module.exports='export content'", + "/A/C/B/script.js": ` + module.exports = () => require("./../data.js"); + `, + "/A/B/B/script.js": ` + module.exports = require("./../../C/B/script.js")(); + `, + "/A/A/A/A/script.js": ` + let data = require("./../../../B/B/script.js"); + if (data != "export content") { + throw new Error("wrong content " + data); + } + export default function() {} + `, }, + expectedError: `The moduleSpecifier "./../data.js" couldn't be found on local disk.`, }, "ESM and require": { fsMap: map[string]any{ "/A/B/data.js": "module.exports='export content'", "/A/C/B/script.js": ` export default function () { - // Here the path is relative to this module but to the one calling - return require("./../data.js"); + // Here the path is relative to this module not the calling one + return require("./../../B/data.js"); } `, "/A/B/B/script.js": ` @@ -159,17 +175,36 @@ func TestRequirePathResolution(t *testing.T) { export default function() {} `, }, - expectedLogs: []string{ - `The "wrong" path ("file:///A/C/B/") and the path actually used by k6 ("file:///A/B/B/") to resolve "./../data.js" are different`, + }, + "ESM and require wrong": { + fsMap: map[string]any{ + "/A/B/data.js": "module.exports='export content'", + "/A/C/B/script.js": ` + export default function () { + return require("./../data.js"); + } + `, + "/A/B/B/script.js": ` + import s from "./../../C/B/script.js" + export default require("./../../C/B/script.js").default(); + `, + "/A/A/A/A/script.js": ` + import data from "./../../../B/B/script.js" + if (data != "export content") { + throw new Error("wrong content " + data); + } + export default function() {} + `, }, + expectedError: `The moduleSpecifier "./../data.js" couldn't be found on local disk.`, }, "full ESM": { fsMap: map[string]any{ "/A/B/data.js": "export default 'export content'", "/A/C/B/script.js": ` export default function () { - // Here the path is relative to this module but to the one calling - return require("./../data.js").default; + // Here the path is relative to this module not the calling one + return require("./../../B/data.js").default; } `, "/A/B/B/script.js": ` @@ -185,9 +220,29 @@ func TestRequirePathResolution(t *testing.T) { export default function() {} `, }, - expectedLogs: []string{ - `The "wrong" path ("file:///A/C/B/") and the path actually used by k6 ("file:///A/B/B/") to resolve "./../data.js" are different`, + }, + "full ESM wrong": { + fsMap: map[string]any{ + "/A/B/data.js": "export default 'export content'", + "/A/C/B/script.js": ` + export default function () { + return require("./../data.js").default; + } + `, + "/A/B/B/script.js": ` + import s from "./../../C/B/script.js" + let l = s(); + export default l; + `, + "/A/A/A/A/script.js": ` + import data from "./../../../B/B/script.js" + if (data != "export content") { + throw new Error("wrong content " + data); + } + export default function() {} + `, }, + expectedError: `The moduleSpecifier "./../data.js" couldn't be found on local disk.`, }, } for name, testCase := range testCases { @@ -201,6 +256,10 @@ func TestRequirePathResolution(t *testing.T) { require.NoError(t, err) logger, hook := testutils.NewLoggerWithHook(t, logrus.WarnLevel) b, err := getSimpleBundle(t, "/main.js", `export { default } from "/A/A/A/A/script.js"`, fs, logger) + if testCase.expectedError != "" { + require.ErrorContains(t, err, testCase.expectedError) + return + } require.NoError(t, err) _, err = b.Instantiate(context.Background(), 0) diff --git a/js/tc39/breaking_test_errors-experimental_enhanced.json b/js/tc39/breaking_test_errors-experimental_enhanced.json index 7cab7aff117..efdc553146f 100644 --- a/js/tc39/breaking_test_errors-experimental_enhanced.json +++ b/js/tc39/breaking_test_errors-experimental_enhanced.json @@ -30,7 +30,7 @@ "test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js-strict:true": "test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js: Test262Error: RegExp(\"(?=.)*\", \"u\"): Expected a SyntaxError to be thrown but no exception was thrown at all ", "test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js-strict:true": "test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js: ReferenceError: BigUint64Array is not defined ", "test/language/comments/hashbang/function-constructor.js-strict:true": "test/language/comments/hashbang/function-constructor.js: SyntaxError: Async generators are not supported yet ", - "test/language/comments/hashbang/module.js-strict:false": "test/language/comments/hashbang/module.js: file://TestTC39/test262/test/language/comments/hashbang/module.js: Line 1:28 Unexpected token ILLEGAL (and 2 more errors)", + "test/language/comments/hashbang/module.js-strict:false": "test/language/comments/hashbang/module.js: file:///TestTC39/test262/test/language/comments/hashbang/module.js: Line 1:28 Unexpected token ILLEGAL (and 2 more errors)", "test/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js-strict:true": "test/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js: SyntaxError: Async generators are not supported yet ", "test/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js-strict:true": "test/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js: SyntaxError: Async generators are not supported yet ", "test/language/expressions/assignment/fn-name-lhs-cover.js-strict:true": "test/language/expressions/assignment/fn-name-lhs-cover.js: Test262Error: descriptor value should be ", @@ -76,17 +76,10 @@ "test/language/module-code/eval-export-dflt-expr-cls-anon.js-strict:true": "test/language/module-code/eval-export-dflt-expr-cls-anon.js: Test262Error: correct name is assigned Expected SameValue(«eval_export_dflt_expr_cls_anon_default», «default») to be true ", "test/language/module-code/eval-export-dflt-expr-fn-anon.js-strict:true": "test/language/module-code/eval-export-dflt-expr-fn-anon.js: Test262Error: correct name is assigned Expected SameValue(«eval_export_dflt_expr_fn_anon_default», «default») to be true ", "test/language/module-code/eval-export-dflt-expr-gen-anon.js-strict:true": "test/language/module-code/eval-export-dflt-expr-gen-anon.js: Test262Error: correct name is assigned Expected SameValue(«eval_export_dflt_expr_gen_anon_default», «default») to be true ", - "test/language/module-code/eval-self-once.js-strict:true": "test/language/module-code/eval-self-once.js: Test262Error: global property initially unset Expected SameValue(«262», «undefined») to be true ", "test/language/module-code/eval-this.js-strict:true": "test/language/module-code/eval-this.js: Test262Error: Expected SameValue(«[object Object]», «undefined») to be true ", "test/language/module-code/export-default-asyncgenerator-declaration-binding.js-strict:true": "test/language/module-code/export-default-asyncgenerator-declaration-binding.js: SyntaxError: Async generators are not supported yet ", "test/language/module-code/export-expname-binding-index.js-strict:true": "test/language/module-code/export-expname-binding-index.js: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all ", "test/language/module-code/export-expname-from-star.js-strict:true": "test/language/module-code/export-expname-from-star.js: Test262Error: Expected SameValue(«undefined», «function Mercury() {\n}») to be true ", - "test/language/module-code/instn-iee-bndng-cls.js-strict:true": "test/language/module-code/instn-iee-bndng-cls.js: Test262Error: binding is created but not initialized Expected a ReferenceError but got a TypeError ", - "test/language/module-code/instn-iee-bndng-const.js-strict:true": "test/language/module-code/instn-iee-bndng-const.js: Test262Error: binding is created but not initialized Expected a ReferenceError but got a TypeError ", - "test/language/module-code/instn-iee-bndng-fun.js-strict:true": "test/language/module-code/instn-iee-bndng-fun.js: TypeError: Cannot read property 'A' of undefined ", - "test/language/module-code/instn-iee-bndng-gen.js-strict:true": "test/language/module-code/instn-iee-bndng-gen.js: TypeError: Cannot read property 'A' of undefined ", - "test/language/module-code/instn-iee-bndng-let.js-strict:true": "test/language/module-code/instn-iee-bndng-let.js: Test262Error: binding is created but not initialized Expected a ReferenceError but got a TypeError ", - "test/language/module-code/instn-iee-bndng-var.js-strict:true": "test/language/module-code/instn-iee-bndng-var.js: TypeError: Cannot read property 'A' of undefined ", "test/language/module-code/instn-iee-err-ambiguous-as.js-strict:true": "test/language/module-code/instn-iee-err-ambiguous-as.js: Expected error: ", "test/language/module-code/instn-iee-err-ambiguous.js-strict:true": "test/language/module-code/instn-iee-err-ambiguous.js: Expected error: ", "test/language/module-code/instn-iee-err-circular-as.js-strict:true": "test/language/module-code/instn-iee-err-circular-as.js: Expected error: ", @@ -95,19 +88,11 @@ "test/language/module-code/instn-iee-err-dflt-thru-star.js-strict:true": "test/language/module-code/instn-iee-err-dflt-thru-star.js: Expected error: ", "test/language/module-code/instn-iee-err-not-found-as.js-strict:true": "test/language/module-code/instn-iee-err-not-found-as.js: Expected error: ", "test/language/module-code/instn-iee-err-not-found.js-strict:true": "test/language/module-code/instn-iee-err-not-found.js: Expected error: ", - "test/language/module-code/instn-named-bndng-cls.js-strict:true": "test/language/module-code/instn-named-bndng-cls.js: Test262Error: binding is created but not initialized Expected a ReferenceError to be thrown but no exception was thrown at all ", - "test/language/module-code/instn-named-bndng-const.js-strict:true": "test/language/module-code/instn-named-bndng-const.js: Test262Error: binding is created but not initialized Expected a ReferenceError to be thrown but no exception was thrown at all ", - "test/language/module-code/instn-named-bndng-dflt-cls.js-strict:true": "test/language/module-code/instn-named-bndng-dflt-cls.js: Test262Error: Binding is created but not initialized. Expected a ReferenceError to be thrown but no exception was thrown at all ", "test/language/module-code/instn-named-bndng-dflt-expr.js-strict:true": "test/language/module-code/instn-named-bndng-dflt-expr.js: Test262Error: binding is created but not initialized Expected a ReferenceError to be thrown but no exception was thrown at all ", "test/language/module-code/instn-named-bndng-dflt-fun-anon.js-strict:true": "test/language/module-code/instn-named-bndng-dflt-fun-anon.js: Test262Error: correct name is assigned Expected SameValue(«instn_named_bndng_dflt_fun_anon_default», «default») to be true ", "test/language/module-code/instn-named-bndng-dflt-gen-anon.js-strict:true": "test/language/module-code/instn-named-bndng-dflt-gen-anon.js: Test262Error: correct name is assigned Expected SameValue(«instn_named_bndng_dflt_gen_anon_default», «default») to be true ", "test/language/module-code/instn-named-bndng-dflt-named.js-strict:true": "test/language/module-code/instn-named-bndng-dflt-named.js: Test262Error: Expected a ReferenceError to be thrown but no exception was thrown at all ", "test/language/module-code/instn-named-bndng-dflt-star.js-strict:true": "test/language/module-code/instn-named-bndng-dflt-star.js: Test262Error: Expected a ReferenceError to be thrown but no exception was thrown at all ", - "test/language/module-code/instn-named-bndng-fun.js-strict:true": "test/language/module-code/instn-named-bndng-fun.js: Test262Error: binding rejects assignment Expected a TypeError to be thrown but no exception was thrown at all ", - "test/language/module-code/instn-named-bndng-gen.js-strict:true": "test/language/module-code/instn-named-bndng-gen.js: Test262Error: binding rejects assignment Expected a TypeError to be thrown but no exception was thrown at all ", - "test/language/module-code/instn-named-bndng-let.js-strict:true": "test/language/module-code/instn-named-bndng-let.js: Test262Error: binding is created but not initialized Expected a ReferenceError to be thrown but no exception was thrown at all ", - "test/language/module-code/instn-named-bndng-trlng-comma.js-strict:true": "test/language/module-code/instn-named-bndng-trlng-comma.js: Test262Error: binding rejects assignment Expected a TypeError to be thrown but no exception was thrown at all ", - "test/language/module-code/instn-named-bndng-var.js-strict:true": "test/language/module-code/instn-named-bndng-var.js: Test262Error: binding rejects assignment Expected a TypeError to be thrown but no exception was thrown at all ", "test/language/module-code/instn-named-err-ambiguous-as.js-strict:true": "test/language/module-code/instn-named-err-ambiguous-as.js: Expected error: ", "test/language/module-code/instn-named-err-ambiguous.js-strict:true": "test/language/module-code/instn-named-err-ambiguous.js: Expected error: ", "test/language/module-code/instn-named-err-dflt-thru-star-as.js-strict:true": "test/language/module-code/instn-named-err-dflt-thru-star-as.js: Expected error: ", @@ -115,7 +100,6 @@ "test/language/module-code/instn-named-err-not-found-as.js-strict:true": "test/language/module-code/instn-named-err-not-found-as.js: Expected error: ", "test/language/module-code/instn-named-err-not-found-dflt.js-strict:true": "test/language/module-code/instn-named-err-not-found-dflt.js: Expected error: ", "test/language/module-code/instn-named-err-not-found.js-strict:true": "test/language/module-code/instn-named-err-not-found.js: Expected error: ", - "test/language/module-code/instn-named-iee-cycle.js-strict:true": "test/language/module-code/instn-named-iee-cycle.js: TypeError: Cannot read property 'b' of undefined ", "test/language/module-code/instn-resolve-empty-export.js-strict:true": "test/language/module-code/instn-resolve-empty-export.js: unexpected error type (GoError), expected (SyntaxError)", "test/language/module-code/instn-resolve-empty-import.js-strict:true": "test/language/module-code/instn-resolve-empty-import.js: unexpected error type (GoError), expected (SyntaxError)", "test/language/module-code/instn-resolve-err-syntax-1.js-strict:true": "test/language/module-code/instn-resolve-err-syntax-1.js: unexpected error type (GoError), expected (SyntaxError)", @@ -126,12 +110,10 @@ "test/language/module-code/instn-star-binding.js-strict:true": "test/language/module-code/instn-star-binding.js: Test262Error: binding rejects assignment Expected a TypeError to be thrown but no exception was thrown at all ", "test/language/module-code/instn-star-equality.js-strict:true": "test/language/module-code/instn-star-equality.js: Test262Error: Local namespace objects from consecutive declarations Expected SameValue(«[object Object]», «[object Object]») to be true ", "test/language/module-code/instn-star-err-not-found.js-strict:true": "test/language/module-code/instn-star-err-not-found.js: Expected error: ", - "test/language/module-code/instn-star-iee-cycle.js-strict:true": "test/language/module-code/instn-star-iee-cycle.js: TypeError: Cannot read property 'b' of undefined ", "test/language/module-code/namespace/Symbol.toStringTag.js-strict:true": "test/language/module-code/namespace/Symbol.toStringTag.js: Test262Error: Expected SameValue(«undefined», «Module») to be true ", "test/language/module-code/namespace/internals/define-own-property.js-strict:true": "test/language/module-code/namespace/internals/define-own-property.js: Test262Error: Reflect.defineProperty: local2 Expected SameValue(«true», «false») to be true ", - "test/language/module-code/namespace/internals/delete-exported-init.js-strict:true": "test/language/module-code/namespace/internals/delete-exported-init.js: Test262Error: delete: local1 Expected a TypeError to be thrown but no exception was thrown at all ", - "test/language/module-code/namespace/internals/delete-exported-uninit.js-strict:true": "test/language/module-code/namespace/internals/delete-exported-uninit.js: Test262Error: delete: local1 Expected a TypeError to be thrown but no exception was thrown at all ", - "test/language/module-code/namespace/internals/delete-non-exported.js-strict:true": "test/language/module-code/namespace/internals/delete-non-exported.js: Test262Error: delete: default ", + "test/language/module-code/namespace/internals/delete-exported-uninit.js-strict:true": "test/language/module-code/namespace/internals/delete-exported-uninit.js: Test262Error: binding unmodified: default Expected a ReferenceError to be thrown but no exception was thrown at all ", + "test/language/module-code/namespace/internals/delete-non-exported.js-strict:true": "test/language/module-code/namespace/internals/delete-non-exported.js: TypeError: Cannot delete property 'default' of [object Object] ", "test/language/module-code/namespace/internals/enumerate-binding-uninit.js-strict:true": "test/language/module-code/namespace/internals/enumerate-binding-uninit.js: Test262Error: Expected a ReferenceError but got a Test262Error ", "test/language/module-code/namespace/internals/get-own-property-str-found-init.js-strict:true": "test/language/module-code/namespace/internals/get-own-property-str-found-init.js: Test262Error: Expected SameValue(«undefined», «201») to be true ", "test/language/module-code/namespace/internals/get-own-property-str-found-uninit.js-strict:true": "test/language/module-code/namespace/internals/get-own-property-str-found-uninit.js: Test262Error: hasOwnProperty: local1 Expected a ReferenceError to be thrown but no exception was thrown at all ", @@ -149,7 +131,7 @@ "test/language/module-code/namespace/internals/own-property-keys-binding-types.js-strict:true": "test/language/module-code/namespace/internals/own-property-keys-binding-types.js: Test262Error: Expected SameValue(«8», «10») to be true ", "test/language/module-code/namespace/internals/own-property-keys-sort.js-strict:true": "test/language/module-code/namespace/internals/own-property-keys-sort.js: Test262Error: Expected SameValue(«17», «16») to be true ", "test/language/module-code/namespace/internals/set-prototype-of.js-strict:true": "test/language/module-code/namespace/internals/set-prototype-of.js: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all ", - "test/language/module-code/namespace/internals/set.js-strict:true": "test/language/module-code/namespace/internals/set.js: Test262Error: AssignmentExpression: local1 Expected a TypeError to be thrown but no exception was thrown at all ", + "test/language/module-code/namespace/internals/set.js-strict:true": "test/language/module-code/namespace/internals/set.js: Test262Error: Reflect.set: local2 Expected SameValue(«true», «false») to be true ", "test/language/module-code/parse-err-hoist-lex-fun.js-strict:true": "test/language/module-code/parse-err-hoist-lex-fun.js: error is not an object (Test262: This statement should not be evaluated.)", "test/language/module-code/parse-err-return.js-strict:true": "test/language/module-code/parse-err-return.js: error is not an object (Test262: This statement should not be evaluated.)", "test/language/reserved-words/await-module.js-strict:true": "test/language/reserved-words/await-module.js: error is not an object (Test262: This statement should not be evaluated.)", diff --git a/js/tc39/breaking_test_errors-extended.json b/js/tc39/breaking_test_errors-extended.json index 7652b025620..2fb31ae751f 100644 --- a/js/tc39/breaking_test_errors-extended.json +++ b/js/tc39/breaking_test_errors-extended.json @@ -30,7 +30,7 @@ "test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js-strict:true": "test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js: Test262Error: RegExp(\"(?=.)*\", \"u\"): Expected a SyntaxError to be thrown but no exception was thrown at all ", "test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js-strict:true": "test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js: ReferenceError: BigUint64Array is not defined ", "test/language/comments/hashbang/function-constructor.js-strict:true": "test/language/comments/hashbang/function-constructor.js: SyntaxError: Async generators are not supported yet ", - "test/language/comments/hashbang/module.js-strict:false": "test/language/comments/hashbang/module.js: file://TestTC39/test262/test/language/comments/hashbang/module.js: Line 1:28 Unexpected token ILLEGAL (and 2 more errors)", + "test/language/comments/hashbang/module.js-strict:false": "test/language/comments/hashbang/module.js: file:///TestTC39/test262/test/language/comments/hashbang/module.js: Line 1:28 Unexpected token ILLEGAL (and 2 more errors)", "test/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js-strict:true": "test/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js: SyntaxError: Async generators are not supported yet ", "test/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js-strict:true": "test/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js: SyntaxError: Async generators are not supported yet ", "test/language/export/escaped-as-export-specifier.js-strict:true": "test/language/export/escaped-as-export-specifier.js: error is not an object (Test262: This statement should not be evaluated.)", @@ -42,7 +42,7 @@ "test/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-separators.js-strict:true": "test/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-separators.js: SyntaxError: test/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-separators.js: Identifier directly after number (40:4)\n 38 | \n 39 | let C = class {\n> 40 | [1_2_3_4_5_6_7_8]() {\n | ^\n 41 | return 1_2_3_4_5_6_7_8;\n 42 | }\n 43 | static [1_2_3_4_5_6_7_8]() { ", "test/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-separators.js-strict:true": "test/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-separators.js: SyntaxError: test/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-separators.js: Identifier directly after number (40:4)\n 38 | \n 39 | let C = class {\n> 40 | [1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8;\n | ^\n 41 | \n 42 | static [1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8;\n 43 | }; ", "test/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-separators.js-strict:true": "test/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-separators.js: SyntaxError: test/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-separators.js: Identifier directly after number (40:4)\n 38 | \n 39 | let C = class {\n> 40 | [1_2_3_4_5_6_7_8] = () => {\n | ^\n 41 | return 1_2_3_4_5_6_7_8;\n 42 | };\n 43 | ", - "test/language/expressions/class/elements/class-name-static-initializer-default-export.js-strict:true": "test/language/expressions/class/elements/class-name-static-initializer-default-export.js: SyntaxError: file://TestTC39/test262/test/language/expressions/class/elements/class-name-static-initializer-default-export.js: Unexpected token (25:13)\n 23 | \n 24 | export default class {\n> 25 | static f = (className = this.name);\n | ^\n 26 | }\n 27 | \n 28 | assert.sameValue(className, \"default\"); ", + "test/language/expressions/class/elements/class-name-static-initializer-default-export.js-strict:true": "test/language/expressions/class/elements/class-name-static-initializer-default-export.js: SyntaxError: file:///TestTC39/test262/test/language/expressions/class/elements/class-name-static-initializer-default-export.js: Unexpected token (25:13)\n 23 | \n 24 | export default class {\n> 25 | static f = (className = this.name);\n | ^\n 26 | }\n 27 | \n 28 | assert.sameValue(className, \"default\"); ", "test/language/expressions/class/elements/private-getter-is-not-a-own-property.js-strict:true": "test/language/expressions/class/elements/private-getter-is-not-a-own-property.js: TypeError: Object has no member '__lookupGetter__' ", "test/language/expressions/class/elements/private-setter-is-not-a-own-property.js-strict:true": "test/language/expressions/class/elements/private-setter-is-not-a-own-property.js: TypeError: Object has no member '__lookupSetter__' ", "test/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js-strict:true": "test/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js: SyntaxError: test/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js: Identifier directly after number (29:4)\n 27 | \n 28 | let o = {\n> 29 | [1_2_3_4_5_6_7_8]: 1_2_3_4_5_6_7_8\n | ^\n 30 | };\n 31 | \n 32 | assert.sameValue( ", @@ -89,27 +89,27 @@ "test/language/module-code/eval-export-dflt-expr-cls-anon.js-strict:true": "test/language/module-code/eval-export-dflt-expr-cls-anon.js: Test262Error: correct name is assigned Expected SameValue(«», «default») to be true ", "test/language/module-code/eval-export-dflt-expr-fn-anon.js-strict:true": "test/language/module-code/eval-export-dflt-expr-fn-anon.js: Test262Error: correct name is assigned Expected SameValue(«», «default») to be true ", "test/language/module-code/eval-export-dflt-expr-gen-anon.js-strict:true": "test/language/module-code/eval-export-dflt-expr-gen-anon.js: Test262Error: correct name is assigned Expected SameValue(«», «default») to be true ", - "test/language/module-code/eval-rqstd-once.js-strict:true": "test/language/module-code/eval-rqstd-once.js: SyntaxError: file://TestTC39/test262/test/language/module-code/eval-rqstd-once.js: Unexpected token (27:9)\n 25 | import dflt2, {} from './eval-rqstd-once_FIXTURE.js';\n 26 | export * from './eval-rqstd-once_FIXTURE.js';\n> 27 | export * as ns2 from './eval-rqstd-once_FIXTURE.js';\n | ^\n 28 | export * as class from './eval-rqstd-once_FIXTURE.js';\n 29 | import dflt3, * as ns3 from './eval-rqstd-once_FIXTURE.js';\n 30 | export default null; ", - "test/language/module-code/eval-rqstd-order.js-strict:true": "test/language/module-code/eval-rqstd-order.js: SyntaxError: file://TestTC39/test262/test/language/module-code/eval-rqstd-order.js: Unexpected token (41:9)\n 39 | import dflt3, * as ns2 from './eval-rqstd-order-8_FIXTURE.js';\n 40 | \n> 41 | export * as ns3 from './eval-rqstd-order-9_FIXTURE.js';\n | ^\n 42 | ", - "test/language/module-code/eval-self-once.js-strict:true": "test/language/module-code/eval-self-once.js: SyntaxError: file://TestTC39/test262/test/language/module-code/eval-self-once.js: Unexpected token (36:9)\n 34 | import dflt2, {} from './eval-self-once.js';\n 35 | export * from './eval-self-once.js';\n> 36 | export * as ns2 from './eval-self-once.js';\n | ^\n 37 | import dflt3, * as ns from './eval-self-once.js';\n 38 | export default null;\n 39 | ", + "test/language/module-code/eval-rqstd-once.js-strict:true": "test/language/module-code/eval-rqstd-once.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/eval-rqstd-once.js: Unexpected token (27:9)\n 25 | import dflt2, {} from './eval-rqstd-once_FIXTURE.js';\n 26 | export * from './eval-rqstd-once_FIXTURE.js';\n> 27 | export * as ns2 from './eval-rqstd-once_FIXTURE.js';\n | ^\n 28 | export * as class from './eval-rqstd-once_FIXTURE.js';\n 29 | import dflt3, * as ns3 from './eval-rqstd-once_FIXTURE.js';\n 30 | export default null; ", + "test/language/module-code/eval-rqstd-order.js-strict:true": "test/language/module-code/eval-rqstd-order.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/eval-rqstd-order.js: Unexpected token (41:9)\n 39 | import dflt3, * as ns2 from './eval-rqstd-order-8_FIXTURE.js';\n 40 | \n> 41 | export * as ns3 from './eval-rqstd-order-9_FIXTURE.js';\n | ^\n 42 | ", + "test/language/module-code/eval-self-once.js-strict:true": "test/language/module-code/eval-self-once.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/eval-self-once.js: Unexpected token (36:9)\n 34 | import dflt2, {} from './eval-self-once.js';\n 35 | export * from './eval-self-once.js';\n> 36 | export * as ns2 from './eval-self-once.js';\n | ^\n 37 | import dflt3, * as ns from './eval-self-once.js';\n 38 | export default null;\n 39 | ", "test/language/module-code/eval-this.js-strict:true": "test/language/module-code/eval-this.js: Test262Error: Expected SameValue(«[object Object]», «undefined») to be true ", "test/language/module-code/export-default-asyncfunction-declaration-binding-exists.js-strict:true": "test/language/module-code/export-default-asyncfunction-declaration-binding-exists.js: error is not an object (Test262: This statement should not be evaluated.)", "test/language/module-code/export-default-asyncfunction-declaration-binding.js-strict:true": "test/language/module-code/export-default-asyncfunction-declaration-binding.js: ReferenceError: A is not defined ", - "test/language/module-code/export-default-asyncgenerator-declaration-binding.js-strict:true": "test/language/module-code/export-default-asyncgenerator-declaration-binding.js: SyntaxError: file://TestTC39/test262/test/language/module-code/export-default-asyncgenerator-declaration-binding.js: Unexpected token (18:30)\n 16 | ---*/\n 17 | \n> 18 | export default async function * AG() {}\n | ^\n 19 | AG.foo = '';\n 20 | ", + "test/language/module-code/export-default-asyncgenerator-declaration-binding.js-strict:true": "test/language/module-code/export-default-asyncgenerator-declaration-binding.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-default-asyncgenerator-declaration-binding.js: Unexpected token (18:30)\n 16 | ---*/\n 17 | \n> 18 | export default async function * AG() {}\n | ^\n 19 | AG.foo = '';\n 20 | ", "test/language/module-code/export-expname-binding-index.js-strict:true": "test/language/module-code/export-expname-binding-index.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname-binding-index_FIXTURE.js: Unexpected token (6:14)\n 4 | var a = 0;\n 5 | var b = 1;\n> 6 | export { a as \"0\", b as \"1\" };\n | ^\n 7 | ", "test/language/module-code/export-expname-binding-string.js-strict:true": "test/language/module-code/export-expname-binding-string.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname_FIXTURE.js: Unexpected token (4:29)\n 2 | // This code is governed by the BSD license found in the LICENSE file.\n 3 | \n> 4 | export { Mercury, Mercury as \"☿\" };\n | ^\n 5 | function Mercury() {}\n 6 | globalThis.Mercury = Mercury;\n 7 | ", - "test/language/module-code/export-expname-from-binding-string.js-strict:true": "test/language/module-code/export-expname-from-binding-string.js: SyntaxError: file://TestTC39/test262/test/language/module-code/export-expname-from-binding-string.js: Unexpected token (21:20)\n 19 | ---*/\n 20 | import * as Scouts from \"./export-expname-from-binding-string.js\";\n> 21 | export { Mercury as \"☿\" } from \"./export-expname_FIXTURE.js\";\n | ^\n 22 | \n 23 | assert.sameValue(Scouts.Mercury, undefined);\n 24 | assert.sameValue(Scouts[\"☿\"], globalThis.Mercury); ", - "test/language/module-code/export-expname-from-star-string.js-strict:true": "test/language/module-code/export-expname-from-star-string.js: SyntaxError: file://TestTC39/test262/test/language/module-code/export-expname-from-star-string.js: Unexpected token (18:9)\n 16 | ---*/\n 17 | import * as Scouts from \"./export-expname-from-star-string.js\";\n> 18 | export * as \"All\" from \"./export-expname_FIXTURE.js\";\n | ^\n 19 | \n 20 | assert.sameValue(Scouts[\"☿\"], undefined);\n 21 | assert.sameValue(Scouts.All[\"☿\"], globalThis.Mercury); ", + "test/language/module-code/export-expname-from-binding-string.js-strict:true": "test/language/module-code/export-expname-from-binding-string.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname-from-binding-string.js: Unexpected token (21:20)\n 19 | ---*/\n 20 | import * as Scouts from \"./export-expname-from-binding-string.js\";\n> 21 | export { Mercury as \"☿\" } from \"./export-expname_FIXTURE.js\";\n | ^\n 22 | \n 23 | assert.sameValue(Scouts.Mercury, undefined);\n 24 | assert.sameValue(Scouts[\"☿\"], globalThis.Mercury); ", + "test/language/module-code/export-expname-from-star-string.js-strict:true": "test/language/module-code/export-expname-from-star-string.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname-from-star-string.js: Unexpected token (18:9)\n 16 | ---*/\n 17 | import * as Scouts from \"./export-expname-from-star-string.js\";\n> 18 | export * as \"All\" from \"./export-expname_FIXTURE.js\";\n | ^\n 19 | \n 20 | assert.sameValue(Scouts[\"☿\"], undefined);\n 21 | assert.sameValue(Scouts.All[\"☿\"], globalThis.Mercury); ", "test/language/module-code/export-expname-from-star.js-strict:true": "test/language/module-code/export-expname-from-star.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname_FIXTURE.js: Unexpected token (4:29)\n 2 | // This code is governed by the BSD license found in the LICENSE file.\n 3 | \n> 4 | export { Mercury, Mercury as \"☿\" };\n | ^\n 5 | function Mercury() {}\n 6 | globalThis.Mercury = Mercury;\n 7 | ", - "test/language/module-code/export-expname-from-string-binding.js-strict:true": "test/language/module-code/export-expname-from-string-binding.js: SyntaxError: file://TestTC39/test262/test/language/module-code/export-expname-from-string-binding.js: Unexpected token (19:9)\n 17 | ---*/\n 18 | import * as Scouts from \"./export-expname-from-string-binding.js\";\n> 19 | export { \"☿\" as Ami } from \"./export-expname_FIXTURE.js\";\n | ^\n 20 | \n 21 | assert.sameValue(Scouts[\"☿\"], undefined);\n 22 | assert.sameValue(Scouts.Ami, globalThis.Mercury); ", - "test/language/module-code/export-expname-from-string-string.js-strict:true": "test/language/module-code/export-expname-from-string-string.js: SyntaxError: file://TestTC39/test262/test/language/module-code/export-expname-from-string-string.js: Unexpected token (19:9)\n 17 | ---*/\n 18 | import * as Scouts from \"./export-expname-from-string-string.js\";\n> 19 | export { \"☿\" as \"Ami\" } from \"./export-expname_FIXTURE.js\";\n | ^\n 20 | \n 21 | assert.sameValue(Scouts[\"☿\"], undefined);\n 22 | assert.sameValue(Scouts.Ami, globalThis.Mercury); ", - "test/language/module-code/export-expname-from-string.js-strict:true": "test/language/module-code/export-expname-from-string.js: SyntaxError: file://TestTC39/test262/test/language/module-code/export-expname-from-string.js: Unexpected token (21:9)\n 19 | ---*/\n 20 | import * as Scouts from \"./export-expname-from-string.js\";\n> 21 | export { \"☿\" } from \"./export-expname_FIXTURE.js\";\n | ^\n 22 | \n 23 | assert.sameValue(typeof Scouts[\"☿\"], \"function\");\n 24 | ", - "test/language/module-code/export-expname-import-string-binding.js-strict:true": "test/language/module-code/export-expname-import-string-binding.js: SyntaxError: file://TestTC39/test262/test/language/module-code/export-expname-import-string-binding.js: Unexpected token (16:9)\n 14 | features: [arbitrary-module-namespace-names]\n 15 | ---*/\n> 16 | import { \"☿\" as Ami } from \"./export-expname_FIXTURE.js\";\n | ^\n 17 | \n 18 | assert.sameValue(Ami, globalThis.Mercury);\n 19 | ", - "test/language/module-code/export-star-as-dflt.js-strict:true": "test/language/module-code/export-star-as-dflt.js: SyntaxError: file://TestTC39/test262/test/language/module-code/export-star-as-dflt.js: Unexpected token (22:9)\n 20 | ---*/\n 21 | \n> 22 | export * as default from './export-star-as-dflt_FIXTURE.js';\n | ^\n 23 | import Self from './export-star-as-dflt.js';\n 24 | import { default as named } from './export-star-as-dflt.js';\n 25 | import * as ns from './export-star-as-dflt.js'; ", + "test/language/module-code/export-expname-from-string-binding.js-strict:true": "test/language/module-code/export-expname-from-string-binding.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname-from-string-binding.js: Unexpected token (19:9)\n 17 | ---*/\n 18 | import * as Scouts from \"./export-expname-from-string-binding.js\";\n> 19 | export { \"☿\" as Ami } from \"./export-expname_FIXTURE.js\";\n | ^\n 20 | \n 21 | assert.sameValue(Scouts[\"☿\"], undefined);\n 22 | assert.sameValue(Scouts.Ami, globalThis.Mercury); ", + "test/language/module-code/export-expname-from-string-string.js-strict:true": "test/language/module-code/export-expname-from-string-string.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname-from-string-string.js: Unexpected token (19:9)\n 17 | ---*/\n 18 | import * as Scouts from \"./export-expname-from-string-string.js\";\n> 19 | export { \"☿\" as \"Ami\" } from \"./export-expname_FIXTURE.js\";\n | ^\n 20 | \n 21 | assert.sameValue(Scouts[\"☿\"], undefined);\n 22 | assert.sameValue(Scouts.Ami, globalThis.Mercury); ", + "test/language/module-code/export-expname-from-string.js-strict:true": "test/language/module-code/export-expname-from-string.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname-from-string.js: Unexpected token (21:9)\n 19 | ---*/\n 20 | import * as Scouts from \"./export-expname-from-string.js\";\n> 21 | export { \"☿\" } from \"./export-expname_FIXTURE.js\";\n | ^\n 22 | \n 23 | assert.sameValue(typeof Scouts[\"☿\"], \"function\");\n 24 | ", + "test/language/module-code/export-expname-import-string-binding.js-strict:true": "test/language/module-code/export-expname-import-string-binding.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-expname-import-string-binding.js: Unexpected token (16:9)\n 14 | features: [arbitrary-module-namespace-names]\n 15 | ---*/\n> 16 | import { \"☿\" as Ami } from \"./export-expname_FIXTURE.js\";\n | ^\n 17 | \n 18 | assert.sameValue(Ami, globalThis.Mercury);\n 19 | ", + "test/language/module-code/export-star-as-dflt.js-strict:true": "test/language/module-code/export-star-as-dflt.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/export-star-as-dflt.js: Unexpected token (22:9)\n 20 | ---*/\n 21 | \n> 22 | export * as default from './export-star-as-dflt_FIXTURE.js';\n | ^\n 23 | import Self from './export-star-as-dflt.js';\n 24 | import { default as named } from './export-star-as-dflt.js';\n 25 | import * as ns from './export-star-as-dflt.js'; ", "test/language/module-code/instn-iee-bndng-cls.js-strict:true": "test/language/module-code/instn-iee-bndng-cls.js: Test262Error: binding is created but not initialized Expected a ReferenceError to be thrown but no exception was thrown at all ", "test/language/module-code/instn-iee-bndng-const.js-strict:true": "test/language/module-code/instn-iee-bndng-const.js: Test262Error: binding is created but not initialized Expected a ReferenceError to be thrown but no exception was thrown at all ", - "test/language/module-code/instn-iee-bndng-fun.js-strict:true": "test/language/module-code/instn-iee-bndng-fun.js: TypeError: Value is not an object: undefined ", - "test/language/module-code/instn-iee-bndng-gen.js-strict:true": "test/language/module-code/instn-iee-bndng-gen.js: TypeError: Value is not an object: undefined ", + "test/language/module-code/instn-iee-bndng-fun.js-strict:true": "test/language/module-code/instn-iee-bndng-fun.js: Test262Error: binding rejects assignment Expected a TypeError but got a ReferenceError ", + "test/language/module-code/instn-iee-bndng-gen.js-strict:true": "test/language/module-code/instn-iee-bndng-gen.js: Test262Error: Expected a TypeError but got a ReferenceError ", "test/language/module-code/instn-iee-bndng-let.js-strict:true": "test/language/module-code/instn-iee-bndng-let.js: Test262Error: binding is created but not initialized Expected a ReferenceError to be thrown but no exception was thrown at all ", "test/language/module-code/instn-iee-bndng-var.js-strict:true": "test/language/module-code/instn-iee-bndng-var.js: Test262Error: binding rejects assignment Expected a TypeError but got a ReferenceError ", "test/language/module-code/instn-iee-err-ambiguous-as.js-strict:true": "test/language/module-code/instn-iee-err-ambiguous-as.js: unexpected error type (TypeError), expected (SyntaxError)", @@ -140,14 +140,12 @@ "test/language/module-code/instn-named-err-not-found-as.js-strict:true": "test/language/module-code/instn-named-err-not-found-as.js: Expected error: ", "test/language/module-code/instn-named-err-not-found-dflt.js-strict:true": "test/language/module-code/instn-named-err-not-found-dflt.js: Expected error: ", "test/language/module-code/instn-named-err-not-found.js-strict:true": "test/language/module-code/instn-named-err-not-found.js: Expected error: ", - "test/language/module-code/instn-named-iee-cycle.js-strict:true": "test/language/module-code/instn-named-iee-cycle.js: Test262Error: Expected SameValue(«undefined», «23») to be true ", - "test/language/module-code/instn-once.js-strict:true": "test/language/module-code/instn-once.js: SyntaxError: file://TestTC39/test262/test/language/module-code/instn-once.js: Unexpected token (35:9)\n 33 | import dflt2, {} from './instn-once.js';\n 34 | export * from './instn-once.js';\n> 35 | export * as ns2 from './instn-once.js';\n | ^\n 36 | import dflt3, * as ns from './instn-once.js';\n 37 | export default null;\n 38 | ", + "test/language/module-code/instn-once.js-strict:true": "test/language/module-code/instn-once.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/instn-once.js: Unexpected token (35:9)\n 33 | import dflt2, {} from './instn-once.js';\n 34 | export * from './instn-once.js';\n> 35 | export * as ns2 from './instn-once.js';\n | ^\n 36 | import dflt3, * as ns from './instn-once.js';\n 37 | export default null;\n 38 | ", "test/language/module-code/instn-star-ambiguous.js-strict:true": "test/language/module-code/instn-star-ambiguous.js: TypeError: Cannot redefine property: both ", "test/language/module-code/instn-star-as-props-dflt-skip.js-strict:true": "test/language/module-code/instn-star-as-props-dflt-skip.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/instn-star-props-dflt-skip-star-as-named_FIXTURE.js: Unexpected token (4:9)\n 2 | // This code is governed by the BSD license found in the LICENSE file.\n 3 | \n> 4 | export * as named from './instn-star-props-dflt-skip-star-as-named-end_FIXTURE.js';\n | ^\n 5 | ", "test/language/module-code/instn-star-binding.js-strict:true": "test/language/module-code/instn-star-binding.js: Test262Error: binding rejects assignment Expected a TypeError to be thrown but no exception was thrown at all ", "test/language/module-code/instn-star-equality.js-strict:true": "test/language/module-code/instn-star-equality.js: Test262Error: Local namespace objects from consecutive declarations Expected SameValue(«[object Object]», «[object Object]») to be true ", "test/language/module-code/instn-star-err-not-found.js-strict:true": "test/language/module-code/instn-star-err-not-found.js: Expected error: ", - "test/language/module-code/instn-star-iee-cycle.js-strict:true": "test/language/module-code/instn-star-iee-cycle.js: Test262Error: Expected SameValue(«undefined», «23») to be true ", "test/language/module-code/instn-star-props-circular.js-strict:true": "test/language/module-code/instn-star-props-circular.js: Test262Error: entry for binding from \"a\" in namespace of module B ", "test/language/module-code/instn-star-props-nrml.js-strict:true": "test/language/module-code/instn-star-props-nrml.js: SyntaxError: file:///TestTC39/test262/test/language/module-code/instn-star-props-nrml-1_FIXTURE.js: Unexpected token (23:9)\n 21 | export { indirectIdName } from './instn-star-props-nrml-indirect_FIXTURE.js';\n 22 | export { indirectIdName as indirectIdName2 } from './instn-star-props-nrml-indirect_FIXTURE.js';\n> 23 | export * as namespaceBinding from './instn-star-props-nrml-indirect_FIXTURE.js';\n | ^\n 24 | \n 25 | export * from './instn-star-props-nrml-star_FIXTURE.js';\n 26 | ", "test/language/module-code/namespace/Symbol.toStringTag.js-strict:true": "test/language/module-code/namespace/Symbol.toStringTag.js: Test262Error: Expected SameValue(«undefined», «Module») to be true ", diff --git a/js/tc39/tc39_test.go b/js/tc39/tc39_test.go index 56ab0419886..22c2396da20 100644 --- a/js/tc39/tc39_test.go +++ b/js/tc39/tc39_test.go @@ -704,12 +704,10 @@ func (ctx *tc39TestCtx) runTC39Module(name, src string, includes []string, vm *g return fs.ReadFile(currentFS, specifier.Path[1:]) }, comp) - u := &url.URL{Scheme: "file", Path: path.Join(ctx.base, name)} + u := &url.URL{Scheme: "file", Path: "/" + path.Join(ctx.base, name)} - base := u.JoinPath("..") ms := modules.NewModuleSystem(mr, moduleRuntime.VU) - impl := modules.NewLegacyRequireImpl(moduleRuntime.VU, ms, *base) - require.NoError(ctx.t, vm.Set("require", impl.Require)) + require.NoError(ctx.t, vm.Set("require", ms.Require)) early = false _, err = ms.RunSourceData(&loader.SourceData{