use of com.intellij.execution.actions.ConfigurationFromContext in project intellij by bazelbuild.
the class JavascriptTestContextProviderTest method testMultipleBrowsers.
@Test
public void testMultipleBrowsers() throws Throwable {
PsiFile jsTestFile = configure(ImmutableList.of("chrome-linux", "firefox-linux"), "function testFoo() {}");
ConfigurationContext context = createContextFromPsi(jsTestFile);
ConfigurationFromContext configurationFromContext = getConfigurationFromContext(context);
BlazeCommandRunConfiguration configuration = getBlazeRunConfiguration(configurationFromContext);
assertThat(configuration.getPendingContext()).isNotNull();
assertThat(configuration.getPendingContext()).isInstanceOf(PendingWebTestContext.class);
PendingWebTestContext testContext = (PendingWebTestContext) configuration.getPendingContext();
testContext.updateContextAndRerun(configuration, TargetInfo.builder(Label.create("//foo/bar:foo_test_firefox-linux"), "js_web_test").build(), () -> {
});
assertThat(configuration.getTargetKind()).isEqualTo(Kind.fromRuleName("js_web_test"));
assertThat(configuration.getTargets()).containsExactly(TargetExpression.fromStringSafe("//foo/bar:foo_test_firefox-linux"));
}
use of com.intellij.execution.actions.ConfigurationFromContext in project intellij by bazelbuild.
the class OldJavascriptTestContextProviderTest method testClosureTestSuite.
@Test
public void testClosureTestSuite() throws Throwable {
PsiFile jsTestFile = configure(ImmutableList.of("chrome-linux"), "goog.module('foo.bar.fooTest');", "goog.setTestOnly();", "const testSuite = goog.require('goog.testing.testSuite');", "testSuite({", " testFoo() {},", "});");
ConfigurationContext context = createContextFromPsi(jsTestFile);
ConfigurationFromContext configurationFromContext = getConfigurationFromContext(context);
BlazeCommandRunConfiguration configuration = getBlazeRunConfiguration(configurationFromContext);
assertThat(configuration.getTargetKind()).isEqualTo(RuleTypes.WEB_TEST.getKind());
assertThat(configuration.getTargets()).containsExactly(TargetExpression.fromStringSafe("//foo/bar:foo_test_chrome-linux"));
}
use of com.intellij.execution.actions.ConfigurationFromContext in project intellij by bazelbuild.
the class OldJavascriptTestContextProviderTest method testMultipleBrowsers.
@Test
public void testMultipleBrowsers() throws Throwable {
PsiFile jsTestFile = configure(ImmutableList.of("chrome-linux", "firefox-linux"), "function testFoo() {}");
ConfigurationContext context = createContextFromPsi(jsTestFile);
ConfigurationFromContext configurationFromContext = getConfigurationFromContext(context);
BlazeCommandRunConfiguration configuration = getBlazeRunConfiguration(configurationFromContext);
assertThat(configuration.getPendingContext()).isNotNull();
assertThat(configuration.getPendingContext()).isInstanceOf(PendingWebTestContext.class);
PendingWebTestContext testContext = (PendingWebTestContext) configuration.getPendingContext();
testContext.updateContextAndRerun(configuration, TargetInfo.builder(Label.create("//foo/bar:foo_test_firefox-linux"), "web_test").build(), () -> {
});
assertThat(configuration.getTargetKind()).isEqualTo(RuleTypes.WEB_TEST.getKind());
assertThat(configuration.getTargets()).containsExactly(TargetExpression.fromStringSafe("//foo/bar:foo_test_firefox-linux"));
}
use of com.intellij.execution.actions.ConfigurationFromContext in project intellij by bazelbuild.
the class OldJavascriptTestContextProviderTest method testOldStyleClosureTestSuite.
@Test
public void testOldStyleClosureTestSuite() throws Throwable {
createAndIndexFile(WorkspacePath.createIfValid("javascript/closure/testing/testsuite.js"), "goog.provide('goog.testing.testSuite');", "goog.setTestOnly('goog.testing.testSuite');", "goog.testing.testSuite = function(obj, opt_options) {}");
PsiFile jsTestFile = configure(ImmutableList.of("chrome-linux"), "goog.require('goog.testing.testSuite');", "goog.testing.testSuite({", " testFoo() {},", "});");
ConfigurationContext context = createContextFromPsi(jsTestFile);
ConfigurationFromContext configurationFromContext = getConfigurationFromContext(context);
BlazeCommandRunConfiguration configuration = getBlazeRunConfiguration(configurationFromContext);
assertThat(configuration.getTargetKind()).isEqualTo(RuleTypes.WEB_TEST.getKind());
assertThat(configuration.getTargets()).containsExactly(TargetExpression.fromStringSafe("//foo/bar:foo_test_chrome-linux"));
}
use of com.intellij.execution.actions.ConfigurationFromContext in project intellij by bazelbuild.
the class OldJavascriptTestContextProviderTest method testTopLevelFunctions.
@Test
public void testTopLevelFunctions() throws Throwable {
PsiFile jsTestFile = configure(ImmutableList.of("chrome-linux"), "function testFoo() {}");
ConfigurationContext context = createContextFromPsi(jsTestFile);
ConfigurationFromContext configurationFromContext = getConfigurationFromContext(context);
BlazeCommandRunConfiguration configuration = getBlazeRunConfiguration(configurationFromContext);
assertThat(configuration.getTargetKind()).isEqualTo(RuleTypes.WEB_TEST.getKind());
assertThat(configuration.getTargets()).containsExactly(TargetExpression.fromStringSafe("//foo/bar:foo_test_chrome-linux"));
}
Aggregations