Git Product home page Git Product logo

swc_plugin's Introduction

swc-plugin

rust 编写用于支持底层错误上报,自动捕获 catch 中的错误信息进行上报

目录

|-- .gitignore
|-- Cargo.lock
|-- Cargo.toml
|-- Readme.md
|-- package.json
|-- .cargo
|   |-- config
|-- src
    |-- lib.rs
    |-- tests
        |-- mod.rs
        |-- uv_test.rs
        |-- common
            |-- mod.rs

使用方法

xxxxx

编写测试及控制行为

编写测试

src/tests 目录下新建每个模块的测试文件,并统一在 mod.rs 文件中引入

use crate::to;

to!(
    catch_test2,
    // Input codes
    r#"try{
        let a = 1;
    }catch(error){

    }"#,
    // Output codes after transformed with plugin
    r#"
    import {weirwoodErrorReport} from "@common/utils/basicAbility/monitor";
    try{
        let a = 1;
    }catch(error){
        weirwoodErrorReport(error)
    }"#
);

运行想要的测试用例

  1. 运行全部测试用例

    cargo test

  2. 运行单个测试用例, 只需要指定的测试函数名作为参数即可

    cargo test catch_test_1

  3. 通过名称来过滤测试, 可以通过指定部分名称的方式来过滤运行相应的测试

    cargo test catch

  4. 运行某个模块的所有测试用例

    cargo test uv_test

swc_plugin's People

Contributors

chenwll avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.