diff --git a/.gitignore b/.gitignore index 9333400c..c72951db 100644 --- a/.gitignore +++ b/.gitignore @@ -66,4 +66,5 @@ vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/* ingame/js/* ingame/css/* gateway/js/* -gateway/css/* \ No newline at end of file +gateway/css/* +vendor/phpunit/phpunit/.phpunit.result.cache diff --git a/hwe/test-ts/basic.test.ts b/hwe/test-ts/basic.test.ts new file mode 100644 index 00000000..044a8d83 --- /dev/null +++ b/hwe/test-ts/basic.test.ts @@ -0,0 +1,7 @@ +import { assert } from 'chai'; + +describe('hello', ()=>{ + it('hello1', ()=>{ + assert.equal(2, 1+1); + }); +}); \ No newline at end of file diff --git a/package.json b/package.json index cae652ab..61b07723 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "", "main": "js/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "npm-run-all test-php-gateway test-ts", + "test-php-gateway": "vendor/bin/phpunit --bootstrap vendor/autoload.php tests", + "test-ts": "node --loader ts-node/esm ./node_modules/.bin/mocha hwe/test-ts/**/*.test.ts", "build": "webpack", "buildDev": "webpack --mode=development", "watch": "webpack watch --mode=development", @@ -84,6 +86,7 @@ "file-loader": "^6.2.0", "mini-css-extract-plugin": "^2.5.3", "mocha": "^9.2.1", + "npm-run-all": "^4.1.5", "postcss-discard-duplicates": "^5.0.3", "postcss-import": "^14.0.2", "postcss-loader": "^6.2.1", @@ -91,7 +94,7 @@ "sass": "^1.49.8", "sass-loader": "^12.6.0", "style-loader": "^3.3.1", - "ts-node": "^10.5.0", + "ts-node": "^10.6.0", "typescript": "^4.5.5", "url-loader": "^4.1.1", "vue-eslint-parser": "^8.2.0", diff --git a/tests/BasicTest.php b/tests/BasicTest.php new file mode 100644 index 00000000..2fbba48b --- /dev/null +++ b/tests/BasicTest.php @@ -0,0 +1,6 @@ +assertEquals(1+1, 2); + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index ba0c3108..aebd137c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -72,5 +72,8 @@ /* Advanced Options */ "skipLibCheck": true, /* Skip type checking of declaration files. */ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - } + }, + "exclude": [ + "**/*.test.ts" + ] }