Skip to content

Commit

Permalink
test: Integration test
Browse files Browse the repository at this point in the history
Signed-off-by: koooge <koooooge@gmail.com>
  • Loading branch information
koooge committed Apr 20, 2023
1 parent 8fb1f03 commit 6236894
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ jobs:
run: npm run build
- name: Test + coverage
run: npm run cover:ci
- name: Integration Test
run: |
cd test
npm i
npm run test:cjs
npm run test:mjs
npm run test:ts-node16
npm run test:ts-esm-node16
1 change: 1 addition & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/package-lock.json
11 changes: 11 additions & 0 deletions test/fixture/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es2020",
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true
}
}
11 changes: 11 additions & 0 deletions test/fixture/tsconfig.node16.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"moduleResolution": "node16",
"target": "es2020",
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true
}
}
8 changes: 8 additions & 0 deletions test/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const assert = require('node:assert');
const { oas31 } = require('openapi3-ts');
const { OpenApiBuilder } = require('openapi3-ts/oas31');

const builder1 = new oas31.OpenApiBuilder();
assert.ok(typeof builder1.rootDoc === 'object');
const builder2 = new OpenApiBuilder();
assert.ok(typeof builder2.rootDoc === 'object');
1 change: 1 addition & 0 deletions test/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
8 changes: 8 additions & 0 deletions test/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import assert from 'node:assert';
import { oas31 } from 'openapi3-ts';
import { OpenApiBuilder } from 'openapi3-ts/oas31';

const builder1 = new oas31.OpenApiBuilder();
assert.ok(typeof builder1.rootDoc === 'object');
const builder2 = new OpenApiBuilder();
assert.ok(typeof builder2.rootDoc === 'object');
8 changes: 8 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import assert from 'node:assert';
import { oas31 } from 'openapi3-ts';
import { OpenApiBuilder } from 'openapi3-ts/oas31';

const builder1 = new oas31.OpenApiBuilder();
assert.ok(typeof builder1.rootDoc === 'object');
const builder2 = new OpenApiBuilder();
assert.ok(typeof builder2.rootDoc === 'object');
17 changes: 17 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "openapi3-ts-test",
"version": "1.0.0",
"main": "index.cjs",
"scripts": {
"test:cjs": "node index.cjs",
"test:mjs": "node index.mjs",
"test:ts": "ts-node --project fixture/tsconfig.node.json index.ts",
"test:ts-esm": "ts-node --esm --project fixture/tsconfig.node.json index.ts",
"test:ts-node16": "ts-node --project fixture/tsconfig.node16.json index.ts",
"test:ts-esm-node16": "ts-node --esm --project fixture/tsconfig.node16.json index.ts"
},
"dependencies": {
"openapi3-ts": "file:..",
"ts-node": "^10.9.1"
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
},
"buildOnSave": true,
"compileOnSave": true,
"exclude": ["**/*.spec.ts", "bin", "dist", "vite.config.ts", "node_modules/**"]
"exclude": ["**/*.spec.ts", "bin", "dist", "test", "vite.config.ts", "node_modules/**"]
}

0 comments on commit 6236894

Please sign in to comment.