Skip to content

Commit

Permalink
pw_presubmit: Add npm presubmits to install and run tests
Browse files Browse the repository at this point in the history
Change-Id: I69c9784dbac6b8a55b2d881779c0943daac4b3f7
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/101224
Pigweed-Auto-Submit: Asad Memon <asadmemon@google.com>
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
  • Loading branch information
asadm authored and CQ Bot Account committed Jul 7, 2022
1 parent 1a64209 commit 7b703f7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"rollup": "rollup -c && rimraf dist/types && rimraf dist/**/types && chmod +x ./dist/bin/pw_protobuf_compiler.js",
"start": "tsc-watch --onSuccess \"rollup -c\"",
"check": "gts check",
"fix": "gts fix"
"fix": "gts fix",
"test": "echo \"No tests defined yet\""
},
"devDependencies": {
"@bazel/concatjs": "4.1.0",
Expand Down
1 change: 1 addition & 0 deletions pw_presubmit/py/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pw_python_package("py") {
"pw_presubmit/git_repo.py",
"pw_presubmit/inclusive_language.py",
"pw_presubmit/install_hook.py",
"pw_presubmit/npm_presubmit.py",
"pw_presubmit/pigweed_presubmit.py",
"pw_presubmit/presubmit.py",
"pw_presubmit/python_checks.py",
Expand Down
22 changes: 22 additions & 0 deletions pw_presubmit/py/pw_presubmit/npm_presubmit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2022 The Pigweed Authors
#
# 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
#
# https://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.
"""Presubmit to npm install and run tests"""

from pw_presubmit import (call, PresubmitContext)


def npm_test(ctx: PresubmitContext) -> None:
"""Run npm install and npm test in Pigweed root to test all web modules"""
call('npm', "install", cwd=ctx.root)
call('npm', "test", cwd=ctx.root)
2 changes: 2 additions & 0 deletions pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
Programs,
python_checks,
shell_checks,
npm_presubmit,
)
from pw_presubmit.install_hook import install_git_hook

Expand Down Expand Up @@ -805,6 +806,7 @@ def renode_check(ctx: PresubmitContext):
renode_check,
static_analysis,
stm32f429i,
npm_presubmit.npm_test,
)

_LINTFORMAT = (
Expand Down

0 comments on commit 7b703f7

Please sign in to comment.