diff --git a/src/com/google/javascript/jscomp/deps/ModuleLoader.java b/src/com/google/javascript/jscomp/deps/ModuleLoader.java index 11d92f662af..7acdcb2f9bb 100644 --- a/src/com/google/javascript/jscomp/deps/ModuleLoader.java +++ b/src/com/google/javascript/jscomp/deps/ModuleLoader.java @@ -52,7 +52,7 @@ public final class ModuleLoader { public static final String DEFAULT_FILENAME_PREFIX = "." + MODULE_SLASH; public static final DiagnosticType LOAD_WARNING = - DiagnosticType.warning("JSC_JS_MODULE_LOAD_WARNING", "Failed to load module \"{0}\""); + DiagnosticType.error("JSC_JS_MODULE_LOAD_WARNING", "Failed to load module \"{0}\""); public static final DiagnosticType INVALID_MODULE_PATH = DiagnosticType.error( diff --git a/test/com/google/javascript/jscomp/CompilerTest.java b/test/com/google/javascript/jscomp/CompilerTest.java index da3a02708bc..793f56e4b0a 100644 --- a/test/com/google/javascript/jscomp/CompilerTest.java +++ b/test/com/google/javascript/jscomp/CompilerTest.java @@ -17,8 +17,8 @@ package com.google.javascript.jscomp; import static com.google.common.truth.Truth.assertThat; +import static java.nio.charset.StandardCharsets.UTF_8; -import com.google.common.base.Charsets; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -147,9 +147,9 @@ public void testCommonJSMissingRequire() throws Exception { inputs, ImmutableList.of(ModuleIdentifier.forFile("/gin"))); ErrorManager manager = compiler.getErrorManager(); - JSError[] warnings = manager.getWarnings(); - assertThat(warnings).hasLength(1); - String error = warnings[0].toString(); + JSError[] errors = manager.getErrors(); + assertThat(errors).hasLength(1); + String error = errors[0].toString(); assertThat(error).contains("Failed to load module \"missing\" at /gin.js"); } @@ -229,9 +229,9 @@ public void testResolveRelativeSourceMap() throws Exception { File tempDir = Files.createTempDir(); String code = SOURCE_MAP_TEST_CODE + "\n//# sourceMappingURL=foo.js.map"; File jsFile = new File(tempDir, "foo.js"); - Files.asCharSink(jsFile, Charsets.UTF_8).write(code); + Files.asCharSink(jsFile, UTF_8).write(code); File sourceMapFile = new File(tempDir, "foo.js.map"); - Files.asCharSink(sourceMapFile, Charsets.UTF_8).write(SOURCE_MAP); + Files.asCharSink(sourceMapFile, UTF_8).write(SOURCE_MAP); CompilerInput input = new CompilerInput(SourceFile.fromFile(jsFile.getAbsolutePath())); input.getAstRoot(compiler); @@ -253,9 +253,9 @@ public void testResolveRelativeDirSourceMap() throws Exception { relativedir.mkdir(); String code = SOURCE_MAP_TEST_CODE + "\n//# sourceMappingURL=relativedir/foo.js.map"; File jsFile = new File(tempDir, "foo.js"); - Files.asCharSink(jsFile, Charsets.UTF_8).write(code); + Files.asCharSink(jsFile, UTF_8).write(code); File sourceMapFile = new File(relativedir, "foo.js.map"); - Files.asCharSink(sourceMapFile, Charsets.UTF_8).write(SOURCE_MAP); + Files.asCharSink(sourceMapFile, UTF_8).write(SOURCE_MAP); CompilerInput input = new CompilerInput(SourceFile.fromFile(jsFile.getAbsolutePath())); input.getAstRoot(compiler); @@ -274,7 +274,7 @@ public void testMissingSourceMapFile() throws Exception { File tempDir = Files.createTempDir(); String code = SOURCE_MAP_TEST_CODE + "\n//# sourceMappingURL=foo-does-not-exist.js.map"; File jsFile = new File(tempDir, "foo2.js"); - Files.asCharSink(jsFile, Charsets.UTF_8).write(code); + Files.asCharSink(jsFile, UTF_8).write(code); CompilerInput input = new CompilerInput(SourceFile.fromFile(jsFile.getAbsolutePath())); input.getAstRoot(compiler); @@ -297,7 +297,7 @@ public void testNoWarningMissingAbsoluteSourceMap() throws Exception { File tempDir = Files.createTempDir(); String code = SOURCE_MAP_TEST_CODE + "\n//# sourceMappingURL=/some/missing/path/foo.js.map"; File jsFile = new File(tempDir, "foo.js"); - Files.asCharSink(jsFile, Charsets.UTF_8).write(code); + Files.asCharSink(jsFile, UTF_8).write(code); CompilerInput input = new CompilerInput(SourceFile.fromFile(jsFile.getAbsolutePath())); input.getAstRoot(compiler); diff --git a/test/com/google/javascript/jscomp/Es6RewriteModulesTest.java b/test/com/google/javascript/jscomp/Es6RewriteModulesTest.java index 6be91572a29..423362793a8 100644 --- a/test/com/google/javascript/jscomp/Es6RewriteModulesTest.java +++ b/test/com/google/javascript/jscomp/Es6RewriteModulesTest.java @@ -95,7 +95,7 @@ public void testImport() { } public void testImport_missing() { - ModulesTestUtils.testModulesWarning(this, "import name from './does_not_exist';\n use(name);", + ModulesTestUtils.testModulesError(this, "import name from './does_not_exist';\n use(name);", ModuleLoader.LOAD_WARNING); }