From 64fe201ed697eadcccbc6af99753f94da0046576 Mon Sep 17 00:00:00 2001 From: coderhxl Date: Wed, 30 Nov 2022 15:42:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B6=E4=BB=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 16 ++++++++-------- .gitignore | 14 ++------------ jest.config.js | 3 ++- package.json | 8 ++++---- script/{test.mjs => debug.mjs} | 4 ++-- test/{index.js => debug.js} | 0 test/{index.ts => debug.ts} | 0 test/model.test.ts | 3 ++- 8 files changed, 20 insertions(+), 28 deletions(-) rename script/{test.mjs => debug.mjs} (83%) rename test/{index.js => debug.js} (100%) rename test/{index.ts => debug.ts} (100%) diff --git a/.editorconfig b/.editorconfig index 4926e9f..bb54485 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,14 +2,14 @@ root = true -[*] # 表示所有文件适用 -charset = utf-8 # 设置文件字符集为 utf-8 -indent_style = space # 缩进风格(tab | space) -indent_size = 2 # 缩进大小 -end_of_line = lf # 控制换行类型(lf | cr | crlf) -trim_trailing_whitespace = true # 去除行首的任意空白字符 -insert_final_newline = true # 始终在文件末尾插入一个新行 +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true -[*.md] # 表示仅 md 文件适用以下规则 +[*.md] max_line_length = off trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index 0ad4f8f..ba2a97b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,2 @@ -# 此文件用来忽略要上传的文件 -# 配置规则: -# - 以斜杠“/”开头表示目录; -# - 以星号“*”通配多个字符; -# - 以问号“?”通配单个字符; -# - 以方括号“[]”包含单个字符的匹配列表; -# - 以叹号“!”表示不忽略(跟踪)匹配到的文件或目录; - - -node_modules/ -miniprogram_npm/ -upload/ +node_modules +coverage diff --git a/jest.config.js b/jest.config.js index b413e10..127fb35 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,4 +2,5 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'node', -}; \ No newline at end of file + collectCoverage: true +} diff --git a/package.json b/package.json index 84f06e5..e9fa0af 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,10 @@ "main": "src/index.ts", "scripts": { "build": "rollup --config rollup.config.mjs", - "build-strict": "pnpm dev-test && pnpm build && pnpm pro-test", - "test": "rollup --watch --config script/test.mjs", - "dev-test": "jest test/model.test.ts dev", - "pro-test": "jest test/model.test.ts pro", + "build-strict": "pnpm test-dev && pnpm build && pnpm test-pro", + "test-debug": "rollup --watch --config script/debug.mjs", + "test-dev": "jest test/model.test.ts dev", + "test-pro": "jest test/model.test.ts pro --coverage=false", "prettier": "prettier --write ." }, "devDependencies": { diff --git a/script/test.mjs b/script/debug.mjs similarity index 83% rename from script/test.mjs rename to script/debug.mjs index f03c196..4c9792c 100644 --- a/script/test.mjs +++ b/script/debug.mjs @@ -3,9 +3,9 @@ import terserPlugin from '@rollup/plugin-terser' import runPlugin from '@rollup/plugin-run' export default { - input: 'test/index.ts', + input: 'test/debug.ts', output: { - file: 'test/index.js', + file: 'test/debug.js', format: 'iife' }, plugins: [tsPlugin(), terserPlugin(), runPlugin({ stdin: { clear: true } })] diff --git a/test/index.js b/test/debug.js similarity index 100% rename from test/index.js rename to test/debug.js diff --git a/test/index.ts b/test/debug.ts similarity index 100% rename from test/index.ts rename to test/debug.ts diff --git a/test/model.test.ts b/test/model.test.ts index a926131..f02568b 100644 --- a/test/model.test.ts +++ b/test/model.test.ts @@ -1,5 +1,6 @@ import process from 'process' import { expect, test } from '@jest/globals' + import { IXlStore } from '../src/types' const args = process.argv.splice(3) @@ -7,7 +8,7 @@ const model = args[0] let xlStore: IXlStore if (model === 'dev') { - xlStore = require('../src/index').default + xlStore = require('../src').default } else if (model === 'pro') { xlStore = require('../publish/lib') }