Skip to content

Commit

Permalink
Merge pull request #7 from mike-north/docs
Browse files Browse the repository at this point in the history
feat: auto-extract and generate API surface
  • Loading branch information
mike-north authored Oct 5, 2018
2 parents 2466c0d + 82997e4 commit 4614215
Show file tree
Hide file tree
Showing 7 changed files with 1,724 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
/bower.json.ember-try
/package.json.ember-try
.nyc_output
temp
25 changes: 24 additions & 1 deletion addon-test-support/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @packagedocumentation
*/
import ApplicationInstance from "@ember/application/instance";
import { setupRenderingTest, setupApplicationTest } from "ember-qunit";
import { setupTest } from 'ember-qunit';
Expand All @@ -10,9 +13,17 @@ abstract class BaseEmberTest {
protected getProperties!: (...args: any[]) => any[];
}

/**
* A test module that requires rendering (i.e., a component integration test)
* @param E - Root element type
* @public
*/
export abstract class EmberRenderingTest<
E extends HTMLElement = HTMLElement
> extends BaseEmberTest {
/**
* Boundary element wrapping the rendered content
*/
protected element!: E;
constructor(
hooks: NestedHooks,
Expand All @@ -24,6 +35,12 @@ export abstract class EmberRenderingTest<
}
}
}

/**
* A test module that requires booting the application (i.e., an acceptance test)
*
* @public
*/
export abstract class EmberApplicationTest extends BaseEmberTest {
constructor(
hooks: NestedHooks,
Expand All @@ -35,6 +52,12 @@ export abstract class EmberApplicationTest extends BaseEmberTest {
}
}
}

/**
* A basic test (i.e., a unit test)
*
* @public
*/
export abstract class EmberTest extends BaseEmberTest {
constructor(
hooks: NestedHooks,
Expand All @@ -45,4 +68,4 @@ export abstract class EmberTest extends BaseEmberTest {
setupTest(hooks);
}
}
}
}
10 changes: 10 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://dev.office.com/json-schemas/api-extractor/api-extractor.schema.json",
"compiler" : {
"configType": "tsconfig",
"rootFolder": "."
},
"project": {
"entryPointSourceFile": "addon-test-support/index.d.ts"
}
}
23 changes: 23 additions & 0 deletions etc/ember-qunit-decorators.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// @public
class EmberApplicationTest extends BaseEmberTest {
constructor(hooks: NestedHooks, options?: {
skipSetup: boolean;
});
}

// @public
class EmberRenderingTest<E extends HTMLElement = HTMLElement> extends BaseEmberTest {
constructor(hooks: NestedHooks, options?: {
skipSetup: boolean;
});
protected element: E;
}

// @public
class EmberTest extends BaseEmberTest {
constructor(hooks: NestedHooks, options?: {
skipSetup: boolean;
});
}

// (No @packagedocumentation comment for this package)
49 changes: 48 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
},
"scripts": {
"build": "ember build",
"build:dts": "tsc --emitDeclarationOnly --skipLibCheck --declaration addon-test-support/index.ts",
"rm:dts": "rm ./addon-test-support/index.d.ts",
"build:api-docs": "yarn build:dts && ./node_modules/.bin/api-extractor run && yarn rm:dts",
"lint:js": "eslint .",
"start": "ember serve",
"test": "ember test",
Expand All @@ -34,6 +37,9 @@
},
"devDependencies": {
"@ember/optional-features": "^0.6.3",
"@microsoft/api-extractor": "^5.13.1",
"@semantic-release/exec": "^3.1.3",
"@semantic-release/git": "^7.0.4",
"@types/ember": "~3.0.0",
"@types/ember-qunit": "^3.0.3",
"@types/ember__test-helpers": "^0.7.5",
Expand Down Expand Up @@ -72,7 +78,7 @@
"qunit-dom": "^0.7.1",
"semantic-release": "^15.8.1",
"travis-deploy-once": "^5.0.1",
"typescript": "^2.9.2"
"typescript": "^3.1.1"
},
"engines": {
"node": ">= 8"
Expand All @@ -86,5 +92,46 @@
"ember-cli-typescript",
"ember-cli-typescript-blueprints"
]
},
"release": {
"release": {
"verifyConditions": [
"@semantic-release/npm",
"@semantic-release/github",
{
"path": "@semantic-release/exec",
"cmd": "./verify.sh"
}
],
"analyzeCommits": [
"@semantic-release/commit-analyzer"
],
"generateNotes": [
{
"path": "@semantic-release/exec",
"cmd": "yarn build:api-docs"
}
],
"prepare": [
"@semantic-release/npm",
{
"path": "@semantic-release/git",
"assets": [
"etc"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"publish": [
"@semantic-release/npm",
"@semantic-release/github"
],
"success": [
"@semantic-release/github"
],
"fail": [
"@semantic-release/github"
]
}
}
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"noUnusedParameters": true,
"noImplicitReturns": true,
"noEmitOnError": false,
"skipLibCheck": true,
"noEmit": true,
"inlineSourceMap": true,
"inlineSources": true,
Expand Down
Loading

0 comments on commit 4614215

Please sign in to comment.