This change lets us set runtime specific options in Pulumi.yaml, which will flow as arguments to the language hosts. We then teach the nodejs host that when the `typescript` is set to `true` that it should load ts-node before calling into user code. This allows using typescript natively without an explicit compile step outside of Pulumi. This works even when a tsconfig.json file is not present in the application and should provide a nicer inner loop for folks writing typescript (I'm pretty sure everyone has run into the "but I fixed that bug! Why isn't it getting picked up? Oh, I forgot to run tsc" problem. Fixes #958
35 lines
1.2 KiB
Go
35 lines
1.2 KiB
Go
// Copyright 2016-2018, Pulumi Corporation.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/pulumi/pulumi/pkg/resource/config"
|
|
"github.com/pulumi/pulumi/pkg/tokens"
|
|
"github.com/pulumi/pulumi/pkg/workspace"
|
|
)
|
|
|
|
func TestPrettyKeyForProject(t *testing.T) {
|
|
proj := &workspace.Project{
|
|
Name: tokens.PackageName("test-package"),
|
|
RuntimeInfo: workspace.NewProjectRuntimeInfo("nodejs", nil),
|
|
}
|
|
|
|
assert.Equal(t, "foo", prettyKeyForProject(config.MustMakeKey("test-package", "foo"), proj))
|
|
assert.Equal(t, "other-package:bar", prettyKeyForProject(config.MustMakeKey("other-package", "bar"), proj))
|
|
}
|