diff --git a/.gitignore b/.gitignore index 74c4170..28ac146 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules dist +dist-test yarn.lock .env diff --git a/.mocharc.json b/.mocharc.json index dea746d..ad18cfc 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,5 +1,6 @@ { "loader" : "ts-node/esm", - "spec": "test/**/*.test.ts", - "exclude": ["node_modules"] + "spec": "dist-test/**/*.test.js", + "exclude": ["node_modules"], + "project": "./tsconfig.test.json" } \ No newline at end of file diff --git a/package.json b/package.json index 739e5a3..bdc8099 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "types": "dist/index.d.ts", "scripts": { "build": "rm -rf ./dist;npx tsc", - "test": "mocha test/**/*.test.ts", + "build:test": "rm -rf ./dist-test;tsc -p tsconfig.test.json;", + "test": "npm run build:test; mocha ", "readme": "npx readme-md-generator -p ./templates/readme.md", "commit": "git-cz", "release": "npm run build; git branch --show-current | grep -q '^main$' && release-it", diff --git a/test/test.test.ts b/test/test.test.ts new file mode 100644 index 0000000..a277c7f --- /dev/null +++ b/test/test.test.ts @@ -0,0 +1,29 @@ +/******************************************************************************* + * (c) 2023 unipackage + * + * Licensed under either the MIT License (the "MIT License") or the Apache License, Version 2.0 + * (the "Apache License"). You may not use this file except in compliance with one of these + * licenses. You may obtain a copy of the MIT License at + * + * https://opensource.org/licenses/MIT + * + * Or the Apache License, Version 2.0 at + * + * http://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 MIT License or the Apache License for the specific language governing permissions and + * limitations under the respective licenses. + ********************************************************************************/ + +import assert from "assert" +import { it } from "mocha" + +//@ts-ignore +describe("xxxx Test", () => { + it("xxxx test", async () => { + console.log("ok") + }) +}) diff --git a/tsconfig.json b/tsconfig.json index 76fb2c8..f998c57 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,8 @@ "resolveJsonModule": true, "isolatedModules": false, "jsx": "react", - "incremental": false + "incremental": false, + "declarationMap": true, }, "include": ["src/**/*"], "exclude": ["node_modules"], diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..bb68228 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "outDir": "./dist-test", + "declaration": true, + "target": "ES2015", + "strict": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "module": "CommonJS", + "moduleResolution": "node", + "declarationMap": true, + "resolveJsonModule": true, + "experimentalDecorators": true, + "isolatedModules": false, + "skipLibCheck": true, + "jsx": "react", + "incremental": false, + }, + + "include": [ + "test/**/*" + ], + + "exclude": [ + "node_modules" + ], +} \ No newline at end of file