@globalpayments/vega

中文文档
2.110.1发布于 2026/11/11UNLICENSEDTypeScriptESM + CJS近 30 天下载 1.2万

Vega - the design system of Global Payment Systems

原始使用文档
文档目录14 节
  1. Table of Contents
  2. Overview
  3. Prerequisite
  4. Code linter
  5. [Optional] Consume new design token
  6. Getting started
  7. Debug/Development
  8. Testing
  9. If you want to run a single test suite, please run
  10. If you want to run the specific test case within a single t…
  11. If you would like to run is duplicate with the cases in oth…
  12. Raising a commit
  13. Troubleshooting
  14. 1. E2E Testing Failure due to the css not loaded

vega-stencil

Table of Contents

Overview

This package is mainly for creating custom web components built with stencil.js.

Prerequisite

Code linter

vega-stencil is using eslint (config: .eslintrc.js) along with prettier (config: .prettierrc.js). Make sure both tools have been set up properly in your IDE.

[Optional] Consume new design token

design token was originally stored at ../vega-design package which is also responsible for generating corresponding CSS/JS file used by other clients including vega-stencil.

Hence, if you want to test some change of design token and want to integrate them into vega-stencil, you need to re-run the consume command to fetch the CSS/JS files from vega-design to vega-stencil:

> npm run consume-design-token

Getting started

Install node dependencies

> npm install

Debug/Development

To generate a new stencil component

> npm run generate <element_tag>

Start local server to host preview your change for stencil components

> npm run start
# or 
> npm run debug # no cache

Testing

Currently, vega-stencil has two testing environments:

  1. Unit test env:
    • In this env, we will run unit test for vega components / non-component logic (e.g. vega-badge.spec.tsx).
    • In this env, there won't be any actual HTML element during runtime and all of them will show up as MockHTMLElement
  2. E2E test env:
    • This env is using the exact browser runtime (Chromium) to run the test, which means all the UI/UX should be the same as the real one.
    • The tests we are running in this env are:
      1. E2E test for vega component classes (e.g. vega-badge.e2e.ts)
      2. E2E test for visual regression checking (e.g. vaga-date-picker.visual.e2e.ts)
      3. E2E test for accessibility checking with standard 'wcag2a', 'wcag2aa','wcag21a', 'wcag21aa' (e.g. vega-date-picker.ada.e2e.ts)

The command to run both <1> and <2> is

> npm run test:base:coverage
# or
> npm run test:base:watch-all # this command will re-run when src files are changed

The command to run visual regression test only is

> npm run test:visual 

If you want to run a single test suite, please run

> npm run test:single-suite <suite_file_name>

Example: npm run test:single-suite vega-modal.spec

If you want to run the specific test case within a single test suite, please run

> npm run test:single-case <test_case_name_regex>

Which will run only tests with a name that matches the regex. Example: npm run test:single-case "should render proper css of modal when open modal"

If you would like to run is duplicate with the cases in other test suite, you can use the below command to specify the test case in a specific suite:

> npm run test:single-suite -- --testNamePattern <test_case_name_regex>

1.<3> 2.node scripts/visual-test-screenshot-handle.js

If you want to see the difference pic between local and stand,pls follow below step:

1.install Live Server extension 2.open screenshot/compare.html by open with Live Server 3.choose All Screenshots on right top 4.click blank area under left side if the stand pic not show ,and manuel compare it

If you want to disable Featureflag to test cases with old logic:

For e2e test to disable a featureflag:

describe('vega-input', () => {
  let page: E2EPage;
  beforeEach(async () => {
      page = await newE2EPage();
      await page.evaluateOnNewDocument(() => {
          window['VegaDisabledFeatureKeys'] = ['VEGA_FORM.FORM_FIELD_CONTROLLER_VALIDATION'];
      });
  });

For spec test to disable a featureflag:

describe('vega-input', () => {
  beforeAll(() => {
    FeatureFlag.disable('VEGA_FORM.FORM_FIELD_CONTROLLER_VALIDATION');
});

Note:

  1. The main difference between unit(spec) test vs e2e test in stencil can be found here
  • Once notice here is, unit test running in stencil is not behave the exact same as running it with jest CLI directly (especially for non-component test suite), this is because stencil is mocking most of the html element by using its own test runtime component, hence we would suggest avoiding using jest CLI directly to run unit tests as you might see different testing result when run it in Github pipeline.
  1. In vega, we prefer to put test case into spec/unit test over e2e test unless they are not able to test in non-browser env (e.g. simulate user blur/focus event, window resize), the main reason is stencil doesn't support to run test coverage over e2e test case, hence we cannot easily tell the branch inside component is covered properly by e2e test.
  2. In the scenario that you have to use e2e test to cover code branch, please use istanbul/ignoring-code-for-coverage and put additional comment regarding how this branch is covered in e2e test to skip the code for coverage checking. For example:
    • in vega-stencil/src/components/vega-carousel/vega-carousel.tsx
      // ...
      
      /**
      * The below method is e2e-test covered in
      * @see{module:vega-carousel-e2e-render}
      */
      /* istanbul ignore next */
      @Watch('perPage')
      onPerPagePropsChange(): void {
        this.resizeWindowHelper();
        this.applySpacingHelper();
      }
      
      // ...
      
    • and the jsdoc module module:vega-carousel-e2e-render is defined in vega-stencil/src/components/vega-carousel/test/vega-carousel.e2e.ts
      describe('vega-carousel', () => {
        /** @module vega-carousel-e2e-render */
        it('renders', async () => {
          const page: E2EPage = await newE2EPage();
          await page.setContent('<vega-carousel></vega-carousel>');
          const element: E2EElement = await page.find('vega-carousel');
          expect(element).toHaveClass('hydrated');
        });
      });
      

Raising a commit

Make sure you have passed the necessary pre commit check by running

> npm run pre-release

Once the above command succeeded, run this command to build the artifacts for releasing

> npm run release 

Troubleshooting

1. E2E Testing Failure due to the css not loaded

This is because the current stencil build in your workspace is staled and you need to re-build the artifacts by running yarn run release.

版本与发布记录

@globalpayments/vega 共发布 126 个版本,首次发布于 2026/05/21;过去 12 个月发布了 126 个版本。

版本发布日期距今
2.110.1latest2026/11/115 天前
2.110.02026/11/0610 天前
2.109.02026/10/3017 天前
2.108.02026/10/2225 天前
2.107.02026/10/161 个月前
2.106.02026/10/091 个月前

其他发布通道:test → 1.0.1,beta → 2.87.0-beta.1,backfill-beta → 2.13.0-backfill-beta.2,backfill → 2.85.0。

关于 @globalpayments/vega 的常见问题

@globalpayments/vega 是什么?

Vega - the design system of Global Payment Systems

如何安装 @globalpayments/vega?

在项目目录运行 npm install @globalpayments/vega,或使用 pnpm add / yarn add / bun add。

@globalpayments/vega 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@globalpayments/vega 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@globalpayments/vega 可以商用吗?

@globalpayments/vega 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@globalpayments/vega 的下载量有多少?

根据 npm 官方下载统计,@globalpayments/vega 在 2026/10/17 – 2026/11/15 这 30 天内被下载 12,246 次,日均约 408 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@globalpayments/vega 还在维护吗?

最新版本 2.110.1 发布于 2026/11/11(5 天前);至今共发布 126 个版本,其中过去 12 个月发布了 126 个;首次发布于 2026/05/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。