diff options
author | zaverden <zaverden@yandex-team.com> | 2023-03-17 10:33:54 +0300 |
---|---|---|
committer | zaverden <zaverden@yandex-team.com> | 2023-03-17 10:33:54 +0300 |
commit | 8475dd9deb086f897d0899215377ee7667f7893e (patch) | |
tree | 590754259b39009c8881d41c811140a7f72d4717 | |
parent | 0223f0e221c12bd5eb3a532c2c12d3dc00ae77e8 (diff) | |
download | ydb-8475dd9deb086f897d0899215377ee7667f7893e.tar.gz |
feat(TS_TEST): do not build on TS_TEST
Отключил сборку перед запуском тестов
Проверил на `devtools/dummy_arcadia/ts/packages/with_test` - пиры нормально собираются
-rw-r--r-- | build/conf/ts.conf | 25 | ||||
-rw-r--r-- | build/plugins/nots.py | 13 |
2 files changed, 20 insertions, 18 deletions
diff --git a/build/conf/ts.conf b/build/conf/ts.conf index fb6774502f..9373125f6b 100644 --- a/build/conf/ts.conf +++ b/build/conf/ts.conf @@ -51,7 +51,7 @@ macro FROM_NPM_LOCKFILES(LOCKFILES...) { ### @usage: FROM_NPM(NAME VERSION SKY_ID INTEGRITY INTEGRITY_ALGO TARBALL_PATH) macro FROM_NPM(NAME, VERSION, SKY_ID, INTEGRITY, INTEGRITY_ALGO, TARBALL_PATH) { - .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_npm.py"} ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/sky.py"} --name $NAME --version $VERSION --sky-id $SKY_ID --integrity $INTEGRITY --integrity-algorithm $INTEGRITY_ALGO --copy-to ${output:TARBALL_PATH} ${requirements;hide:"network:full"} ${kv;hide:"p NP"} ${kv;hide:"pc yellow"} + .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_npm.py"} ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/sky.py"} --name $NAME --version $VERSION --sky-id $SKY_ID --integrity $INTEGRITY --integrity-algorithm $INTEGRITY_ALGO --copy-to ${output:TARBALL_PATH} ${requirements;hide:"network:full"} ${kv;hide:"p NPM"} ${kv;hide:"pc magenta"} } # @@ -74,7 +74,7 @@ macro _NODE_MODULES(IN{input}[], OUT{output}[]) { PEERDIR($NPM_CONTRIBS_PATH) SET(NODE_MODULES_BUNDLE_AS_OUTPUT \${output;hide:"workspace_node_modules.tar"}) - .CMD=${cwd:BINDIR} $NOTS_TOOL create-node-modules $NOTS_TOOL_BASE_ARGS --pnpm-script $PNPM_SCRIPT --contribs $NPM_CONTRIBS_PATH ${input;hide:IN} ${output;hide:OUT} ${kv;hide:"p NM"} ${kv;hide:"pc yellow"} + .CMD=${cwd:BINDIR} $NOTS_TOOL create-node-modules $NOTS_TOOL_BASE_ARGS --pnpm-script $PNPM_SCRIPT --contribs $NPM_CONTRIBS_PATH ${input;hide:IN} ${output;hide:OUT} ${kv;hide:"p NOMO"} ${kv;hide:"pc magenta"} } # @@ -108,7 +108,7 @@ TS_COMPILE=$TOUCH_UNIT \ --ts-config ${input:TS_CONFIG_PATH} --node-modules-bundle $NOTS_TOOL_NODE_MODULES_BUNDLE \ --typings $TS_COMPILE_TYPINGS --plugins $TS_COMPILE_PLUGINS $NODE_MODULES_BUNDLE_AS_OUTPUT \ ${hide:PEERS} ${input;hide:"./package.json"} ${TS_CONFIG_FILES} \ - ${output;hide:"package.json"} ${output;hide:TS_COMPILE_OUTPUT} ${kv;hide:"p FE"} ${kv;hide:"pc yellow"} + ${output;hide:"package.json"} ${output;hide:TS_COMPILE_OUTPUT} ${kv;hide:"p TSC"} ${kv;hide:"pc magenta"} module _TS_BASE_LIBRARY : _TS_BASE_UNIT { .CMD=TS_COMPILE @@ -149,7 +149,7 @@ TS_BUNDLE_WEBPACK=$TOUCH_UNIT \ --webpack-config ${input:WEBPACK_CONFIG_PATH} --ts-config ${input:TS_CONFIG_PATH} \ --node-modules-bundle $NOTS_TOOL_NODE_MODULES_BUNDLE $NODE_MODULES_BUNDLE_AS_OUTPUT ${hide:PEERS} \ ${input;hide:"./package.json"} ${TS_CONFIG_FILES} ${output;hide:"bundle.tar"} \ - ${output;hide:"package.json"} ${kv;hide:"p FE"} ${kv;hide:"pc yellow"} + ${output;hide:"package.json"} ${kv;hide:"p TSWP"} ${kv;hide:"pc magenta"} ### @usage: TS_BUNDLE([name]) ### @@ -193,7 +193,7 @@ TS_NEXTJS_BUILD=$TOUCH_UNIT \ --nextjs-config ${input:NEXTJS_CONFIG_PATH} --ts-config ${input:TS_CONFIG_PATH} \ --node-modules-bundle $NOTS_TOOL_NODE_MODULES_BUNDLE $NODE_MODULES_BUNDLE_AS_OUTPUT ${hide:PEERS} \ ${input;hide:"./package.json"} ${TS_CONFIG_FILES} ${output;hide:"bundle.tar"} \ - ${output;hide:"package.json"} ${kv;hide:"p FE"} ${kv;hide:"pc yellow"} + ${output;hide:"package.json"} ${kv;hide:"p TSNEXT"} ${kv;hide:"pc magenta"} ### @usage: TS_NEXTJS() ### @@ -282,13 +282,18 @@ macro _TS_LIBRARY_EPILOGUE() { _GLOB(_TS_LINT_SRCS_VALUE ${CURDIR}/**/*.(ts|tsx) EXCLUDE **/node_modules/**/*.(ts|tsx)) } +TS_TEST_CMD=$TOUCH_UNIT \ + && ${cwd:BINDIR} $MOVE_FILE $NOTS_TOOL_NODE_MODULES_BUNDLE ${output:"workspace_node_modules.tar"} \ + ${kv;hide:"p TSTEST"} ${kv;hide:"pc magenta"} + # tag:test ### @usage: TS_TEST() ### ### @see [TS_TEST_SRCS()](#macro_TS_TEST_SRCS) ### @see [TS_TEST_DATA()](#macro_TS_TEST_DATA) -module TS_TEST: _TS_BASE_LIBRARY { - .CMD=TS_COMPILE +module TS_TEST: _TS_BASE_UNIT { + .CMD=TS_TEST_CMD + # Disable `SRCS` macro in "parent" module (sources will be added by `TS_TEST_SRCS`). .ALIASES=SRCS=_NOOP_MACRO @@ -299,22 +304,16 @@ module TS_TEST: _TS_BASE_LIBRARY { SET(NOTS_TOOL_NODE_MODULES_BUNDLE $TEST_FOR_BINDIR/$NODE_MODULES_BUNDLE) PEERDIR(build/external_resources/$TS_TEST_RUNNER) - # PEERDIR can't be conditional. - PEERDIR($NOTS_PLUGINS_PATH/jest) - PEERDIR($NOTS_PLUGINS_PATH/typescript) - SET(TS_COMPILE_PLUGINS $ARCADIA_BUILD_ROOT/$NOTS_PLUGINS_PATH/typescript/build/hoist-jest-mocks.js) when ($TS_TEST_RUNNER == "jest") { TS_TEST_CONFIG_PATH_VAR=JEST_CONFIG_PATH TS_TEST_EXTENSION=$JEST_TEST_EXTENSION TS_TEST_EXTRA_SRCS_MASK=$JEST_EXTRA_SRCS_MASK - TS_COMPILE_TYPINGS+=@types/jest:$JEST_RESOURCE_GLOBAL/node_modules/@types/jest } when ($TS_TEST_RUNNER == "hermione") { TS_TEST_CONFIG_PATH_VAR=HERMIONE_CONFIG_PATH TS_TEST_EXTENSION=$HERMIONE_TEST_EXTENSION TS_TEST_EXTRA_SRCS_MASK=$HERMIONE_EXTRA_SRCS_MASK - TS_COMPILE_TYPINGS+=@types/hermione:$HERMIONE_RESOURCE_GLOBAL/node_modules/hermione/typings } _TS_TEST_CONFIGURE() diff --git a/build/plugins/nots.py b/build/plugins/nots.py index 77f4074a91..2111d46c38 100644 --- a/build/plugins/nots.py +++ b/build/plugins/nots.py @@ -95,13 +95,13 @@ def on_ts_test_configure(unit): test_runner_handlers = _get_test_runner_handlers() test_runner = unit.get("TS_TEST_RUNNER") + if not test_runner: + raise Exception("Test runner is not specified") + if test_runner not in test_runner_handlers: raise Exception("Test runner: {} is not available, try to use one of these: {}" .format(test_runner, ", ".join(test_runner_handlers.keys()))) - if not test_runner: - raise Exception("Test runner is not specified") - test_files = ytest.get_values_list(unit, "_TS_TEST_SRCS_VALUE") if not test_files: raise Exception("No tests found in {}".format(unit.path())) @@ -118,14 +118,16 @@ def on_ts_test_configure(unit): deps = _create_pm(unit).get_peers_from_package_json() test_record = { + # TODO: remove TS-ROOT-DIR, TS-OUT-DIR. fake values are for back-compat with ya and test_tool + "TS-ROOT-DIR": "fake", + "TS-OUT-DIR": "fake", "TS-TEST-FOR-PATH": unit.get("TS_TEST_FOR_PATH"), - "TS-ROOT-DIR": unit.get("TS_CONFIG_ROOT_DIR"), - "TS-OUT-DIR": unit.get("TS_CONFIG_OUT_DIR"), "TS-TEST-DATA-DIRS": ytest.serialize_list(data_dirs), "TS-TEST-DATA-DIRS-RENAME": unit.get("_TS_TEST_DATA_DIRS_RENAME_VALUE"), "CONFIG-PATH": config_path, } + _set_nodejs_root(unit) add_ts_test = test_runner_handlers[test_runner] add_ts_test(unit, test_runner, test_files, deps, test_record) @@ -138,6 +140,7 @@ def _get_test_runner_handlers(): def _add_jest_ts_test(unit, test_runner, test_files, deps, test_record): + # TODO: remove these 3 lines. NOTS-PLUGINS-PATH is for back-compat with ya nad test_tool nots_plugins_path = os.path.join(unit.get("NOTS_PLUGINS_PATH"), "jest") deps.append(nots_plugins_path) test_record["NOTS-PLUGINS-PATH"] = nots_plugins_path |