960a044abc
- Update istanbul and mocha to their most recent versions. The istanbul CLI has been replaced by the nyc CLI. This is required in order to exclude tests from test sets and to exclude certain files (closure cases) from instrumentation. - Add support for gathering and reporting coverage data under the `PULUMI_TEST_COVERAGE_PATH` environment variable.
86 lines
3.4 KiB
Makefile
86 lines
3.4 KiB
Makefile
PROJECT_NAME := Pulumi Node.JS SDK
|
|
NODE_MODULE_NAME := @pulumi/pulumi
|
|
VERSION := $(shell cd ../../ && pulumictl get version --language javascript)
|
|
|
|
LANGUAGE_HOST := github.com/pulumi/pulumi/sdk/v3/nodejs/cmd/pulumi-language-nodejs
|
|
PROJECT_ROOT := $(realpath ../..)
|
|
|
|
PROJECT_PKGS := $(shell go list ./cmd...)
|
|
TESTPARALLELISM := 10
|
|
TEST_FAST_TIMEOUT := 2m
|
|
|
|
# Motivation: running `make TEST_ALL_DEPS= test_all` permits running
|
|
# `test_all` without the dependencies.
|
|
TEST_ALL_DEPS = build
|
|
|
|
include ../../build/common.mk
|
|
|
|
export PATH:=$(shell yarn bin 2>/dev/null):$(PATH)
|
|
|
|
lint::
|
|
./node_modules/.bin/eslint -c .eslintrc.js --ext .ts .
|
|
|
|
build_package::
|
|
./node_modules/.bin/tsc
|
|
cp tests/runtime/jsClosureCases_8.js bin/tests/runtime
|
|
cp tests/runtime/jsClosureCases_10_4.js bin/tests/runtime
|
|
cp -R tests/automation/data/. bin/tests/automation/data/
|
|
cp README.md ../../LICENSE package.json ./dist/* bin/
|
|
node ../../scripts/reversion.js bin/package.json ${VERSION}
|
|
node ../../scripts/reversion.js bin/version.js ${VERSION}
|
|
cp -R proto/. bin/proto/
|
|
mkdir -p bin/tests/runtime/langhost/cases/
|
|
find tests/runtime/langhost/cases/* -type d -exec cp -R {} bin/tests/runtime/langhost/cases/ \;
|
|
|
|
build_plugin::
|
|
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${VERSION}" ${LANGUAGE_HOST}
|
|
|
|
build:: build_package build_plugin
|
|
|
|
install_package:: build
|
|
cp dist/pulumi-resource-pulumi-nodejs "$(PULUMI_BIN)"
|
|
cp dist/pulumi-analyzer-policy "$(PULUMI_BIN)"
|
|
|
|
install_plugin:: build
|
|
GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${VERSION}" ${LANGUAGE_HOST}
|
|
|
|
install:: install_package install_plugin
|
|
|
|
unit_tests:: $(TEST_ALL_DEPS)
|
|
$(RUN_TESTSUITE) unit-nodejs ./node_modules/.bin/nyc -x 'bin/tests/runtime/*ClosureCases*.js' -s mocha --timeout 120000 --exclude 'bin/tests/automation/**/*.spec.js' --exclude 'bin/tests/runtime/closureLoader.spec.js' 'bin/tests/**/*.spec.js'
|
|
$(RUN_TESTSUITE) unit-nodejs mocha --timeout 120000 'bin/tests/runtime/closureLoader.spec.js'
|
|
$(RUN_TESTSUITE) unit-with-mocks-nodejs ./node_modules/.bin/nyc -s mocha 'bin/tests_with_mocks/**/*.spec.js'
|
|
|
|
auto_tests:: $(TEST_ALL_DEPS)
|
|
$(RUN_TESTSUITE) auto-nodejs ./node_modules/.bin/nyc -s mocha --timeout 120000 'bin/tests/automation/**/*.spec.js'
|
|
|
|
sxs_tests:: $(TEST_ALL_DEPS)
|
|
pushd tests/sxs_ts_3.6 && yarn ; tsc ; popd
|
|
pushd tests/sxs_ts_latest && yarn ; tsc ; popd
|
|
|
|
test_fast:: sxs_tests unit_tests
|
|
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
|
|
if [ -e .nyc_output ]; then ./node_modules/.bin/nyc report -r cobertura --report-dir $(PULUMI_TEST_COVERAGE_PATH); fi
|
|
endif
|
|
$(GO_TEST_FAST) ${PROJECT_PKGS}
|
|
|
|
test_all:: sxs_tests unit_tests auto_tests
|
|
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
|
|
if [ -e .nyc_output ]; then ./node_modules/.bin/nyc report -r cobertura --report-dir $(PULUMI_TEST_COVERAGE_PATH); fi
|
|
endif
|
|
$(GO_TEST) ${PROJECT_PKGS}
|
|
|
|
dist:: build
|
|
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${VERSION}" ${LANGUAGE_HOST}
|
|
cp dist/pulumi-resource-pulumi-nodejs "$$(go env GOPATH)"/bin/
|
|
cp dist/pulumi-analyzer-policy "$$(go env GOPATH)"/bin/
|
|
|
|
brew:: BREW_VERSION := $(shell ../../scripts/get-version HEAD)
|
|
brew::
|
|
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${VERSION}" ${LANGUAGE_HOST}
|
|
cp dist/pulumi-resource-pulumi-nodejs "$$(go env GOPATH)"/bin/
|
|
cp dist/pulumi-analyzer-policy "$$(go env GOPATH)"/bin/
|
|
|
|
publish:: build_package
|
|
bash -c ../../scripts/publish_npm.sh
|